Android play sounds
Michael Doub
mikedoub at gmail.com
Wed Mar 28 16:45:40 EDT 2012
Thanks for the locations of the native android sounds I have been looking for that.
I worked around my problem by testing for "no sound support" and just playing the sound a second time and it works reliably.
On Mar 27, 2012, at 8:53 PM, Barry G. Sumpter wrote:
> Yep, a timer to sound an alarm and 1 minute intervals.
>
> I forgot how complex/different Android sounds are from win32 sounds.
>
> Perhaps the first time the play sound is attempted
> The file doesn't exist -- yes it exists
> Or the folder doesn't exist - yes it exists
> Or the actual sound file won't play on android yes it plays the second time
> As my sound file on android are .ogg
>
>
>
> I'm selecting the sounds from the existing sound files on my Android device.
> Using the following paths
> /system/media/audio/
> alarms
> notifications
> ringtones
> ui
>
> The storing the path n file name into a preferences file
> and on an Interval or Finish button as a custom property
>
> on mouseUp
>
> -- show the path and file name of the sound
> put "Playing: " & the cSoundPathAndFileName of button btnSoundsInterval
> into field lblPlayingSound
>
> -- now actually play the sound
> Play the cSoundPathAndFileName of button btnSoundsInterval
>
> end mouseUp
>
> lblPlayingSound field:
> /system/media/audio/notifications/Aldebaran.ogg
> or
> /system/media/audio/ui/Dock.ogg
>
>
> Just tested again on LC 5.5 build 1479 - all working OK
> Tested on two HD2s.
>
> If I might be so bold to suggest a test button
> with a sound file
> that you know its exact path to.
> If it plays then
> try the exact same play command/script line
> right where the other sound is NOT playing.
>
> on mouseUp
> play "/system/media/audio/ui/Dock.ogg"
> end mouseUp
>
> hth
>
> --------------------------------------------------------
> Message: 9
> Date: Tue, 27 Mar 2012 15:18:16 -0400
> From: Michael Doub <mikedoub at gmail.com>
> To: LiveCode Developer List <livecode-dev at lists.runrev.com>, How To
> use LiveCode use LiveCode <use-livecode at lists.runrev.com>
> Subject: Android play sounds
> Message-ID: <202365A5-E4CE-43D4-A1A7-C693689212AC at gmail.com>
> Content-Type: text/plain; charset=us-ascii
>
> I am building a android timer application. The sound file "AC.mp3" is
> located in a folder "Data". Within the standalone builder I added the
> "Data" folder under the copy files tab which now displays: "Data/*". All of
> this seems to work just fine, however the sound file is not played on the
> first play call. The sound is successfully played on all subsequent calls.
>
> The result returned on the first play call is "no sound support" which is
> different from what is specified in the Android release notes. So I think
> we have a documentation error at the very least.
>
> Is there any sound initialization step that I am missing?
>
> Here is the alarm code:
>
> On alarm
> if the environment is "mobile" then
> put specialFolderPath("engine") & slash & "Data" & slash & "AC.mp3"
> into tSound
> play tSound
> else
> beep
> end if
> end alarm
>
>
>
> _______________________________________________
> 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