aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/module.mk2
-rw-r--r--engines/titanic/sound/music_player.cpp56
-rw-r--r--engines/titanic/sound/music_room_handler.cpp38
-rw-r--r--engines/titanic/sound/music_room_handler.h14
-rw-r--r--engines/titanic/sound/music_room_instrument.cpp (renamed from engines/titanic/sound/music_wave.cpp)44
-rw-r--r--engines/titanic/sound/music_room_instrument.h (renamed from engines/titanic/sound/music_wave.h)16
-rw-r--r--engines/titanic/titanic.cpp4
7 files changed, 87 insertions, 87 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 08a65a23b5..6aadf5dc5b 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -412,8 +412,8 @@ MODULE_OBJS := \
sound/music_object.o \
sound/music_room.o \
sound/music_room_handler.o \
+ sound/music_room_instrument.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_player.cpp b/engines/titanic/sound/music_player.cpp
index c05a5196da..fe75382dc3 100644
--- a/engines/titanic/sound/music_player.cpp
+++ b/engines/titanic/sound/music_player.cpp
@@ -127,36 +127,36 @@ bool CMusicPlayer::CreateMusicPlayerMsg(CCreateMusicPlayerMsg *msg) {
}
CMusicRoomHandler *musicHandler = getMusicRoom()->createMusicHandler();
- CMusicWave *wave;
+ CMusicRoomInstrument *ins;
if (musicHandler) {
- wave = musicHandler->createMusicWave(BELLS, 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(SNAKE, 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(PIANO, 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(BASS, 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);
+ ins = musicHandler->createInstrument(BELLS, 3);
+ ins->load(0, "z#490.wav", 60);
+ ins->load(1, "z#488.wav", 62);
+ ins->load(2, "z#489.wav", 63);
+
+ ins = musicHandler->createInstrument(SNAKE, 5);
+ ins->load(0, "z#493.wav", 22);
+ ins->load(1, "z#495.wav", 29);
+ ins->load(2, "z#492.wav", 34);
+ ins->load(3, "z#494.wav", 41);
+ ins->load(4, "z#491.wav", 46);
+
+ ins = musicHandler->createInstrument(PIANO, 5);
+ ins->load(0, "z#499.wav", 26);
+ ins->load(1, "z#497.wav", 34);
+ ins->load(2, "z#498.wav", 38);
+ ins->load(3, "z#496.wav", 46);
+ ins->load(4, "z#500.wav", 60);
+
+ ins = musicHandler->createInstrument(BASS, 7);
+ ins->load(0, "z#504.wav", 22);
+ ins->load(1, "z#507.wav", 29);
+ ins->load(2, "z#503.wav", 34);
+ ins->load(3, "z#506.wav", 41);
+ ins->load(4, "z#502.wav", 46);
+ ins->load(5, "z#505.wav", 53);
+ ins->load(6, "z#501.wav", 58);
CMusicRoom::_musicHandler->setActive(_musicActive);
}
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp
index d464a1d95d..b013bb1e79 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -33,7 +33,7 @@ CMusicRoomHandler::CMusicRoomHandler(CProjectItem *project, CSoundManager *sound
_field108 = 0;
_field118 = 0;
_startTicks = _soundStartTicks = 0;
- Common::fill(&_musicWaves[0], &_musicWaves[4], (CMusicWave *)nullptr);
+ Common::fill(&_instruments[0], &_instruments[4], (CMusicRoomInstrument *)nullptr);
for (int idx = 0; idx < 4; ++idx)
_musicObjs[idx] = new CMusicObject(idx);
Common::fill(&_startPos[0], &_startPos[4], 0);
@@ -51,26 +51,26 @@ CMusicRoomHandler::~CMusicRoomHandler() {
delete _audioBuffer;
}
-CMusicWave *CMusicRoomHandler::createMusicWave(MusicInstrument instrument, int count) {
+CMusicRoomInstrument *CMusicRoomHandler::createInstrument(MusicInstrument instrument, int count) {
switch (instrument) {
case BELLS:
- _musicWaves[BELLS] = new CMusicWave(_project, _soundManager, MV_BELLS);
+ _instruments[BELLS] = new CMusicRoomInstrument(_project, _soundManager, MV_BELLS);
break;
case SNAKE:
- _musicWaves[SNAKE] = new CMusicWave(_project, _soundManager, MV_SNAKE);
+ _instruments[SNAKE] = new CMusicRoomInstrument(_project, _soundManager, MV_SNAKE);
break;
case PIANO:
- _musicWaves[PIANO] = new CMusicWave(_project, _soundManager, MV_PIANO);
+ _instruments[PIANO] = new CMusicRoomInstrument(_project, _soundManager, MV_PIANO);
break;
case BASS:
- _musicWaves[BASS] = new CMusicWave(_project, _soundManager, MV_BASS);
+ _instruments[BASS] = new CMusicRoomInstrument(_project, _soundManager, MV_BASS);
break;
default:
return nullptr;
}
- _musicWaves[instrument]->setFilesCount(count);
- return _musicWaves[instrument];
+ _instruments[instrument]->setFilesCount(count);
+ return _instruments[instrument];
}
void CMusicRoomHandler::setup(int volume) {
@@ -108,9 +108,9 @@ void CMusicRoomHandler::stop() {
}
for (int idx = 0; idx < 4; ++idx) {
- _musicWaves[idx]->reset();
- if (_active && _musicWaves[idx])
- _musicWaves[idx]->stop();
+ _instruments[idx]->reset();
+ if (_active && _instruments[idx])
+ _instruments[idx]->stop();
}
_field108 = 0;
@@ -174,7 +174,7 @@ void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, bool value) {
void CMusicRoomHandler::trigger() {
if (_active) {
for (int idx = 0; idx < 4; ++idx)
- _musicWaves[idx]->trigger();
+ _instruments[idx]->trigger();
}
}
@@ -214,7 +214,7 @@ void CMusicRoomHandler::updateAudio() {
for (MusicInstrument instrument = BELLS; instrument <= BASS;
instrument = (MusicInstrument)((int)instrument + 1)) {
- CMusicWave *musicWave = _musicWaves[instrument];
+ CMusicRoomInstrument *musicWave = _instruments[instrument];
// Iterate through each of the four instruments and do an additive
// read that will merge their data onto the output buffer
@@ -243,7 +243,7 @@ void CMusicRoomHandler::fn1() {
instrument = (MusicInstrument)((int)instrument + 1)) {
MusicRoomInstrument &ins1 = _array1[instrument];
MusicRoomInstrument &ins2 = _array2[instrument];
- CMusicWave *musicWave = _musicWaves[instrument];
+ CMusicRoomInstrument *musicWave = _instruments[instrument];
// Is this about checking playback position?
if (_position[instrument] < 0 || ins1._muteControl || _position[instrument] >= _musicObjs[instrument]->size()) {
@@ -260,7 +260,7 @@ void CMusicRoomHandler::fn1() {
const CValuePair &vp = (*_musicObjs[instrument])[_position[instrument]];
if (vp._field0 != 0x7FFFFFFF) {
int amount = getPitch(instrument, _position[instrument]);
- _musicWaves[instrument]->start(amount);
+ _instruments[instrument]->start(amount);
}
if (ins1._directionControl == ins2._directionControl) {
@@ -276,14 +276,14 @@ void CMusicRoomHandler::fn1() {
bool CMusicRoomHandler::updateInstrument(MusicInstrument instrument) {
int &arrIndex = _startPos[instrument];
if (arrIndex < 0) {
- _musicWaves[instrument]->reset();
+ _instruments[instrument]->reset();
return false;
}
const CMusicObject &mObj = *_musicObjs[instrument];
if (arrIndex >= mObj.size()) {
arrIndex = -1;
- _musicWaves[instrument]->reset();
+ _instruments[instrument]->reset();
return false;
}
@@ -291,9 +291,9 @@ bool CMusicRoomHandler::updateInstrument(MusicInstrument instrument) {
int size = static_cast<int>(fn3(instrument, arrIndex) * 44100.0) & ~1;
if (vp._field0 == 0x7FFFFFFF || _array1[instrument]._muteControl)
- _musicWaves[instrument]->setSize(size);
+ _instruments[instrument]->setSize(size);
else
- _musicWaves[instrument]->chooseWaveFile(getPitch(instrument, arrIndex), size);
+ _instruments[instrument]->chooseWaveFile(getPitch(instrument, arrIndex), size);
if (_array1[instrument]._directionControl == _array2[instrument]._directionControl) {
++arrIndex;
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index ed87f331ac..999784e4fc 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -25,7 +25,7 @@
#include "titanic/sound/audio_buffer.h"
#include "titanic/sound/music_object.h"
-#include "titanic/sound/music_wave.h"
+#include "titanic/sound/music_room_instrument.h"
#include "titanic/sound/wave_file.h"
namespace Titanic {
@@ -49,7 +49,7 @@ class CMusicRoomHandler {
private:
CProjectItem *_project;
CSoundManager *_soundManager;
- CMusicWave *_musicWaves[4];
+ CMusicRoomInstrument *_instruments[4];
MusicRoomInstrument _array1[4];
MusicRoomInstrument _array2[4];
CMusicObject *_musicObjs[4];
@@ -86,12 +86,12 @@ public:
~CMusicRoomHandler();
/**
- * Creates a new music wave class instance, and assigns it to a slot
- * in the music handler
- * @param instrument Which instrument instance is for
- * @param count Number of files the new instance will contain
+ * Creates a new music room instrument class to handle the operation of one
+ * of the instruments in the music room.
+ * @param instrument Which instrument to create for
+ * @param count Number of Wave files the new instance will contain
*/
- CMusicWave *createMusicWave(MusicInstrument instrument, int count);
+ CMusicRoomInstrument *createInstrument(MusicInstrument instrument, int count);
/**
* Main setup for the music room handler
diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_room_instrument.cpp
index f6ea612537..5ec158f31f 100644
--- a/engines/titanic/sound/music_wave.cpp
+++ b/engines/titanic/sound/music_room_instrument.cpp
@@ -20,21 +20,21 @@
*
*/
-#include "titanic/sound/music_wave.h"
+#include "titanic/sound/music_room_instrument.h"
#include "titanic/sound/sound_manager.h"
#include "titanic/core/project_item.h"
#include "titanic/core/game_object.h"
namespace Titanic {
-bool CMusicWave::_pianoToggle;
-int CMusicWave::_pianoCtr;
-int CMusicWave::_bassCtr;
-byte *CMusicWave::_buffer;
-double *CMusicWave::_array;
-int CMusicWave::_arrayIndex;
+bool CMusicRoomInstrument::_pianoToggle;
+int CMusicRoomInstrument::_pianoCtr;
+int CMusicRoomInstrument::_bassCtr;
+byte *CMusicRoomInstrument::_buffer;
+double *CMusicRoomInstrument::_array;
+int CMusicRoomInstrument::_arrayIndex;
-void CMusicWave::init() {
+void CMusicRoomInstrument::init() {
_pianoToggle = false;
_pianoCtr = 0;
_bassCtr = 0;
@@ -43,13 +43,13 @@ void CMusicWave::init() {
_arrayIndex = 0;
}
-void CMusicWave::deinit() {
+void CMusicRoomInstrument::deinit() {
delete[] _buffer;
delete[] _array;
_buffer = nullptr;
}
-CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument) :
+CMusicRoomInstrument::CMusicRoomInstrument(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument) :
_project(project), _soundManager(soundManager), _instrument(instrument) {
Common::fill(&_gameObjects[0], &_gameObjects[4], (CGameObject *)nullptr);
_floatVal = 0.0;
@@ -87,24 +87,24 @@ CMusicWave::CMusicWave(CProjectItem *project, CSoundManager *soundManager, Music
}
}
-void CMusicWave::setFilesCount(uint count) {
+void CMusicRoomInstrument::setFilesCount(uint count) {
assert(_items.empty());
_items.resize(count);
}
-void CMusicWave::load(int index, const CString &filename, int v3) {
+void CMusicRoomInstrument::load(int index, const CString &filename, int v3) {
assert(!_items[index]._waveFile);
_items[index]._waveFile = createWaveFile(filename);
_items[index]._value = v3;
}
-CWaveFile *CMusicWave::createWaveFile(const CString &name) {
+CWaveFile *CMusicRoomInstrument::createWaveFile(const CString &name) {
if (name.empty())
return nullptr;
return _soundManager->loadSound(name);
}
-void CMusicWave::start(int val) {
+void CMusicRoomInstrument::start(int val) {
if (_gameObjects[0]) {
switch (_instrument) {
case MV_PIANO:
@@ -202,7 +202,7 @@ void CMusicWave::start(int val) {
}
}
-void CMusicWave::stop() {
+void CMusicRoomInstrument::stop() {
if (_gameObjects[0]) {
switch (_instrument) {
case MV_PIANO:
@@ -222,7 +222,7 @@ void CMusicWave::stop() {
}
}
-void CMusicWave::trigger() {
+void CMusicRoomInstrument::trigger() {
if (_gameObjects[0]) {
switch (_instrument) {
case MV_PIANO:
@@ -253,7 +253,7 @@ void CMusicWave::trigger() {
}
}
-void CMusicWave::reset() {
+void CMusicRoomInstrument::reset() {
_waveIndex = 0;
_readPos = 0;
_readIncrement = 0;
@@ -261,7 +261,7 @@ void CMusicWave::reset() {
_count = 0;
}
-void CMusicWave::setSize(uint total) {
+void CMusicRoomInstrument::setSize(uint total) {
_waveIndex = -1;
_readPos = 0;
_readIncrement = 0;
@@ -269,7 +269,7 @@ void CMusicWave::setSize(uint total) {
_count = 0;
}
-int CMusicWave::read(int16 *ptr, uint size) {
+int CMusicRoomInstrument::read(int16 *ptr, uint size) {
if (!_size)
return 0;
@@ -300,7 +300,7 @@ int CMusicWave::read(int16 *ptr, uint size) {
return size;
}
-void CMusicWave::chooseWaveFile(int index, int size) {
+void CMusicRoomInstrument::chooseWaveFile(int index, int size) {
if (!_array)
setupArray(-36, 36);
@@ -315,7 +315,7 @@ void CMusicWave::chooseWaveFile(int index, int size) {
}
}
- const CMusicWaveFile &wf = _items[waveIndex];
+ const CInstrumentWaveFile &wf = _items[waveIndex];
int arrIndex = _arrayIndex - wf._value + index;
uint waveSize = wf._waveFile->size();
@@ -326,7 +326,7 @@ void CMusicWave::chooseWaveFile(int index, int size) {
_count = waveSize / 2;
}
-void CMusicWave::setupArray(int minVal, int maxVal) {
+void CMusicRoomInstrument::setupArray(int minVal, int maxVal) {
// Delete any prior array and recreate it
delete[] _array;
diff --git a/engines/titanic/sound/music_wave.h b/engines/titanic/sound/music_room_instrument.h
index f3782574ec..0a8ff16b35 100644
--- a/engines/titanic/sound/music_wave.h
+++ b/engines/titanic/sound/music_room_instrument.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef TITANIC_MUSIC_WAVE_H
-#define TITANIC_MUSIC_WAVE_H
+#ifndef TITANIC_MUSIC_ROOM_INSTRUMENT_H
+#define TITANIC_MUSIC_ROOM_INSTRUMENT_H
#include "common/array.h"
#include "titanic/support/string.h"
@@ -35,11 +35,11 @@ class CSoundManager;
class CWaveFile;
class CGameObject;
-class CMusicWave {
- struct CMusicWaveFile {
+class CMusicRoomInstrument {
+ struct CInstrumentWaveFile {
CWaveFile *_waveFile;
int _value;
- CMusicWaveFile() : _waveFile(nullptr), _value(0) {}
+ CInstrumentWaveFile() : _waveFile(nullptr), _value(0) {}
};
private:
static bool _pianoToggle;
@@ -50,7 +50,7 @@ private:
static int _arrayIndex;
private:
CSoundManager *_soundManager;
- Common::Array<CMusicWaveFile> _items;
+ Common::Array<CInstrumentWaveFile> _items;
MusicWaveInstrument _instrument;
CProjectItem *_project;
CGameObject *_gameObjects[4];
@@ -85,7 +85,7 @@ public:
*/
static void deinit();
public:
- CMusicWave(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument);
+ CMusicRoomInstrument(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument);
/**
* Sets the maximum number of allowed files that be defined
@@ -130,4 +130,4 @@ public:
} // End of namespace Titanic
-#endif /* TITANIC_MUSIC_WAVE_H */
+#endif /* TITANIC_MUSIC_ROOM_INSTRUMENT_H */
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 5c84bde8a8..116c3346e8 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -41,7 +41,7 @@
#include "titanic/moves/enter_exit_sec_class_mini_lift.h"
#include "titanic/moves/exit_pellerator.h"
#include "titanic/pet_control/pet_control.h"
-#include "titanic/sound/music_wave.h"
+#include "titanic/sound/music_room_instrument.h"
#include "titanic/support/simple_file.h"
#include "titanic/true_talk/tt_npc_script.h"
@@ -87,7 +87,7 @@ void TitanicEngine::initialize() {
CGetLiftEye2::init();
CHose::init();
CMovie::init();
- CMusicWave::init();
+ CMusicRoomInstrument::init();
CParrotLobbyObject::init();
CSGTNavigation::init();
CSGTStateRoom::init();