From 1d12eb4c11d2ae89c4b06d86d6af98b5ef02f8fe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 14 Dec 2018 20:37:22 -0800 Subject: GLK: FROTZ: Fix sound looping --- engines/glk/frotz/glk_interface.cpp | 3 +-- engines/glk/sound.cpp | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/glk') diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp index 200adbb9fe..b78a067c89 100644 --- a/engines/glk/frotz/glk_interface.cpp +++ b/engines/glk/frotz/glk_interface.cpp @@ -266,8 +266,7 @@ void GlkInterface::os_start_sample(int number, int volume, int repeats, zword eo default: vol = 0x20000; break; } - // we dont do repeating or eos-callback for now... - glk_schannel_play_ext(gos_channel, number, 1, 0); + glk_schannel_play_ext(gos_channel, number, repeats, eos); glk_schannel_set_volume(gos_channel, vol); } diff --git a/engines/glk/sound.cpp b/engines/glk/sound.cpp index 1012c2040f..7a93b772f9 100644 --- a/engines/glk/sound.cpp +++ b/engines/glk/sound.cpp @@ -100,7 +100,9 @@ uint SoundChannel::play(uint soundNum, uint repeats, uint notify) { if (f.exists(nameSnd) && f.open(nameSnd)) { if (f.readUint16BE() != (f.size() - 2)) error("Invalid sound filesize"); - repeats = f.readByte(); + byte headerRepeats = f.readByte(); + if (headerRepeats > 0) + repeats = headerRepeats; f.skip(1); uint freq = f.readUint16BE(); f.skip(2); -- cgit v1.2.3