Referring to #999, if there is a hat block that detects when a sound reaches a time, I think there should also be a corresponding block: play [sound v] from (time). To complement it, another block would be useful: stop [sound v].
Both of these sounds are pretty self-explanatory - play [sound v] from (time) would play the desired sound from a certain time (maybe in seconds?) and stop [sound v] would stop just that one sound.
On a slightly unrelated note, I'm glad that so many new audio blocks are being added!
What happens if you do
play sound 1
play sound 1
play sound 1
stop sound 1
?
Does it stop all of them?
Stopping all of them seems the most intuitive result, and I can't think of any logical alternatives for what it could do otherwise
Sprites can only play a single instance of a particular sound (successive calls to "play sound" restart the sound), so a "stop [sound v]" block would work fine.
I should clarify that #999 etc. are just proposals we're thinking about, and we'll hopefully prototype them at some point, but no guarantees. We're very careful about adding new blocks. That said we appreciate the thoughtful ideas!
Okay, but a decision would still need to be reached on when multiple sprites are playing the same sound
@chooper100 But that's not possible? Sounds are local to sprites/stages. Each sprite has its own array of sound objects, and its own "sound manager" (e.g. deleting a clone kills only the sounds it started via a "play sound"-like block; each sprites has its own volume value; etc).
If you want to stop a sound in another sprite, a broadcast could be used:
broadcast [stop music]
when I receive [stop music]
repeat (10)
change volume by (-10)
end
stop sound (music)
set volume to (100%)
Fair point
An example of how this could be used (for pausing music):
when gf clicked
set [time v] to [0]
broadcast [start music v]
when I receive [start music v]
reset timer
play sound [music v] from (time)
when I receive [pause music v]
set [time v] to (timer)
stop sound [music v]
Then you would broadcast "pause music" to pause and "start music" to start again.
Another little tidbit - since the "play sound" block was renamed to "start sound", it makes even more sense to have a corresponding "stop sound" block! :)
Most helpful comment
An example of how this could be used (for pausing music):
Then you would broadcast "pause music" to pause and "start music" to start again.