Playing Sounds in iOS
Chris Sheffield
cmsheffield at me.com
Thu Jun 21 15:48:08 EDT 2012
Roger,
Try this. Open the Standalone Application Settings dialog. Click on Copy Files. Look at your list of files and/or folders. Did you add files individually? Did you add an entire folder of files? Check the paths of these files/folders? Do these paths contain any subfolders relative to your stack file? For example, if you added an entire folder containing sound files, it might be listed as "[some folder]/*". If you added individual files, they might be listed as "[some folder]/mySound.wav". If that's the case, you have to include those folder names in your code when creating the path to the files. Using "the engine folder" will not automatically add those sub folder names. So that's the first thing to check.
If that all looks good, make a slight mod to the answer command so that it's "answer tSoundFile". This way you can verify the path is what you expect it to be. In the simulator, that path will be fairly long most likely. If that path looks okay, then it may just be that the files are not compatible. Do they play okay on your computer? Verify that it's a supported file type on iOS using the list Jacque provided.
Hopefully I'm being helpful and not just causing more confusion. Sometimes I'm not very good at explaining things. Let me know if you still have questions. Also, like Devin said, the iOS file system is case sensitive, where the Mac OS file system may or may not be. So make sure file and folder names in your code match case exactly as it is on disk. I've gotten bit by that a few times.
Chris
On Jun 21, 2012, at 11:43 AM, Roger Guay <irog at mac.com> wrote:
> Thanks so much for you patience, Chris . . . I'm learning a lot from you, but unfortunately, I'm still not able to play sounds in iOS. In answer to your questions and points:
>
> I am not able to play sounds in either the simulator nor my iPad.
>
> The answer command you suggest (very clever!) returns false in the simulator and on my iPad. Yet, I have verified the files are sitting in plain site of Show Package Contents folder of the standalone
>
> You mention that "You can also verify the path by looking at the path as it's listed in Standalone Application Settings". Where is that? I can't seem to find anything except the "Default build folder", which in my case is my desktop. Doesn't the "engine folder" take care of path automatically when running on the device?
>
> Thanks again,
>
> Roger
>
>
> On Jun 20, 2012, at 3:12 PM, use-livecode-request at lists.runrev.com wrote:
>
>> Message: 10
>> Date: Wed, 20 Jun 2012 13:14:11 -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: <D9E8907F-8AFF-48C5-BD78-B900BC68BE8A at me.com>
>> Content-Type: text/plain; CHARSET=US-ASCII
>>
>> Your code seems okay as far as I can tell. I'm guessing the path is not getting set correctly. Are you running this in the simulator or on a device?
>>
>> One really quick way to verify the path of a file, especially if you're running in the simulator, is to simply place an answer command right before the call to mobilePlaySoundOnChannel to check the existence of the file you're trying to play. So something like:
>>
>> answer there is a file tSoundFile
>>
>> This will return true if the file exists, false otherwise. If your app is built for a device and you want to make sure the file are copying into the bundle correctly, in the Finder, right click on the bundle and choose Show Package Contents. Your files will either be right inside that folder or inside a sub folder. So just make sure to set the path accordingly. You can also verify the path by looking at the path as it's listed in Standalone Application Settings. If there are any folder names as part of the path, those folders will be created inside your app bundle and need to be included when building paths for the sound files.
>>
>> So if you've verified the path and things are still not working, the only other thing I can think of is that you've got files that are not compatible with iOS for whatever reason, though I believe those file types are.
>>
>> Chris
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list