Problem with stopping sounds through - (IBAction)

Discussion in 'iOS Programming' started by evilgoldfish, Mar 24, 2009.

  1. evilgoldfish macrumors newbie

    Mar 24, 2009
    Hi, first time post and new to iPhone programming. I have seen similar issues posted to mine but none that seem to help. Basically I am trying to make a musical scale on the iPhone which requires 13 buttons. I have the following code to play the sounds fine.
    - (IBAction)keyBoardButton1:(id)sender
    	AudioServicesPlaySystemSound (ssid1);
    I can't find a way to make the sound stop when you release the button (it plays the full sample to the end). Figured on using the "touchUpInside" in Interface builder however can't find code to stop the sound. Closest I got was using AudioServicesDisposeSystemSoundID but that stops it fine but obviously disposes of the sound and doesn't play it again! Any help using the route I have taken would be much appreciated. But if I'm going completely the wrong way please let me know and I will look at other ways of approaching. Thanks in advance and would be great to touch base with more experienced programmers as I'm doing this in my spare time, however I run a multi media company that could go into this kind of application development down the line.
  2. ghayenga macrumors regular

    Jun 18, 2008
    AudioServicesPlaySystemSound can't be stopped. It's only for short sounds. Use an AVAudioPlayer which can be stopped.

Share This Page