aboutsummaryrefslogtreecommitdiff
path: root/sword1/sound.h
diff options
context:
space:
mode:
authorRobert Göffringmann2003-12-16 02:10:15 +0000
committerRobert Göffringmann2003-12-16 02:10:15 +0000
commit189e08bc7985fc5664e7ab95195bbade07488f48 (patch)
treef12049da0a8e600bcdd425e4c314c50b5c9922f7 /sword1/sound.h
parentc3a9b2df6789055325b7fea6dd591cea1d419682 (diff)
downloadscummvm-rg350-189e08bc7985fc5664e7ab95195bbade07488f48.tar.gz
scummvm-rg350-189e08bc7985fc5664e7ab95195bbade07488f48.tar.bz2
scummvm-rg350-189e08bc7985fc5664e7ab95195bbade07488f48.zip
Broken Sword 1: initial import
svn-id: r11664
Diffstat (limited to 'sword1/sound.h')
-rw-r--r--sword1/sound.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/sword1/sound.h b/sword1/sound.h
new file mode 100644
index 0000000000..4d17863021
--- /dev/null
+++ b/sword1/sound.h
@@ -0,0 +1,99 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
+#ifndef BSSOUND_H
+#define BSSOUND_H
+
+#include "object.h"
+#include "sworddefs.h"
+#include "common/file.h"
+#include "sound/mixer.h"
+#include "common/util.h"
+
+#define TOTAL_FX_PER_ROOM 7 // total loop & random fx per room (see fx_list.c)
+#define MAX_ROOMS_PER_FX 7 // max no. of rooms in the fx's room,vol list
+#define MAX_FXQ_LENGTH 32 // max length of sound queue - ie. max number of fx that can be stored up/playing together
+
+#define FX_SPOT 1
+#define FX_LOOP 2
+#define FX_RANDOM 3
+
+struct QueueElement {
+ uint32 id, delay;
+ PlayingSoundHandle handle;
+ uint16 *data; // FIXME: This is a hack, because our mixer only supports Big endian data (currently)
+};
+
+struct RoomVol {
+ int32 roomNo, leftVol, rightVol;
+};
+
+struct FxDef {
+ uint32 sampleId, type, delay;
+ RoomVol roomVolList[MAX_ROOMS_PER_FX];
+};
+
+class SoundMixer;
+class ResMan;
+
+class SwordSound {
+public:
+ SwordSound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan);
+ ~SwordSound(void);
+ void startFxForScreen(uint16 screen);
+
+ bool startSpeech(uint16 roomNo, uint16 localNo); // this should work more or less.
+ // Maybe we'll need a delay of 3 gameCycles.
+ bool speechFinished(void);
+ void stopSpeech();
+ bool amISpeaking(void); // this is supposed to return if the sounddata is near the ending or very silent...
+
+ void fnStopFx(int32 fxNo);
+ void clearAllFx(void);
+ int addToQueue(int32 fxNo);
+ //void removeFromQueue(int32 fxNo);
+ // ^= part of fnPlayFx
+
+ void engine(void);
+
+private:
+ void playSample(QueueElement elem);
+ void initCowSystem(void);
+ void closeCowSysten(void);
+ uint32 uncompressedSize(uint8 *data);
+ uint32 expandSpeech(void *src, void *dest, uint32 srcSize);
+ File _cowFile;
+ uint32 *_cowHeader;
+ uint32 _cowHeaderSize;
+ PlayingSoundHandle _speechHandle, _fxHandle;
+ Common::RandomSource _rnd;
+
+ QueueElement _fxQueue[MAX_FXQ_LENGTH];
+ uint8 _endOfQueue;
+ SoundMixer *_mixer;
+ ResMan *_resMan;
+ char _filePath[100];
+ static const char _musicList[270];
+ static const uint16 _roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM];
+ static const FxDef _fxList[312];
+};
+
+#endif //BSSOUND_H