"next"

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Natalie
Posts: 7
Joined: Sat Apr 28, 2012 12:07 am

"next"

Post by Natalie » Mon Apr 30, 2012 6:37 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: "next"

Post by Mark » Mon Apr 30, 2012 8:27 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Natalie
Posts: 7
Joined: Sat Apr 28, 2012 12:07 am

Re: "next"

Post by Natalie » Tue May 01, 2012 1:18 am

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: "next"

Post by Mark » Tue May 01, 2012 1:57 am

Hi Natalie,

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

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply