AudioServicesPlaySystemSound(soundID) - How to STOP a sound?

Discussion in 'iPhone/iPad Programming' started by ethana, Dec 17, 2008.

  1. macrumors 6502a

    Joined:
    Jul 17, 2008
    Location:
    Seattle, WA
    #1
    AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
    AudioServicesPlaySystemSound(soundID);

    I am playing a sound effect that is about 5 seconds long with the calls above. How do I stop the sound right in the middle of it playing?

    Ethan
     
  2. macrumors newbie

    Joined:
    Dec 18, 2008
    #2
  3. macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #3
    There's no method to pause it (which is why most people use AudioQueue or OpenAL) or stop it (in a sense where you're simply stopping the sound ready to be played again), but you can use the AudioServicesDisposeSystemSoundID which will theoretically stop the sound.
     
  4. macrumors member

    neil.b

    Joined:
    Nov 20, 2008
    #4
    Another vote for AVAudio here.
     

Share This Page