mobilePlaySoundOnChannel with more sounds error?

Pierre Sahores sc at sahores-conseil.com
Wed Oct 30 20:35:35 CET 2013


Hi William,

See below as an example working case (iOS/Android) :

> on preopenstack

>    put specialFolderPath("engine") & "/CityChic.mp3" into Melodie[3] 
>    put specialFolderPath("engine") & "/CitySport.mp3" into Melodie[4] 
>    put specialFolderPath("engine") & "/Elegance.mp3" into Melodie[1] 
>    put specialFolderPath("engine") & "/Graphique.mp3" into Melodie[2] 
> end preopenstack


> on soundlevelonoff
>    if "firstChannel" is not in mobileSoundChannels() then
>       mobilePlaySoundOnChannel Melodie[random("4")], "firstChannel", now
>       if "soundswitcher" is in the target
>       then set the icon of the target to 7908
>       mobileSetSoundChannelVolume "firstChannel", 100
>    else if mobileSoundChannelStatus("firstChannel") is "paused" then       
>       if "soundswitcher" is in the target
>       then set the icon of the target to 7908
>       mobileResumePlayingOnChannel "firstChannel"
>    else if "soundswitcher" is in the target then 
>       mobilePausePlayingOnChannel "firstChannel"
>       set the icon of the target to 7909
>    else mobilePausePlayingOnChannel "firstChannel"
> end soundlevelonoff

> on soundFinishedOnChannel tchannel, thesound
>    if thesound is Melodie[1]
>    then mobilePlaySoundOnChannel Melodie[2], tchannel, now
>    else if thesound is Melodie[2]
>    then mobilePlaySoundOnChannel Melodie[3], tchannel, now
>    else if thesound is Melodie[3]
>    then mobilePlaySoundOnChannel Melodie[4], tchannel, now
>    else mobilePlaySoundOnChannel Melodie[1], tchannel, now
> end soundFinishedOnChannel

Best Regards,

Pierre

Le 30 oct. 2013 à 11:10, William de Smet a écrit :

> Hi there,
> 
> 
> Fore an upgrade for one of my iOS Math apps I want to add sound.
> The idea is to pronounce each sum (5+3= or 8-2=).
> Based upon the numbers the right sounds need to be played.
> 
> Not that difficult (I thought) but I am testing it with 3 sound files
> (1,2,3) and on my iPad it only plays the first and the third one.
> I am using mobilePlaySoundOnChannel:
> 
> mobilePlaySoundOnChannel tSoundFile1, "current", "now"
> mobilePlaySoundOnChannel tSoundFile2, "current", "next"
> mobilePlaySoundOnChannel tSoundFile3, "current", "next"
> 
> All the sound files work fine and the LiveCode Dictionary gives me no other
> clue.
> 
> What am I doing wrong?
> 
> greetings,
> 
> William
> _______________________________________________
> 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

--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com




More information about the use-livecode mailing list