aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-09 19:03:05 -0400
committerPaul Gilbert2016-08-09 19:03:05 -0400
commit30936a6115160e8e79b3c768c2ee97aae9cbd554 (patch)
tree58c0b3a9062078e835d6ccf20f0c239b3e719b1d /engines/titanic
parent0f1fd5c9553fa0db01ceb12f7d315cead6ab2a64 (diff)
downloadscummvm-rg350-30936a6115160e8e79b3c768c2ee97aae9cbd554.tar.gz
scummvm-rg350-30936a6115160e8e79b3c768c2ee97aae9cbd554.tar.bz2
scummvm-rg350-30936a6115160e8e79b3c768c2ee97aae9cbd554.zip
TITANIC: Finish CMusicPlayer class
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp2
-rw-r--r--engines/titanic/core/game_object.h2
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/sound/music_handler.cpp5
-rw-r--r--engines/titanic/sound/music_handler.h10
-rw-r--r--engines/titanic/sound/music_player.cpp30
-rw-r--r--engines/titanic/sound/music_wave.cpp36
-rw-r--r--engines/titanic/sound/music_wave.h43
-rw-r--r--engines/titanic/sound/sound_manager.cpp2
9 files changed, 127 insertions, 4 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 95ebe6a1e7..e0a4903f75 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -487,7 +487,7 @@ void CGameObject::playGlobalSound(const CString &resName, int mode, bool initial
sound.setVolume(_soundHandles[handleIndex], newVolume, 2);
}
-void CGameObject::setSoundVolume(uint handle, uint percent, uint seconds) {
+void CGameObject::setSoundVolume(int handle, uint percent, uint seconds) {
if (handle != 0 && handle != -1) {
CGameManager *gameManager = getGameManager();
if (gameManager)
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 322b62636c..19eb296965 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -220,7 +220,7 @@ protected:
* @param volume Volume percentage (0 to 100)
* @param seconds Number of seconds to transition to the new volume
*/
- void setSoundVolume(uint handle, uint percent, uint seconds);
+ void setSoundVolume(int handle, uint percent, uint seconds);
/**
* Plays a sound, and saves it's handle in the global sound handles list
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index ba46c4b57c..5c041174a2 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -402,6 +402,7 @@ MODULE_OBJS := \
sound/music_handler.o \
sound/music_room.o \
sound/music_player.o \
+ sound/music_wave.o \
sound/node_auto_sound_player.o \
sound/proximity.o \
sound/qmixer.o \
diff --git a/engines/titanic/sound/music_handler.cpp b/engines/titanic/sound/music_handler.cpp
index 32277ef031..41545347b8 100644
--- a/engines/titanic/sound/music_handler.cpp
+++ b/engines/titanic/sound/music_handler.cpp
@@ -32,6 +32,11 @@ CMusicHandler::CMusicHandler(CProjectItem *project, CSoundManager *soundManager)
}
+CMusicWave *CMusicHandler::createMusicWave(int v1, int v2) {
+ // TODO
+ return nullptr;
+}
+
bool CMusicHandler::isBusy() {
// TODO
return false;
diff --git a/engines/titanic/sound/music_handler.h b/engines/titanic/sound/music_handler.h
index 99dcbe8619..cab2ef8074 100644
--- a/engines/titanic/sound/music_handler.h
+++ b/engines/titanic/sound/music_handler.h
@@ -23,6 +23,8 @@
#ifndef TITANIC_MUSIC_HANDLER_H
#define TITANIC_MUSIC_HANDLER_H
+#include "titanic/sound/music_wave.h"
+
namespace Titanic {
class CProjectItem;
@@ -36,6 +38,14 @@ private:
public:
CMusicHandler(CProjectItem *project, CSoundManager *soundManager);
+ /**
+ * Creates a new music wave class instance, and assigns it to a slot
+ * in the music handler
+ * @param waveIndex Slot to save new instance in
+ * @param count Number of files the new instance will contain
+ */
+ CMusicWave *createMusicWave(int waveIndex, int count);
+
bool isBusy();
void set124(int val) { _field124 = val; }
diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp
index 86ec0dbb22..fb5a596875 100644
--- a/engines/titanic/sound/music_player.cpp
+++ b/engines/titanic/sound/music_player.cpp
@@ -125,8 +125,36 @@ bool CMusicPlayer::CreateMusicPlayerMsg(CCreateMusicPlayerMsg *msg) {
}
CMusicHandler *musicHandler = getMusicRoom()->createMusicHandler();
+ CMusicWave *wave;
+
if (musicHandler) {
- // TODO
+ wave = musicHandler->createMusicWave(0, 3);
+ wave->load(0, "z#490.wav", 60);
+ wave->load(1, "z#488.wav", 62);
+ wave->load(2, "z#489.wav", 63);
+
+ wave = musicHandler->createMusicWave(1, 5);
+ wave->load(0, "z#493.wav", 22);
+ wave->load(1, "z#495.wav", 29);
+ wave->load(2, "z#492.wav", 34);
+ wave->load(3, "z#494.wav", 41);
+ wave->load(4, "z#491.wav", 46);
+
+ wave = musicHandler->createMusicWave(2, 5);
+ wave->load(0, "z#499.wav", 26);
+ wave->load(1, "z#497.wav", 34);
+ wave->load(2, "z#498.wav", 38);
+ wave->load(3, "z#496.wav", 46);
+ wave->load(4, "z#500.wav", 60);
+
+ wave = musicHandler->createMusicWave(3, 7);
+ wave->load(0, "z#504.wav", 22);
+ wave->load(1, "z#507.wav", 29);
+ wave->load(2, "z#503.wav", 34);
+ wave->load(3, "z#506.wav", 41);
+ wave->load(4, "z#502.wav", 46);
+ wave->load(5, "z#505.wav", 53);
+ wave->load(6, "z#501.wav", 58);
CMusicRoom::_musicHandler->set124(_fieldCC);
}
diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
new file mode 100644
index 0000000000..348f3bdbd4
--- /dev/null
+++ b/engines/titanic/sound/music_wave.cpp
@@ -0,0 +1,36 @@
+/* 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 "titanic/sound/music_wave.h"
+#include "titanic/sound/sound_manager.h"
+#include "titanic/core/project_item.h"
+
+namespace Titanic {
+
+CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, int index) {
+}
+
+void CMusicWave::load(int index, const CString &filename, int v3) {
+ // TODO
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/sound/music_wave.h b/engines/titanic/sound/music_wave.h
new file mode 100644
index 0000000000..d40b2ce74d
--- /dev/null
+++ b/engines/titanic/sound/music_wave.h
@@ -0,0 +1,43 @@
+/* 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.
+ *
+ */
+
+#ifndef TITANIC_MUSIC_WAVE_H
+#define TITANIC_MUSIC_WAVE_H
+
+#include "titanic/support/string.h"
+
+namespace Titanic {
+
+class CProjectItem;
+class CSoundManager;
+
+class CMusicWave {
+private:
+public:
+ CMusicWave(CProjectItem *project, CSoundManager *soundManager, int index);
+
+ void load(int index, const CString &filename, int v3);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_MUSIC_WAVE_H */
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index 7a188524ad..7f0834ccb1 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -443,7 +443,7 @@ void QSoundManager::updateVolume(int channel, uint panRate) {
}
void QSoundManager::updateVolumes() {
- for (int idx = 0; idx < CHANNELS_COUNT; ++idx)
+ for (uint idx = 0; idx < CHANNELS_COUNT; ++idx)
updateVolume(idx, 250);
}