How to stop Repeated Audio play in Audio Mixer (MixerHost) for iOS
I have got Audio Mixer(MixerHost) sample code from Apple iOS. This code is working fine. It is playing the sample Audio files continuously. Can you tell me how to stop my Mixer code to stop after playing audio once?
Is it possible disable repeat开发者_运维百科ed play using AVAudiosession
.
Do you have this method?
// Handle a play/stop button tap
- (IBAction) playOrStop: (id) sender
In MixerHostAudio.m, inside the inputRenderCallback method, just comment the line
if (sampleNumber >= frameTotalForSound) sampleNumber = 0;
Try to implement this inputRenderCallback as below:
if (sampleNumber >= frameTotalForSound) {
[[NSNotificationCenter defaultCenter] postNotificationName:NOTI_AUDIO object:nil userInfo:nil];
return noErr;
}
The NSNotification "NOTI_AUDIO" just let the viewcontroller know when the audio is stopped.
Hope this helps!
精彩评论