i try to create a small JingeMachine, to play sound mp3 wav and other i use this Action on button is TouchDown:
- (IBAction)NormalApplause:(id)sender {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soudFileURLRef;
soudFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"normalApplause" , CFSTR ("mp3"), NULL);
UInt32 sounudID;
AudioServicesCreateSystemSoundID(soudFileURLRef, &sounudID);
AudioServicesPlaySystemSound(sounudID);
}
How can stop all sound with other Button? i will can start all sound to a multiple touch, but if is possible i will stop all in a single touch.
Can Helpme please?
You can't stop sound played with
AudioServices
, you will need to use theAVAudioPlayer
.Also if you call
AudioServicesCreateSystemSoundID
you will need toAudioServicesDisposeSystemSoundID
to correctly dispose of the sound ref.