I want make sound loops with .ogg audio files (in objective-C for iPhone ios6.1). They feature quite repetitive music, alike game music, so additionally, I would like to make them more interesting (i.e. avoid audio fatigue) by randomizing them. To begin with, I want to start playing them at some random point.
I followed instructions (OGG Vorbis in iPhone sdk) to build a vorbis library (libvorbis.a) and play ogg files. This works:
[PASoundMgr sharedSoundManager];
[[[PASoundMgr sharedSoundManager] listener] setPosition:CGPointMake(0, 0)];
self.audioSource = [[PASoundMgr sharedSoundManager] addSound:@"test_sound_file" withExtension:@"ogg" position:CGPointMake(0, 0) looped:YES];
[self.audioSource setGain:0.5f];
[self.audioSource playAtListenerPosition];
using with the @property in the interface, and the corresponding @synthesize in the .m file:
@property (nonatomic, strong) PASoundSource *audioSource;
But how to start at a different point than the beginning of the ogg?
The method playAtPosition(CGPoint) is available, so instead of playAtListenerPosition, I first tried:
[self.audioSource playAtPosition:(CGPointMake(15.0, 50.0))];
and other values instead of (15, 50), in case they mapped to similar places. However, in every case, the sound file starts at the beginning.
I also tried to change the values in the two initialization statements that contain a CGPointMake, but this makes no difference either. (Also, what do these two numerical values mean? I can only find explanations for pointing in a graphic file -so 2 dimensions, I guess-, nothing for a sound file.)
Any help or ideas would be greatly appreciated!