First, I use timedcontinue macro from
http://www.glorioustrainwrecks.com/node/5462 and I want to play a sound every time the pause ends. How to modify the script to make it?
Second, I would like to play a local system sound defined by the user's system setting (like "new mail notification") instead of an audio file from the internet. (That is, the user will hear the sound familiar to him in the "new mail" situation. whatever it is on his computer (if it is mute, let it be), and also will be able to play offline.) Is that possible?
Comments
You don't need to modify the <<timedcontinue>> macro to do what you want, you could just do the following:
re: Playing operating system event sound files.
The web-browser needs to be able to find the sound file you want it to play and I don't know of a way for the web-browser to locate the operating system's sound files. Nor do I know of a way to use Javascript to make the web-browser ask the operating system to trigger the relevant events to play those sounds for you.
But maybe a more experienced Javascript programmer may know of a solution.
I do need to insert sound playing into <<timedcontinue>> because I will need it in dozens of places! I don't want to add <<playsound "tada.mp3">> after each of them manually!
Anyway, I can give up with system sounds. I have more important problems. I tried <<loopsound>>, and it doesn't stop when I leave the passage. How to fix it?
Also, I found a place in timedcontinue script where I can insert a call to playsound macro, but what syntax is needed for that? How to call a macro from javascript?
"name-of-marco": is the name of the macro being called. eg. "playsound"
macro_parameters: an array of parameters to pass to the macro. eg. {"tada.mp3"}
parser: a RegExp object containing the parse of the current element being replaced
macros["playsound"].handler(???, "playsound", "file://C:/WINDOWS/Media/chimes.wav", ???);
Anyway, this works:
macros["playsound"].soundtracks["file://C:/WINDOWS/Media/chimes"].play()
Any ideas how to stop loopsound when leaving the passage? The source code is here: http://www.glorioustrainwrecks.com/files/TwineMacros-SoundMacros-1.1.2.txt