mobilePlaySoundOnChannel with more sounds error?

Pierre Sahores sc at sahores-conseil.com
Thu Oct 31 20:07:47 EDT 2013


Hi William,

See the message "soundFinishedOnChannel" in the dictionary and its associated example snippet) . It's automatically send by LC each time a sound finish to play on any opened channel and, can in this way handle what i want it to do on the "firstChannel" channel witch is inited in calling the "soundlevelonoff" command. More clear ?

To start and stop playing the referenced sounds, a simple push button is usable :

> on mouseup
>    soundlevelonoff
>    mobileClearTouches
> end mouse up

Best,

Pierre


Le 31 oct. 2013 à 18:05, William de Smet a écrit :

> Hi Pierre,
> 
> Thanks for your reply.
> I can't get it to work yet.
> You use "firstChannel" as your channel.
> How is this connected with 'on soundFinishedOnChannel tchannel, the sound'
> Is there code missing?
> 
> I am on LC 6.1.2.
> 
> 
> greetings,
> 
> William
> 
> 
> 2013/10/30 Pierre Sahores <sc at sahores-conseil.com>
> 
>> 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

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





More information about the use-livecode mailing list