Search code examples
iphoneaudiofinch

finished playing audio callback with finch


is there a finished playing callback with finch? similar to - audioPlayerDidFinishPlaying in the avaudioplayer stuff? looking through the code i could not find anything that referenced it.


Solution

  • There is no such callback in Finch, because OpenAL does not support it. (Or at least it did not support it when I last looked.) You can fake it like this:

    - (void) playSoundWithCallback {
        [someSound play];
        [someDelegate performSelector:@selector(soundDidFinishPlaying:)
            withObject:someSound afterDelay:someSound.duration];
    }
    

    I did not try it, but it’s a simple code, it should work fine. Well… at least until you start messing with the pitch and therefore the sound speed :)