Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials > Tutorial Requests

Reply
 
LinkBack Thread Tools Display Modes
Old 06-30-2010, 02:33 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 4
swelwin is on a distinguished road
Exclamation Graphic with audio.

Hi!
Can anyone make a tutorial on an application that when u touch a graphic, therer will be sound. Please?
Thanks!
swelwin is offline   Reply With Quote
Old 06-30-2010, 02:47 AM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 100
mobin_shaikh is on a distinguished road
Default

U take a look of AVAudio Player, then trying to play and stop the sound according to TouchesBegan, TouchesMoved, and TouchesEnded...

that's it......
mobin_shaikh is offline   Reply With Quote
Old 06-30-2010, 02:39 PM   #3 (permalink)
Nerd.
 
Join Date: Jun 2010
Location: In a house
Posts: 458
BillyGiggles is on a distinguished road
Default

This is super easy once you know how just in your .h file type


- (IBAction)playSound;

then go to your .m (add the frame work AVAudioPlayer.h) then at the top type

#import<AVFoundation/AVAudioPlayer.h>

then for you sound type

- (IBAction)playSound{
NSString *path = [[NSBundle mainBundle] pathForResource:@"SOUND FILE NAME GOES HERE" ofType:@"AUDIO FILE TYPE (.mp3 . mov .m4v)"];
AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;

[theAudio play];
}


then connect you out lets
BillyGiggles is offline   Reply With Quote
Old 06-30-2010, 02:43 PM   #4 (permalink)
Nerd.
 
Join Date: Jun 2010
Location: In a house
Posts: 458
BillyGiggles is on a distinguished road
Default

oops for got in IB make a button then on IMAGE: put you image that you copyied into xcode of what i do is (for multiple buttons making a image like a drum set) make how many ever buttons you want on one image then put it into a UIImageView Then put REGULAR BUTTONS over it then drop th "Alpha" to .02 then connect the buttons to your sound (YOU CAN DO THIS TO PLAY A SOUND OF ANY LENGTH AND YOU CAN MAKE THIS CODE MULTIPLE TIMES AND PLAY MULTIPLE SOUNDS)
BillyGiggles is offline   Reply With Quote
Old 07-01-2010, 07:50 AM   #5 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 4
swelwin is on a distinguished road
Default

Thanks a lot!! But now i am waiting for the school to let me try out on their mac. I need to wait for turn to use mac in our school. I will ask again if i meet up with other problems. Thanks a lot again! =]
swelwin is offline   Reply With Quote
Old 07-01-2010, 07:39 PM   #6 (permalink)
Nerd.
 
Join Date: Jun 2010
Location: In a house
Posts: 458
BillyGiggles is on a distinguished road
Default

yep i learned that a few weeks ago and am using it in a music app i will let you know when its on the app sotre and you should check it out!
BillyGiggles is offline   Reply With Quote
Old 07-02-2010, 11:35 PM   #7 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 4
swelwin is on a distinguished road
Default

Sure i will! haha
swelwin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 175,696
Threads: 94,139
Posts: 402,961
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jasper_muc
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:02 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0