RAPID SEQUENCE of audioclips on a Mac
Geoff Canyon
gcanyon at inspiredlogic.com
Mon Jan 7 16:12:00 EST 2002
At 1:45 PM -0600 1/7/02, J. Scott Saults wrote:
>In Revolutions on the my Mac, at least, the results of a simple series of 'play' and 'wait' commands, like the following, are FAR too slow and erratic. (Of course, without the waits, the successive play commands simply interrupt each other, because Revolution cannot, to my knowledge, cue the sounds.)
>
>## soundList is just a list of names of the audioclips
>put 250 into onsetToOnset
>Repeat with i = 1 to 5
> put milliseconds() into onsetTime
> play line i of soundList
> wait until milliseconds() - onsetTime > onsetToOnset
>end repeat
>
>Neither getting the milliseconds after the 'play' command, nor using 'wait until the sound is "done"' works any better in my tests.
>
>Does anyone have any suggestions for how to accomplish this better?
>
>Many thanks in advance for any new ideas.
Two possibilities:
Check out the playStopped message. You would do something like this:
global gWhichSoundNext,gMySoundArray,gNumberOfSounds
on mouseUp
put 1 into gWhichSoundNext
play gMySoundArray[1]
end mouseUp
on playStopped
if gWhichSoundNext < gNumberOfSounds then
add 1 to gWhichSoundNext
play gMySoundArray[gWhichSoundNext]
end if
end playStopped
-----------------------------------------
Check out the send to...in command. you would do something like this:
global gMySoundArray, gNumberOfSounds, gPlaySoundMessage
on mouseUp
MySoundPlay 1
end mouseUp
on MySoundPlay pWhichSound
play gMySoundArray[pWhichSound]
if pWhichSound < gNumberOfSounds then
send ("MySoundPlay" && (pWhichSound + 1)) to me in 250 milliseconds
put the result into gPlaySoundMessage
end if
end playStopped
--------------------------------------------
regards,
Geoff
More information about the use-livecode
mailing list