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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Mail - How to stop a message? psiachris Mac Applications and Mac App Store 2 Nov 17, 2007 09:55 PM
Gmail Question - how to stop old mail from being d/l'd? Chupa Chupa iPhone Tips, Help and Troubleshooting 7 Nov 7, 2007 11:04 AM
Finder's "Slideshow" option randomising images - how to stop it? thomasp OS X 1 Aug 7, 2007 09:24 AM
AppleScript - How to Stop Script When Error Occurs? Kelmon Mac Programming 2 Jul 23, 2006 10:10 AM


All times are GMT -5. The time now is 11:06 PM.

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

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