Playing a sequence of sounds without gaps (iPhone)

Posted by Fiire on Stack Overflow See other posts from Stack Overflow or by Fiire
Published on 2012-06-18T23:51:48Z Indexed on 2012/06/26 3:16 UTC
Read the original article Hit count: 72

Filed under:
|
|

I thought maybe the fastest way was to go with Sound Services. It is quite efficient, but I need to play sounds in a sequence, not overlapped. Therefore I used a callback method to check when the sound has finished. This cycle produces around 0.3 seconds in lag. I know this sounds very strict, but it is basically the main axis of the program.

EDIT: I now tried using AVAudioPlayer, but I can't play sounds in a sequence without using audioPlayerDidFinishPlaying since that would put me in the same situation as with the callback method of SoundServices.

EDIT2: I think that if I could somehow get to join the parts of the sounds I want to play into a large file, I could get the whole audio file to sound continuously.

EDIT3: I thought this would work, but the audio overlaps:

waitTime = player.deviceCurrentTime;

    for (int k = 0; k < [colores count]; k++)
    {    
        player.currentTime = 0;
        [player playAtTime:waitTime];
        waitTime += player.duration;
    }

Thanks

© Stack Overflow or respective owner

Related posts about ios

Related posts about cocoa-touch