Page 1 of 1

"next"

Posted: Mon Apr 30, 2012 6:37 pm
by Natalie
Hello,
I want to play 4 sounds right after one another. I have this code:
put (specialFolderPath("engine")) into tPath
put "/1-ivy.wav" into tfile
play audioClip tPath & tFile
wait until the sound is done

put tPath & "/2-ivy.wav" into tFile
mobilePlaySoundOnChannel tFile, "two", "now"

put tPath & "/3-ivy.wav" into tFile
mobilePlaySoundOnChannel tFile, "two", "next"

put tPath & "/4-ivy.wav" into tFile
mobilePlaySoundOnChannel tFile, "two", "next"

I expect to hear "1-2-3-4", but I hear "1-2-4". Could you please tell me why?

Thanks, Natalie

Re: "next"

Posted: Mon Apr 30, 2012 8:27 pm
by Mark
Hi Natalie,

Does 3-ivy.wav play on iOS at all? Are you sure there isn't a problem with the file format? For example, compressed WAV files may not play in LiveCode.

You could try this:

Code: Select all

local lCounter
on playSounds
  if lCounter is empty or lCounter > 4 then put 1 into lCounter
  put lCounter & "-ivy.wav" into myFile
  mobilePlaySoundOnChannel myFile,"twox","now"
  add 1 to lCounter
end playSounds

on soundFinishedOnChannel
  playSounds
end soundFinishedOnChannel
This script will continue to play the sounds forever. You could add a line that exits without playing another sound if lCounter = 4 or you could not call the playSounds handler again when the hilite of a checkbox is true for instance. I use twox instead of two because I don't know whether problems can arise if numbers are used as sound channel names.

Kind regards,

Mark

Re: "next"

Posted: Tue May 01, 2012 1:18 am
by Natalie
Thanks, Mark. The sound 3-ivy.wav is a good file. It plays fine, when I'm not using "next".

I implemented your code, and it works. But your solution doesn't really address how to use the "next" parameter properly. Is this a bug? Am I using the call improperly? According to the Dictionary, this is supped to work.

=Natalie

Re: "next"

Posted: Tue May 01, 2012 1:57 am
by Mark
Hi Natalie,

It might be a bug. I don't know. You could file a bug report and find out.

Kind regards,

Mark