Closed borut-t closed 11 years ago
just don't output anything in the block when You don't want to playback, something like this:
[audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels) {
if (isPlaying) {
if (!fileReader) {
fileReader = [[AudioFileReader alloc]
initWithAudioFileURL:inputFileURL
samplingRate:audioManager.samplingRate
numChannels:audioManager.numOutputChannels];
[fileReader play];
playTime = [fileReader getDuration];
}
[fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels];
} else {
if (fileReader) {
[fileReader release];
fileReader = nil;
}
}
@mihael Thanks!
Hello,
is there a way to stop currently playing audio? I've tried this
... and this
Both are not good solutions. The first one stop playing fine but cannot play it again. Second doesn't really stops playing. It just stops file reader.
I've also tried to put stop handler into setOutputBlock
Is there any good solution to stop/play/resume audio playback?