Discussion Forums  >  Uncategorized

Replies: 5    Views: 462

camposo
Aspiring developer
Profile
Posts: 17
Reg: Jun 11, 2011
Boynton Beach, ...
170
08/15/11 06:08 PM (12 years ago)

(IOS) Splash Screen Audio?

Is there any way to include a 2-3 seconds audio file to play along with the splash screen? For example, a zoo app that has a splash screen of a lion n then it'll play a roar sound everytime you open the app. I'm guessing it'll have to do with adding a line of code to BT_screen_splash.m maybe? Anybody has any idea?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/16/11 12:24 AM (12 years ago)
This is a cool idea. You'll want to be sure you have the audio added to the Xcode project so it doesn't take time to download (slow splash screens are no fun!) . a) Add the audio file to the Xcode project in the BT_Sounds folder b) Add the name of your sound file to the array of sound effects that get initialized when the app launches. Add them to the list in the appDelegate.m file in the loadSoundEffects method starting on 849 c) Now, the 'lion' sound is being initialized when the app loads so it's ready to play! d) In the BT_screen_splash.m file we need to tell it to play the sound. Do this in the viewWillAppear appear method. Just before the last curly brace in this method, do: [appDelegate playSoundEffect:@''myLionRoar.mp3'']; Bet it works. If it doesn't, look at the output console when the splash screen loads, see if it reports any trouble finding the sound effect or something.
 
camposo
Aspiring developer
Profile
Posts: 17
Reg: Jun 11, 2011
Boynton Beach, ...
170
like
08/16/11 06:07 AM (12 years ago)
Great I'm gonna give it a try, and report the outcome. Thanks a million
 
camposo
Aspiring developer
Profile
Posts: 17
Reg: Jun 11, 2011
Boynton Beach, ...
170
like
08/16/11 01:14 PM (12 years ago)
Ok, I followed your directions and then it compiled without any errors, but the sound still not coming out. It seems like its missing a piece of code because after checking the console it does not mention at all that it should be playing a sound at any given point. I can provide a copy of what the console says if you think it'll help
 
camposo
Aspiring developer
Profile
Posts: 17
Reg: Jun 11, 2011
Boynton Beach, ...
170
like
08/16/11 01:15 PM (12 years ago)
btw I used one of the sounds that comes already in the project glass.mp3 for testing purposes, so there's no chance it's not finding the file.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/16/11 11:35 PM (12 years ago)
Hmm... see if you can get some NSLog statement in the viewWillAppear method in BT_screen_splash.m. Put them above and below the [appDelegate playSoundEffect:@'glass.mp3']; then look at the console when the app launches and see if that method is firing. Gonna have to figure out where to put the 'play sound' command.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.