Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

codenamecueball

macrumors regular
Original poster
Jul 28, 2009
105
0
Hi there programming forum.

I am currently writing an app which plays a sound when a picture is tapped or hit or whatever. The code I am using is here
Code:
- (IBAction)HighFive{
	//Get the filename of the sound file:
	NSString *path = [NSString stringWithFormat:@"%@%@",
					  [[NSBundle mainBundle] resourcePath],
					  @"/highfive.mp3"];
	
	//declare a system sound id
	SystemSoundID ;soundID;      < 'soundID' undeclared
	
	//Get a URL for the sound file
	NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
	
	//Use audio sevices to create the sound
	AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
	
	//Use audio services to play the sound
	AudioServicesPlaySystemSound(soundID);
}

What am I doing wrong and how do I get this to work :(
 
Ok, never mind, misplaced colon. Now I need to make it so when the image is tapped the sound plays. Would a button with the alpha set to 0 work? :apple:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.