Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 18, 2008, 12:11 AM   #1
ethana
Banned
 
Join Date: Jul 2008
Location: Seattle, WA
AudioServicesPlaySystemSound(soundID) - How to STOP a sound?

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
ethana is offline   0 Reply With Quote
Old Dec 18, 2008, 02:50 PM   #2
bigsprocket
macrumors newbie
 
Join Date: Dec 2008
You can't. If you can target the 2.2 SDK, you can use the AVAudioPlayer class, which makes manipulating sound a LOT easier than it was in 2.0/2.1

http://developer.apple.com/iphone/li...Reference.html
__________________
_________________________
kyle [at] bigsprocket.com
http://www.bigsprocket.com -- iPhone programing and goodies!
bigsprocket is offline   0 Reply With Quote
Old Dec 18, 2008, 05:38 PM   #3
Niiro13
macrumors 68000
 
Join Date: Feb 2008
Location: Illinois
Send a message via AIM to Niiro13 Send a message via MSN to Niiro13 Send a message via Yahoo to Niiro13
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.
Niiro13 is offline   0 Reply With Quote
Old Dec 19, 2008, 08:45 AM   #4
neil.b
macrumors member
 
Join Date: Nov 2008
Another vote for AVAudio here.
neil.b is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How do I stop stop the annoying email notification sound in Safari kmdonovan1 Mac Basics and Help 4 Mar 18, 2014 04:52 AM
MBP + USB sound card = noticeably better sound? Meroigo Buying Tips and Advice 8 Dec 9, 2013 03:20 AM
odd behavior with sound, have to unplug headphones, then plug to get sound Sossity Mac Basics and Help 1 Dec 2, 2013 01:13 AM
Annoying sound on iMac 27" (sound uploaded) SSSmAsHeRRR iMac 9 Nov 5, 2012 09:19 PM
Mountain Lion installed but no sound, system preferences or sound related apps. rickmusik OS X 10.8 Mountain Lion 3 Aug 2, 2012 01:55 PM

Forum Jump

All times are GMT -5. The time now is 04:43 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC