Novocaine - How to loop file playback? (iOS)
- by lppier
I'm using Novocaine by alexbw Novocaine for my audio project.
I'm playing around with the example code here for file reading.
The file plays back with no problem. I would like to loop this recording with the gap between the loops - any suggestion as to how I can do so?
Thanks.
Pier.
// AUDIO FILE READING OHHH YEAHHHH
// ========================================
NSArray *pathComponents = [NSArray arrayWithObjects:
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject],
@"testrecording.wav",
nil];
NSURL *inputFileURL = [NSURL fileURLWithPathComponents:pathComponents];
NSLog(@"URL: %@", inputFileURL);
fileReader = [[AudioFileReader alloc]
initWithAudioFileURL:inputFileURL
samplingRate:audioManager.samplingRate
numChannels:audioManager.numOutputChannels];
[fileReader play];
[fileReader setCurrentTime:0.0];
//float duration = fileReader.getDuration;
[audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
{
[fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels];
NSLog(@"Time: %f", [fileReader getCurrentTime]);
}];