You can’t get sounds to repeat without a little Inform 6 work. However, not much is required, as nearly all of it is already available in the Standard Rules. From the 6E72 Standard Rules, we have
To play (SFX - sound name), one time only
(documented at ph_playsf):
(- PlaySound(ResourceIDsOfSounds-->{SFX}, {phrase options}); -).
PlaySound is defined in the I6 template layer, in “Extensions/Reserved/Figures.i6t”:
[ PlaySound resource_ID one_time;
if (resource_ID == 0) return; ! The "silence" non-sound effect
if ((one_time) && (ResourceUsageFlags->resource_ID)) return;
ResourceUsageFlags->resource_ID = true;
VM_SoundEffect(resource_ID);
];
Finally, VM_SoundEffect is defined in the same layer, in the file “Extensions/Reserved/Glulx.i6t”:
[ VM_SoundEffect resource_ID;
if (glk_gestalt(gestalt_Sound, 0)) {
glk_schannel_play(gg_foregroundchan, resource_ID);
} else {
print "[Sound effect number ", resource_ID, " here.]^";
}
];
That “glk_schannel_play()” call is a Glk call that makes the sound actually play: what we need to do is to create a new action that ends up making a slightly different Glk call to “glk_schannel_play_ext()”, as that call does allow repeats.
Something like the following should work (not tested, but you get the idea):
[code]To loopplay (SFX - sound name):
(- PlaySoundLoop(ResourceIDsOfSounds–>{SFX}); -).
(-
[ PlaySoundLoop resource_ID;
if (resource_ID == 0) return;
ResourceUsageFlags->resource_ID = true;
if (glk_gestalt(gestalt_Sound, 0)) {
glk_schannel_play_ext(gg_foregroundchan, resource_ID, -1, 0);
}
];
-)
[/code]
It’s that “-1” in the “glk_schannel_play_ext()” call that makes the sound repeat.
Incidentally, recent I7 builds introduced the need for that “ResourceIDsOfSounds–>{SFX}” bit of logic to get the resource identifier of sounds and pictures: I suspect that that is why that old code from Eliuk no longer works.