Delaying sound effects?


I’m currently using the “Music” extension from Daniel Stelzer. I was wondering if there is any way to have a delay on sound, either with that extension, Informs own code or another extension? And if this delay can be used for the first time a sound is played (want to loop sound, however it needs to play around 2 seconds after the action is taken. I don’t want the sound to be delayed every time though, as it’s only 22 seconds long (as it’s a soundtrack) )

The best way I can think of with existing extensions, is to use Glulx Entry Points and set a timer. Not optimal. I’ll see about adding something to the Music extension when I have a chance.

Easiest solution - I would record another version of the sound with a 2-second delay built in and call the appropriate version as needed.

Draconis - while you’re at it with Music, another request if you ever have time: one functionality I would have liked in the extension is to be able to define a queue of sound effects that could play in sequence and stop or loop. Or possibly a “shuffled playlist” of sound effects. Perhaps one of the elements of a playlist could be a “pause for 10 seconds” type function?

Using glk timers is not ideal because you only get one, and other extensions might be using it already. An alternative would be to make a 0.1 second blank sound file, and then use glk_schannel_play_ext to repeat it for the required length, and then use the sound notification event to play the actual sound.

But if the delay is going to be constant then including it in the sound file itself is definitely the simplest option!

A queue of sound effects would be wonderful, and if I wrote the extension properly you would totally be able to do that. As it is I kind of hacked it together for one specific purpose and didn’t think to include that. But if I ever rewrite it that’s first on the list.