Twine 2, Sugarcube 2.31.1
Hey awesome people.
So I’m trying to figure out the best way to fade out sounds from previous passages and start playing the sounds in a new passage. Currently, I have this code which works fine for individual audio tracks.
:: PassageReady
<<if def $music>>
/*remember what WAS just playing */
<<set _oldmusic to $music>>
/*fade out and then stop what WAS playing */
<<audio _oldmusic fadeoverto 2 0>>
<<timed 2s>>
<<audio _oldmusic stop>>
<</timed>>
<</if>>
:: passage 1
<<set $music to "test1">>
<<audio $music volume 1 play>>
:: passage 2
<<set $music to "test2">>
<<audio $music volume 1 play>>
Is there a way to make this kind of thing work with playlists too?
I essentially need a way to say “everything that IS playing fade out, THEN stop” and meanwhile start playing the new passages track. I tried using
<<audio ":playing:not($music)" stop>>
but couldn’t get that to work.
Any ideas?