[Scummvm-git-logs] scummvm master -> 5095f4c00d1b5ffd1dab06f20332500cafc84e74
dreammaster
dreammaster at scummvm.org
Mon Jan 30 00:58:44 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5095f4c00d TITANIC: Cleanup of music instrument settings code
Commit: 5095f4c00d1b5ffd1dab06f20332500cafc84e74
https://github.com/scummvm/scummvm/commit/5095f4c00d1b5ffd1dab06f20332500cafc84e74
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-29T18:58:36-05:00
Commit Message:
TITANIC: Cleanup of music instrument settings code
Changed paths:
engines/titanic/gfx/music_control.cpp
engines/titanic/gfx/music_control.h
engines/titanic/sound/music_room.cpp
engines/titanic/sound/music_room.h
engines/titanic/sound/music_room_handler.cpp
engines/titanic/sound/music_room_handler.h
diff --git a/engines/titanic/gfx/music_control.cpp b/engines/titanic/gfx/music_control.cpp
index 26f2766..40a9f89 100644
--- a/engines/titanic/gfx/music_control.cpp
+++ b/engines/titanic/gfx/music_control.cpp
@@ -45,7 +45,7 @@ void CMusicControl::save(SimpleFile *file, int indent) {
void CMusicControl::load(SimpleFile *file) {
file->readNumber();
- _controlArea = (MusicControlArea)file->readNumber();
+ _controlArea = (MusicInstrument)file->readNumber();
_controlVal = file->readNumber();
_controlMax = file->readNumber();
_enabled = file->readNumber();
diff --git a/engines/titanic/gfx/music_control.h b/engines/titanic/gfx/music_control.h
index b33b4ae..3da063a 100644
--- a/engines/titanic/gfx/music_control.h
+++ b/engines/titanic/gfx/music_control.h
@@ -33,7 +33,7 @@ class CMusicControl : public CBackground {
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
public:
- MusicControlArea _controlArea;
+ MusicInstrument _controlArea;
int _controlVal;
int _controlMax;
bool _enabled;
diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp
index 7f4ffdc..b682f00 100644
--- a/engines/titanic/sound/music_room.cpp
+++ b/engines/titanic/sound/music_room.cpp
@@ -54,6 +54,7 @@ void CMusicRoom::destroyMusicHandler() {
void CMusicRoom::setupMusic(int volume) {
if (_musicHandler) {
+ // Set up the control values that form the correct settings
_musicHandler->setSpeedControl2(BELLS, 0);
_musicHandler->setSpeedControl2(SNAKE, 1);
_musicHandler->setSpeedControl2(PIANO, -1);
@@ -74,8 +75,9 @@ void CMusicRoom::setupMusic(int volume) {
_musicHandler->setDirectionControl2(PIANO, 1);
_musicHandler->setDirectionControl2(BASS, 1);
- for (MusicControlArea idx = BELLS; idx <= BASS;
- idx = (MusicControlArea)((int)idx + 1)) {
+ // Set up the current control values
+ for (MusicInstrument idx = BELLS; idx <= BASS;
+ idx = (MusicInstrument)((int)idx + 1)) {
Controls &controls = _controls[idx];
_musicHandler->setSpeedControl(idx, controls._speedControl);
_musicHandler->setPitchControl(idx, controls._pitchControl);
diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h
index 95557b6..0831d7b 100644
--- a/engines/titanic/sound/music_room.h
+++ b/engines/titanic/sound/music_room.h
@@ -63,11 +63,30 @@ public:
*/
void destroyMusicHandler();
- void setSpeedControl(MusicControlArea index, int val) { _controls[index]._speedControl = val; }
- void setPitchControl(MusicControlArea index, int val) { _controls[index]._pitchControl = val; }
- void setDirectionControl(MusicControlArea index, int val) { _controls[index]._directionControl = val; }
- void setInversionControl(MusicControlArea index, int val) { _controls[index]._inversionControl = val; }
- void setMuteControl(MusicControlArea index, int val) { _controls[index]._muteControl = val; }
+ /**
+ * Sets the speed control for a given instrument
+ */
+ void setSpeedControl(MusicInstrument instrument, int val) { _controls[instrument]._speedControl = val; }
+
+ /**
+ * Sets the pitch control for a given instrument
+ */
+ void setPitchControl(MusicInstrument instrument, int val) { _controls[instrument]._pitchControl = val; }
+
+ /**
+ * Sets the direction control for a given instrument
+ */
+ void setDirectionControl(MusicInstrument instrument, int val) { _controls[instrument]._directionControl = val; }
+
+ /**
+ * Sets the inversion control for a given instrument
+ */
+ void setInversionControl(MusicInstrument instrument, int val) { _controls[instrument]._inversionControl = val; }
+
+ /**
+ * Sets the mute control for a given instrument
+ */
+ void setMuteControl(MusicInstrument instrument, int val) { _controls[instrument]._muteControl = val; }
/**
* Sets up the music controls
diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp
index 9db1bac..450cc89 100644
--- a/engines/titanic/sound/music_room_handler.cpp
+++ b/engines/titanic/sound/music_room_handler.cpp
@@ -85,54 +85,54 @@ void CMusicRoomHandler::stop() {
}
}
-bool CMusicRoomHandler::checkInstrument(MusicControlArea area) const {
+bool CMusicRoomHandler::checkInstrument(MusicInstrument instrument) const {
// TODO
return false;
}
-void CMusicRoomHandler::setSpeedControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._speedControl = value;
+void CMusicRoomHandler::setSpeedControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._speedControl = value;
}
-void CMusicRoomHandler::setPitchControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._pitchControl = value * 3;
+void CMusicRoomHandler::setPitchControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._pitchControl = value * 3;
}
-void CMusicRoomHandler::setInversionControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._inversionControl = value;
+void CMusicRoomHandler::setInversionControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._inversionControl = value;
}
-void CMusicRoomHandler::setDirectionControl2(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array2[area]._directionControl = value;
+void CMusicRoomHandler::setDirectionControl2(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array2[instrument]._directionControl = value;
}
-void CMusicRoomHandler::setPitchControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._pitchControl = value;
+void CMusicRoomHandler::setPitchControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._pitchControl = value;
}
-void CMusicRoomHandler::setSpeedControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._speedControl = value;
+void CMusicRoomHandler::setSpeedControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._speedControl = value;
}
-void CMusicRoomHandler::setDirectionControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._directionControl = value;
+void CMusicRoomHandler::setDirectionControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._directionControl = value;
}
-void CMusicRoomHandler::setInversionControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._inversionControl = value;
+void CMusicRoomHandler::setInversionControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._inversionControl = value;
}
-void CMusicRoomHandler::setMuteControl(MusicControlArea area, int value) {
- if (area >= 0 && area <= 3 && value >= -2 && value <= 2)
- _array1[area]._muteControl = value;
+void CMusicRoomHandler::setMuteControl(MusicInstrument instrument, int value) {
+ if (instrument >= BELLS && instrument <= BASS && value >= -2 && value <= 2)
+ _array1[instrument]._muteControl = value;
}
bool CMusicRoomHandler::isBusy() {
diff --git a/engines/titanic/sound/music_room_handler.h b/engines/titanic/sound/music_room_handler.h
index 395076b..53ed280 100644
--- a/engines/titanic/sound/music_room_handler.h
+++ b/engines/titanic/sound/music_room_handler.h
@@ -31,7 +31,7 @@ namespace Titanic {
class CProjectItem;
class CSoundManager;
-enum MusicControlArea { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
+enum MusicInstrument { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
class CMusicRoomHandler {
struct Controls {
@@ -95,33 +95,52 @@ public:
/**
* Checks the specified instrument to see if it's settings are "correct"
*/
- bool checkInstrument(MusicControlArea area) const;
+ bool checkInstrument(MusicInstrument instrument) const;
/**
- * Set a setting
+ * Sets the speed control value
*/
- void setSpeedControl2(MusicControlArea area, int value);
+ void setSpeedControl2(MusicInstrument instrument, int value);
/**
- * Set a setting
+ * Sets the pitch control value
*/
- void setPitchControl2(MusicControlArea area, int value);
+ void setPitchControl2(MusicInstrument instrument, int value);
/**
- * Set a setting
+ * Sets the inversion control value
*/
- void setInversionControl2(MusicControlArea area, int value);
+ void setInversionControl2(MusicInstrument instrument, int value);
/**
- * Set a setting
+ * Sets the direction control value
*/
- void setDirectionControl2(MusicControlArea area, int value);
+ void setDirectionControl2(MusicInstrument instrument, int value);
- void setPitchControl(MusicControlArea area, int value);
- void setSpeedControl(MusicControlArea area, int value);
- void setDirectionControl(MusicControlArea area, int value);
- void setInversionControl(MusicControlArea area, int value);
- void setMuteControl(MusicControlArea area, int value);
+ /**
+ * Sets the pitch control value
+ */
+ void setPitchControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the speed control value
+ */
+ void setSpeedControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the direction control value
+ */
+ void setDirectionControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the inversion control value
+ */
+ void setInversionControl(MusicInstrument instrument, int value);
+
+ /**
+ * Sets the mute control value
+ */
+ void setMuteControl(MusicInstrument instrument, int value);
};
} // End of namespace Titanic
More information about the Scummvm-git-logs
mailing list