From 2fbb8af0bcec84d6653b97edf1699e94660e62fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Jul 2019 21:34:22 -0700 Subject: GLK: ALAN3: Move soundChannel static to GlkIO field --- engines/glk/alan3/glkio.cpp | 15 +++++++-------- engines/glk/alan3/glkio.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/glk/alan3/glkio.cpp b/engines/glk/alan3/glkio.cpp index 61e9f180f1..c88e9fa74b 100644 --- a/engines/glk/alan3/glkio.cpp +++ b/engines/glk/alan3/glkio.cpp @@ -34,7 +34,8 @@ namespace Alan3 { GlkIO *g_io; GlkIO::GlkIO(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), - glkMainWin(nullptr), glkStatusWin(nullptr), onStatusLine(false), _saveSlot(-1) { + glkMainWin(nullptr), glkStatusWin(nullptr), onStatusLine(false), _saveSlot(-1), + _soundChannel(nullptr) { g_io = this; } @@ -92,14 +93,12 @@ void GlkIO::playSound(int sound) { return; #ifdef GLK_MODULE_SOUND - static schanid_t soundChannel = NULL; - if (glk_gestalt(gestalt_Sound, 0) == 1) { - if (soundChannel == NULL) - soundChannel = glk_schannel_create(0); - if (soundChannel != NULL) { - glk_schannel_stop(soundChannel); - (void)glk_schannel_play(soundChannel, sound); + if (_soundChannel == nullptr) + _soundChannel = glk_schannel_create(0); + if (_soundChannel) { + glk_schannel_stop(_soundChannel); + (void)glk_schannel_play(_soundChannel, sound); } } #endif diff --git a/engines/glk/alan3/glkio.h b/engines/glk/alan3/glkio.h index fb342d1569..333a24b055 100644 --- a/engines/glk/alan3/glkio.h +++ b/engines/glk/alan3/glkio.h @@ -34,6 +34,7 @@ class GlkIO : public GlkAPI { private: winid_t glkMainWin; winid_t glkStatusWin; + schanid_t _soundChannel; int _saveSlot; public: bool onStatusLine; -- cgit v1.2.3