TITANIC: Finish CMusicPlayer class

This commit is contained in:
Paul Gilbert 2016-08-09 19:03:05 -04:00
parent 0f1fd5c955
commit 30936a6115
9 changed files with 127 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 \

View File

@ -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;

View File

@ -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; }

View File

@ -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);
}

View File

@ -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

View File

@ -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 */

View File

@ -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);
}