diff options
author | Paul Gilbert | 2019-05-05 18:31:20 +1000 |
---|---|---|
committer | Paul Gilbert | 2019-05-07 15:02:00 +1000 |
commit | 193b7683d835fba7806119095fc9245cb0e365c4 (patch) | |
tree | 35e3cde1117a23dc7f25c37bdc3215bd31422c3a /engines/glk/magnetic | |
parent | 7c536e1026971bc83048582ea137f290e5328747 (diff) | |
download | scummvm-rg350-193b7683d835fba7806119095fc9245cb0e365c4.tar.gz scummvm-rg350-193b7683d835fba7806119095fc9245cb0e365c4.tar.bz2 scummvm-rg350-193b7683d835fba7806119095fc9245cb0e365c4.zip |
GLK: MAGNETIC: Sound initialization
Diffstat (limited to 'engines/glk/magnetic')
-rw-r--r-- | engines/glk/magnetic/magnetic.h | 10 | ||||
-rw-r--r-- | engines/glk/magnetic/sound.cpp | 52 |
2 files changed, 58 insertions, 4 deletions
diff --git a/engines/glk/magnetic/magnetic.h b/engines/glk/magnetic/magnetic.h index ebebbc1b24..27bdda0c9c 100644 --- a/engines/glk/magnetic/magnetic.h +++ b/engines/glk/magnetic/magnetic.h @@ -106,6 +106,11 @@ private: bool ms_is_running() const { return running; } /** + * Returns true if running a Magnetic Windows game + */ + bool ms_is_magwin() const { return version == 4; } + + /** * Frees all allocated ressources */ void ms_freemem(); @@ -141,10 +146,7 @@ private: * @{ */ - - void init_snd(uint param) { - // TODO - } + byte init_snd(size_t size); /**@}*/ public: diff --git a/engines/glk/magnetic/sound.cpp b/engines/glk/magnetic/sound.cpp new file mode 100644 index 0000000000..7977920536 --- /dev/null +++ b/engines/glk/magnetic/sound.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "glk/magnetic/magnetic.h" + +namespace Glk { +namespace Magnetic { + +byte Magnetic::init_snd(size_t size) { + if (!(snd_buf = new byte[MAX_MUSIC_SIZE])) { + return 1; + } + + snd_hsize = _sndFile.readUint16LE(); + if (!(snd_hdr = new byte[snd_hsize])) { + delete[] snd_buf; + snd_buf = nullptr; + return 1; + } + + if (_sndFile.read(snd_hdr, snd_hsize) != snd_hsize) { + delete[] snd_buf; + delete[] snd_hdr; + snd_buf = nullptr; + snd_hdr = nullptr; + return 1; + } + + return 2; +} + +} // End of namespace Magnetic +} // End of namespace Glk |