I've got an app that allows a user to record over a beat using audio units. To achieve this I've modified the Mixer class from Apple's MixerHost example code. 

Currently my sound file loops and I want to stop that. I'd like the user to be able to save the mix once the sound file is through.

The reason for the loop is a `for loop` in the last line of the following section of the `inputrendercallback` function: 

```
for (UInt32 frameNumber = 0; frameNumber < inNumberFrames; ++frameNumber) {

        outSamplesChannelLeft[frameNumber]                 = dataInLeft[sampleNumber];
        if (isStereo) outSamplesChannelRight[frameNumber]  = dataInRight[sampleNumber];

        sampleNumber++;

        // After reaching the end of the sound stored in memory--that is, after
        //    (frameTotalForSound / inNumberFrames) invocations of this callback--loop back to the 
        //    start of the sound so playback resumes from there.
        if (sampleNumber >= frameTotalForSound) sampleNumber = 0;
    }

```

I realize that I need to change `if (sampleNumber >= frameTotalForSound) sampleNumber = 0;` in order to tell the callback to stop requesting samples once the samples have been exhausted, but I'd be far more comfortable calling methods in objective C than I am manipulation this C-Struct.

Does anyone have any ideas about how to do this?

Thanks.