I am writing a game using Inform 6 that is compiled for a Glulx interpreter. It has graphics and sound. This is the first time I’ve written a game with sound, so I’m a bit uncertain about some things. It currently has two channels, one for theme music played at the beginning and end (though I may add some more, depending on the client) and one channel for sound effects (only one at this stage, but, once again, I may add some more).
It has SOUND ON and SOUND OFF commands to (surprise, surprise) turn sounds on and off. The approach I’ve taken here is that SOUND OFF uses glk_schannel_pause() for the background channel and glk_schannel_stop() for the foreground channel. SOUND ON uses glk_schannel_unpause() for the background channel and nothing for the foreground channel.
Everything works like a charm using Glulxe on Windows, but I’m worried that this approach may not work on other interpreters. I understand, from what I’ve read on the forum, that pause and unpause are only available from a certain version of Glk onwards (1.7.3 if I recall correctly). I also believe that I can use glk_gestalt(gestalt_Sound,0) and glk_gestalt(gestalt_Sound2,0) to distinguish between versions.
My questions are:
- Are there any good tutorials around that describe best practice for implementing two-channel sound?
- How do I implement SOUND ON/OFF if pause/unpause is not available on the interpreter?
Thanks in advance for any help you can provide.