06-30-2010, 02:33 AM
#1 (permalink )
Registered Member
Join Date: Jun 2010
Posts: 4
Graphic with audio.
Hi!
Can anyone make a tutorial on an application that when u touch a graphic, therer will be sound. Please?
Thanks!
06-30-2010, 02:47 AM
#2 (permalink )
Registered Member
Join Date: May 2010
Posts: 100
U take a look of AVAudio Player, then trying to play and stop the sound according to TouchesBegan, TouchesMoved, and TouchesEnded...
that's it......
06-30-2010, 02:39 PM
#3 (permalink )
Nerd.
Join Date: Jun 2010
Location: In a house
Posts: 458
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
06-30-2010, 02:43 PM
#4 (permalink )
Nerd.
Join Date: Jun 2010
Location: In a house
Posts: 458
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)
07-01-2010, 07:50 AM
#5 (permalink )
Registered Member
Join Date: Jun 2010
Posts: 4
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! =]
07-01-2010, 07:39 PM
#6 (permalink )
Nerd.
Join Date: Jun 2010
Location: In a house
Posts: 458
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!
07-02-2010, 11:35 PM
#7 (permalink )
Registered Member
Join Date: Jun 2010
Posts: 4
Sure i will! haha
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 445
19 members and 426 guests
cgokey , dcool , Dj_kades , Droverson , givensur , iAppDeveloper , iekei , ipodphone , jeroenkeij , karatebasker , laureix68 , LunarMoon , patapple , Paul Slocum , peterwilli , pipposanta , QuantumDoja , Sloshmonster , usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,696
Threads: 94,139
Posts: 402,961
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jasper_muc