aboutsummaryrefslogtreecommitdiff
path: root/engines/dm/sounds.h
diff options
context:
space:
mode:
authorBendegúz Nagy2016-08-16 19:15:35 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit0eb61d0a7d1450ca79adfe8ef4bd3874de51ce67 (patch)
tree9aff26bfd1a12daa4efa4148f088fe5989d2ce9c /engines/dm/sounds.h
parent7cc41a1929c1609cb952517a60bd222cc62d690d (diff)
downloadscummvm-rg350-0eb61d0a7d1450ca79adfe8ef4bd3874de51ce67.tar.gz
scummvm-rg350-0eb61d0a7d1450ca79adfe8ef4bd3874de51ce67.tar.bz2
scummvm-rg350-0eb61d0a7d1450ca79adfe8ef4bd3874de51ce67.zip
DM: Pull sound handling into a separate class
Diffstat (limited to 'engines/dm/sounds.h')
-rw-r--r--engines/dm/sounds.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/engines/dm/sounds.h b/engines/dm/sounds.h
new file mode 100644
index 0000000000..b3add4a423
--- /dev/null
+++ b/engines/dm/sounds.h
@@ -0,0 +1,80 @@
+/* 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.
+*
+*/
+
+/*
+* Based on the Reverse Engineering work of Christophe Fontanel,
+* maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/)
+*/
+
+#include "dm.h"
+
+namespace DM {
+
+#define k34_D13_soundCount 34 // @ D13_SOUND_COUNT
+
+class SoundData {
+public:
+ uint32 _byteCount;
+ byte* _firstSample;
+ uint32 _sampleCount;
+ SoundData() : _byteCount(0), _firstSample(nullptr), _sampleCount(0) {}
+}; // @ SOUND_DATA
+
+class Sound {
+public:
+ int16 _graphicIndex;
+ byte _period;
+ byte _priority;
+ byte _loudDistance;
+ byte _softDistance;
+ Sound(int16 index, byte period, byte priority, byte loudDist, byte softDist) :
+ _graphicIndex(index), _period(period), _priority(priority), _loudDistance(loudDist), _softDistance(softDist) {}
+}; // @ Sound
+
+class PendingSound {
+public:
+ uint8 _leftVolume;
+ uint8 _rightVolume;
+ int16 _soundIndex;
+ PendingSound(uint8 leftVolume, uint8 rightVolume, int16 soundIndex) :
+ _leftVolume(leftVolume), _rightVolume(rightVolume), _soundIndex(soundIndex) {}
+};
+
+
+class SoundMan {
+ DMEngine *_vm;
+
+public:
+ SoundMan(DMEngine* vm);
+ ~SoundMan();
+
+ SoundData _gK24_soundData[k34_D13_soundCount]; // @ K0024_as_SoundData
+ Common::Queue<PendingSound> _pendingSounds;
+
+ void f503_loadSounds(); // @ F0503_SOUND_LoadAll
+ void f064_SOUND_RequestPlay_CPSD(uint16 P0088_ui_SoundIndex, int16 P0089_i_MapX, int16 P0090_i_MapY, uint16 P0091_ui_Mode); // @ F0064_SOUND_RequestPlay_CPSD
+ void f060_SOUND_Play(uint16 P0921_ui_SoundIndex, uint16 P0085_i_Period, uint8 leftVol, uint8 rightVol); // @ F0060_SOUND_Play
+ void f65_playPendingSound(); // @ F0065_SOUND_PlayPendingSound_CPSD
+ bool f505_soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 *rightVolume); // @ F0505_SOUND_GetVolume
+};
+
+} \ No newline at end of file