Skip to content

Instantly share code, notes, and snippets.

@angstsmurf
Created December 31, 2018 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angstsmurf/780ba80d91f9e13ec81c4de5c239d131 to your computer and use it in GitHub Desktop.
Save angstsmurf/780ba80d91f9e13ec81c4de5c239d131 to your computer and use it in GitHub Desktop.
Inform 7 sound notification example code
"Sounds after each other" by Phosphate
Include version 10/160919 of Glulx Entry Points by Emily Short.
Use direct event handling.
The Sound Stage is a room. "You can hear two songs alternating in the background."
Sound 1 is the file "song1.ogg".
Sound 2 is the file "song2.ogg".
When play begins:
unless glk sound notification is supported:
say "This interpreter does not support sound notifications! Song alternation won't work!";
play Sound 1 with notification.
To play (SFX - sound name) with notification:
(- glk_schannel_play_ext(gg_foregroundchan, ResourceIDsOfSounds-->{SFX},1,1); -).
Glulx input handling rule for a sound-notify-event:
let sound id be glk event value 1;
if sound id is the Glulx resource ID of Sound 1:
play Sound 2 with notification;
otherwise:
play Sound 1 with notification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment