As long as weāre on the topic of soundā¦
Zen Speaks! was brought up in a related thread as a non-Infocom game that uses sound. I decided to try it with Bocfel/Gargoyle, and as soon as you command the door to open, it hangs the interpreter.
The code is effectively doing this:
Global sound_finished = 0;
[SoundRoutine;
sound_finished = 1;
];
[Main;
@sound_effect 13 2 $01ff SoundRoutine;
while (~~sound_finished) {
}
];
The problem in Bocfel is that it uses Glk, and the āend of soundā event is only delivered whenever events are explicitly requested, which, in general, is whenever there is input. During that while loop, thereās no input, so no events are handled, so even though the sound effect stops, the routineās never called, and the loop never ends.
I played around with calling glk_select_poll()
periodically but itās so incredibly heavyweight, relatively speaking, that itās just not feasible; and Iād really prefer not to jam things up with code like āif a sound routine is expected and there have been at least 10000 instructions, call glk_select_poll(), otherwise reset the instruction counterā.
This code is sort of obliquely a violation of the standard, anyway:
The intention is that this routine may implement effects such as fading in and out, by replaying the sound effect at a different volume. (A game should not place any important code in such a routine.)
I could argue that even something as simple as this routine is āimportantā since itās required in order to move the game forward.
As such, if the standard does ever get around to being cleaned up, Iād recommend stating that interpreters should provide a best effort to ensure the routine is called, but thereās no guarantee it ever will be; perhaps with a remark that itās possible the routine wonāt be called until the next input instruction. Maybe thatās too specific to my particular interpreter, but itās not unlikely that itād affect other Glk-based interpreters that support sound: Nitfol, for example, appears to have the same behavior.