Playing Sounds in iOS

Roger Guay irog at mac.com
Wed Jun 20 14:44:53 EDT 2012


I'm sorry, I forgot to include the Subject 

Thanks, Chris. I tried a number of variations of your suggestion to no avail!

I tried these code snippets:

		put the engine folder & "/assets/mySnd.caf" into tSoundFile
    or 	put specialFolderPath("engine") & "/mySnd.caf" into tSoundFile

     mobilePlaySoundOnChannel tSoundFile, "current", "now"

I tried these for both wav and caf file formats, again all to no avail.

I copied sound files directly into the "non-stack files in the application" of the Standalone Application Settings. I'm sure I'm doing something stupid (again), but I can't figure it out. I would greatly appreciate any more help you might provide.

BTW, you suggest verifying "that it's copying correctly in the app bundle". How do I do that?

Thanks,
Roger




On Jun 20, 2012, at 10:00 AM, use-livecode-request at lists.runrev.com wrote:

> Message: 9
> Date: Wed, 20 Jun 2012 08:38:58 -0600
> From: Chris Sheffield <cmsheffield at me.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: Playing Sounds in iOS
> Message-ID: <40FFFF72-D477-42C7-BC36-0DC45EE0BAA2 at me.com>
> Content-Type: text/plain; CHARSET=US-ASCII
> 
> Roger,
> 
> When using mobilePlaySoundOnChannel, I've always had to build the full path to the file for it to work correctly. So if you've verified that it's copying correctly into the app bundle and, assuming it's not in a sub folder of the bundle, try something like this:
> 
> if the environment is "mobile" then
> put specialFolderPath("engine") & "/mySnd.wav" into tPath
> mobilePlaySoundOnChannel tPath, "current", "now"
> else
> play "mySnd.wav"
> end if
> 
> Hopefully that'll work for you. If you have the sound file in a sub folder in the bundle, simply make sure to include that in the path.
> 
> Chris Sheffield
> 
> 
> On Jun 20, 2012, at 7:46 AM, Roger Guay <irog at mac.com> wrote:
> 
>> Hi all,
>> 
>> I'm trying to play a sound in iOS.
>> 
>> My code: 			if the environment is "mobile" then mobilePlaySoundOnChannel  "mySnd.wav", "current", "now"
>>  				else play "mySnd.wav"
>> 
>> I've imported mySnd.wav to the stack and I've copied it to the "Non-stack files in the application" of the Standalone Application Settings.
>> 
>> it works in the IDE but not in the simulator nor my iPad. 
>> 
>> Any help please?
>> 
>> Thanks!
>> Roger 
> 





More information about the use-livecode mailing list