aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/core
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-06 21:55:19 -0400
committerPaul Gilbert2016-08-06 21:55:19 -0400
commit87b4c8a9d9654eec78e8f3e58995d61e6ad98b04 (patch)
tree1b04f46ca5311eb79a2bc0dde4190d5ee898726d /engines/titanic/core
parent467967542b499767ea5b271d5c0bbb0431ee9fcf (diff)
downloadscummvm-rg350-87b4c8a9d9654eec78e8f3e58995d61e6ad98b04.tar.gz
scummvm-rg350-87b4c8a9d9654eec78e8f3e58995d61e6ad98b04.tar.bz2
scummvm-rg350-87b4c8a9d9654eec78e8f3e58995d61e6ad98b04.zip
TITANIC: Added more sound manager functionality
Diffstat (limited to 'engines/titanic/core')
-rw-r--r--engines/titanic/core/game_object.cpp20
-rw-r--r--engines/titanic/core/game_object.h13
2 files changed, 23 insertions, 10 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index a366f7f336..6cd9db7056 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -38,9 +38,11 @@ namespace Titanic {
EMPTY_MESSAGE_MAP(CGameObject, CNamedItem);
CCreditText *CGameObject::_credits;
+int CGameObject::_soundHandles[3];
void CGameObject::init() {
_credits = nullptr;
+ _soundHandles[0] = _soundHandles[1] = _soundHandles[2] = -1;
}
void CGameObject::deinit() {
@@ -439,11 +441,11 @@ void CGameObject::soundFn2(const CString &resName, int v1, int v2, int v3, int h
warning("TODO: CGameObject::soundFn2");
}
-void CGameObject::soundFn3(int handle, int val2, int val3) {
+void CGameObject::setSoundVolume(uint handle, uint percent, uint seconds) {
if (handle != 0 && handle != -1) {
CGameManager *gameManager = getGameManager();
if (gameManager)
- return gameManager->_sound.fn3(handle, val2, val3);
+ return gameManager->_sound.setVolume(handle, percent, seconds);
}
}
@@ -456,7 +458,7 @@ void CGameObject::soundFn5(int v1, int v2, int v3) {
}
void CGameObject::sound8(bool flag) const {
- getGameManager()->_sound.managerProc8(flag ? 3 : 0);
+ getGameManager()->_sound.stopChannel(flag ? 3 : 0);
}
void CGameObject::setVisible(bool val) {
@@ -660,14 +662,16 @@ int CGameObject::playSound(const CString &name, CProximity &prox) {
return 0;
}
-void CGameObject::stopSound(int handle, int val2) {
+void CGameObject::stopSound(int handle, uint seconds) {
if (handle != 0 && handle != -1) {
CGameManager *gameManager = getGameManager();
if (gameManager) {
- if (val2)
- gameManager->_sound.fn3(handle, 0, val2);
- else
- gameManager->_sound.fn2(handle);
+ if (seconds) {
+ gameManager->_sound.setVolume(handle, 0, seconds);
+ gameManager->_sound.setCanFree(handle);
+ } else {
+ gameManager->_sound.stopSound(handle);
+ }
}
}
}
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index e5ee22a8d5..7bc5d156fc 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -53,6 +53,7 @@ class CGameObject : public CNamedItem {
DECLARE_MESSAGE_MAP;
private:
static CCreditText *_credits;
+ static int _soundHandles[3];
private:
/**
* Load a visual resource for the object
@@ -192,8 +193,10 @@ protected:
/**
* Stop a sound
+ * @param handle Sound handle
+ * @param seconds Optional number of seconds to transition sound off
*/
- void stopSound(int handle, int val2 = 0);
+ void stopSound(int handle, uint seconds = 0);
/**
* Returns true if a sound with the specified handle is active
@@ -202,7 +205,13 @@ protected:
void soundFn2(const CString &resName, int v1, int v2, int v3, int handleIndex);
- void soundFn3(int handle, int val2, int val3);
+ /**
+ * Sets the volume for a sound
+ * @param handle Sound handle
+ * @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 soundFn4(int v1, int v2, int v3);