Hi Team and everyone,
I am getting frustrated with such a tiny thing!
I am sure you will be able to solve this for me.
I am playing a series of notes in a repeat loop.
But I want to allow the user to stop the music if so desired.
The scripts I have been trying are these...
repeat while x< y
put line x of tmusic into tAudio
if the environment is mobile then
play (specialFolderPath ("cache") & "/theContent/" & tAudio)
else
set the defaultFolder to specialFolderPath("desktop")
play audioClip ("sounds/" & tAudio)
end if
wait 1 seconds
add 1 to x
end repeat
or
repeat while x< y
put line x of tmusic into tAudio
if the environment is mobile then
put (specialFolderPath ("cache") & "/theContent/" & tAudio) into tPath
put "queued" into tChannelName
put "next" into tType
mobilePlaySoundOnChannel tPath, tChannelName, tType
else
set the defaultFolder to specialFolderPath("desktop")
play audioClip ("sounds/" & tAudio)
end if
wait 1 seconds
add 1 to x
end repeat
I can get "the mouseClick" to be recognised on the mac, but not on the iPhone.
How can I interrupt the repeat?
All the best,
Jessamy
Stopping a list of musical notes
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Stopping a list of musical notes
You could try:
Code: Select all
on mouseUp
put ... into tAudio
if the label of me is "Play" then
set label of me to "Stop"
if the environment is "mobile" then
play (specialFolderPath ("cache") & "/theContent/" & tAudio)
else
set the defaultFolder to specialFolderPath("desktop")
play audioClip ("sounds/" & tAudio)
end if
else
set label of me to "Play"
play stop
end if
end mouseUp
Last edited by [-hh] on Thu Jul 11, 2019 9:44 am, edited 1 time in total.
shiftLock happens
Re: Stopping a list of musical notes
Also in a repeat loop, a wait statement will be blocking.
Try :
which should allow o/s housekeeping processes to deal with messages like button presses and so on.
Try :
Code: Select all
wait 1 seconds with messages
Re: Stopping a list of musical notes
Thankyou both very much!
I actually used the second idea and it works perfectly!
Much appreciated.
All the best,
Jessamy
I actually used the second idea and it works perfectly!
Much appreciated.
All the best,
Jessamy