mobileplaysoundonchannel - sequential sounds

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

mobileplaysoundonchannel - sequential sounds

Post by scotttyang » Sat Jun 02, 2012 6:32 pm

As always, new to the mobile sound concept.... I have been using the typical..

play "sound1.aif"
wait until the sound is done
play "sound2.aif"

but I need to be able to play sequential sounds without the wait command, as the wait pauses the script and everything in the app stops waiting for the sound to play. But I noted that mobileplaysoundonchannel can queue up with the "next", but somehow, all the sounds seems to play together at once as noted in the bottom script for 3 sounds to play sequentially when the prior sound is done.

mobilePlaySoundOnChannel specialFolderPath("engine") & "/data/words/"&"sound1.aif","tsounds","next"
mobilePlaySoundOnChannel specialFolderPath("engine") & "/data/words/"&"sound2.aif","tsounds","next"
mobilePlaySoundOnChannel specialFolderPath("engine") & "/data/words/"&"sound3.aif","tsounds","next"

For example if a child click on a series of pictorial words, the playback button will play back the string of words into a sentence without pauses or waits, but sequentially.

Any ideas will be helpful. this mobile sound channel is new to me

DirkArnold
Posts: 15
Joined: Sat May 14, 2011 11:35 pm
Location: Sunny Tucson, AZ

Re: mobileplaysoundonchannel - sequential sounds

Post by DirkArnold » Sat Sep 24, 2016 6:46 am

Four years later... I was looking for some guidance on sequential sounds myself, and ran across your question. I figure I'm not the only one, so I will report my findings:

To play the sounds in sequence with mobilePlaySoundOnChannel, put "now" in the first line of your script sample, and "next" in the others. I'm only concatenating two sounds but that worked for me.

My problem is the wait. There doesn't appear to be a mobile equivalent of "wait until the sound is done" but we do have soundFinishedOnChannel. I expected it to fire each time a sound finishes on the channel, but in my case it appears to only be triggered when the first sound finishes. I'm trying to disable a next button until both of my sequential sounds finish, and it's giving me fits.

If anyone has any suggestions about how to capture the end of a sound sequence, I'd love to hear them.

ALSO: For anyone who wanders onto this topic unfamiliar with the mobileXXX commands, here are some tips I've not seen elsewhere:
-- The IDE does not color code the mobile commands.
-- You need to wrap them in an if the environment is "mobile" statement, otherwise the IDE will say it can't find the handlers.
-- To really test the mobile commands, you should generate a mobile standalone. The iOS simulator, at least, is more forgiving than the real thing.

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Re: mobileplaysoundonchannel - sequential sounds

Post by yeldarb » Tue Jan 30, 2018 6:35 pm

DirkArnold wrote:
Sat Sep 24, 2016 6:46 am
To play the sounds in sequence with mobilePlaySoundOnChannel, put "now" in the first line of your script sample, and "next" in the others. I'm only concatenating two sounds but that worked for me.
I'm making a clock app and want to have the hours chime. I've gotten the "next" attribute to work on the first sound immediately following the "now" sound, but no more. So I can only get two sounds to play at a time. I guess I'll have to mess with the soundFinishedOnChannel and see if I can link the sounds that way. Anyone have any ideas I'd love to hear them.

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Re: mobileplaysoundonchannel - sequential sounds

Post by yeldarb » Wed Jan 31, 2018 7:55 pm

As I mentioned above, the "next" param only allowed me to append one sound to a "playlist." However, I was able to use the soundFinishedOnChannel command to create a sequence of sounds.

williamdesmet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 66
Joined: Tue Jun 26, 2012 7:07 pm

Re: mobileplaysoundonchannel - sequential sounds

Post by williamdesmet » Thu Mar 22, 2018 6:42 pm

@yeldarb
Can you put your code here please?
I can't get it to work with soundFinishedOnChannel to create a sequence of sounds.

greetings,

William

Post Reply

Return to “iOS Deployment”