Novocaine - How to loop file playback? (iOS)

Posted by lppier on Stack Overflow See other posts from Stack Overflow or by lppier
Published on 2012-11-02T04:19:38Z Indexed on 2012/11/02 5:01 UTC
Read the original article Hit count: 331

Filed under:
|

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]);

 }];

© Stack Overflow or respective owner

Related posts about ios

Related posts about core-audio