Immediate sound feedback on Android

J. Landman Gay jacque at hyperactivesw.com
Wed Jun 1 13:29:13 EDT 2011


On 6/1/11 6:23 AM, Roger Eller wrote:
> I can't get sounds to play at all on Android.  I have tried importing a .wav
> file into the stack, and also referencing the file via its path.  In both
> cases, there is a delay the first time the sound is played in the LiveCode
> IDE.  How can I insure the playback will be "immediate" when a button is
> touched?  Is there a best practice regarding embedding sounds -vs-
> referencing them for mobile?

Embedded sounds don't work well, use sound files on disk instead. 
Include them in the Copy Files pane of the standalone builder, with or 
without an enclosing subfolder. When playing the sound, use the whole 
file path, starting with specialFolderPath("engine").

Since you are getting a delay, it sounds like the sounds are being found 
okay, but you are experiencing the initial loading of Android's sound 
playback system. To get around that, I'd try preloading it early in the 
launch sequence, maybe on openstack. I haven't actually tried this yet, 
but I think it will work. Get the current playLoudness and save it in a 
variable, set the playLoudness to zero, play one of your sounds (which 
you won't hear) and then reset the playLoudness to its initial value.

If it works let us know, I've been meaning to try it but I haven't had 
time to work on my test stack lately.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list