I’m looking at the ZIL code that handles the audio in The Lurking Horror, trying to work out how it handles the looping sounds.
The interpreters that currently support sound effects in The Lurking Horror, Frotz and Bocfel, both have a hard-coded list in the source of the sound effects that should loop. But looking at the code, it seems that the special handling of the looping effects (S-DRONE, S-ATTACK, S-PSYCHO, S-MONSTR, S-VOICE, S-ZOMBIE, S-CRETIN) is in the game code rather than built into the interpreter or the sound files themselves.
All sound effects are listed here.
Does anyone understand what <PUT ,SOUND-FLAG 0 <+ <* .N 16> .VOL>>
and <PUT ,SOUND-FLAG 1 <+ <* .N 16> .VOL>>
actually do here?
"SOUND sound-id,[action],[volume]"
<ROUTINE SOUNDS (N "OPT" (OP ,S-START) (VOL 8))
<COND (<ZERO? .OP> <SET OP ,S-START>)>
<COND (<AND <L? <GET ,SOUND-FLAG 0> 0>
<EQUAL? .OP ,S-START>>
<PUT ,SOUND-FLAG 0 1>
<TELL CR
"[Use $SOUND to toggle sound usage on and off.]" CR CR>)>
<COND (<EQUAL? .N ,S-DRONE ,S-ATTACK ,S-PSYCHO ,S-MONSTR
,S-VOICE ,S-ZOMBIE ,S-CRETIN>
<PUT ,SOUND-FLAG 1 <+ <* .N 16> .VOL>>)>
<COND (<GET ,SOUND-FLAG 0>
<COND (<EQUAL? .OP ,S-STOP>
<PUT ,SOUND-FLAG 0 1>
<PUT ,SOUND-FLAG 1 0>)
(<EQUAL? .N ,S-DRONE ,S-ATTACK ,S-PSYCHO ,S-MONSTR
,S-VOICE ,S-ZOMBIE ,S-CRETIN>
<PUT ,SOUND-FLAG 0 <+ <* .N 16> .VOL>>
<PUT ,SOUND-FLAG 1 <+ <* .N 16> .VOL>>)
(ELSE
<PUT ,SOUND-FLAG 0 1>
<PUT ,SOUND-FLAG 1 0>)>
<COND (<EQUAL? .OP ,S-START>
<SOUND .N .OP .VOL>)
(ELSE
<SOUND .N .OP>)>)>>