[Scummvm-cvs-logs] CVS: scummvm/sword2/driver d_sound.cpp,1.130,1.131 d_sound.h,1.54,1.55
Max Horn
fingolfin at users.sourceforge.net
Sun Dec 26 19:01:04 CET 2004
Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8652/driver
Modified Files:
d_sound.cpp d_sound.h
Log Message:
Use the same volume ranges as most of the rest of ScummVM (i.e. 0-255)
Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- d_sound.cpp 27 Dec 2004 00:27:00 -0000 1.130
+++ d_sound.cpp 27 Dec 2004 03:00:35 -0000 1.131
@@ -469,13 +469,13 @@
_speechPaused = false;
_speechMuted = false;
- _speechVol = 14;
+ _speechVol = 255;
_fxPaused = false;
_fxMuted = false;
- _fxVol = 14;
+ _fxVol = 255;
- _musicVol = 16;
+ _musicVol = 255;
_musicPaused = false;
_musicMuted = false;
@@ -545,7 +545,7 @@
if (!_musicMuted) {
for (int j = 0; j < len; j++) {
- clampedAdd(buffer[j], (_musicVolTable[_musicVol] * _mixBuffer[j]) / 255);
+ clampedAdd(buffer[j], (_musicVol * _mixBuffer[j]) / 255);
}
}
}
@@ -585,11 +585,6 @@
// MUSIC
// ----------------------------------------------------------------------------
-int32 Sound::_musicVolTable[17] = {
- 0, 15, 31, 47, 63, 79, 95, 111, 127,
- 143, 159, 175, 191, 207, 223, 239, 255
-};
-
/**
* Mutes/Unmutes the music.
* @param mute If mute is false, restore the volume to the last set master
@@ -613,9 +608,9 @@
* @param volume volume, from 0 (silent) to 16 (max)
*/
-void Sound::setMusicVolume(uint8 volume) {
- if (volume > 16)
- volume = 16;
+void Sound::setMusicVolume(uint volume) {
+ if (volume > 255)
+ volume = 255;
_musicVol = volume;
}
@@ -781,7 +776,7 @@
_speechMuted = mute;
if (_soundHandleSpeech.isActive()) {
- byte volume = mute ? 0 : 16 * _speechVol;
+ byte volume = mute ? 0 : _speechVol;
_vm->_mixer->setChannelVolume(_soundHandleSpeech, volume);
}
@@ -800,14 +795,14 @@
* @param volume volume, from 0 (silent) to 14 (max)
*/
-void Sound::setSpeechVolume(uint8 volume) {
- if (volume > 14)
- volume = 14;
+void Sound::setSpeechVolume(uint volume) {
+ if (volume > 255)
+ volume = 255;
_speechVol = volume;
if (_soundHandleSpeech.isActive() && !_speechMuted && _soundHandleSpeech.isActive()) {
- _vm->_mixer->setChannelVolume(_soundHandleSpeech, 16 * _speechVol);
+ _vm->_mixer->setChannelVolume(_soundHandleSpeech, _speechVol);
}
}
@@ -933,7 +928,7 @@
// Modify the volume according to the master volume
- byte volume = _speechMuted ? 0 : vol * _speechVol;
+ byte volume = _speechMuted ? 0 : vol * _speechVol / 16;
int8 p = _panTable[pan + 16];
// Start the speech playing
@@ -1019,7 +1014,7 @@
// Now update the volume of any fxs playing
for (int i = 0; i < MAXFX; i++) {
if (_fx[i]._id) {
- byte volume = mute ? 0 : _fx[i]._volume * _fxVol;
+ byte volume = mute ? 0 : _fx[i]._volume * _fxVol / 16;
_vm->_mixer->setChannelVolume(_fx[i]._handle, volume);
}
@@ -1048,9 +1043,9 @@
* @param volume volume, from 0 (silent) to 14 (max)
*/
-void Sound::setFxVolume(uint8 volume) {
- if (volume > 14)
- volume = 14;
+void Sound::setFxVolume(uint volume) {
+ if (volume > 255)
+ volume = 255;
_fxVol = volume;
@@ -1060,7 +1055,7 @@
// Now update the volume of any fxs playing
for (int i = 0; i < MAXFX; i++)
if (_fx[i]._id)
- _vm->_mixer->setChannelVolume(_fx[i]._handle, _fx[i]._volume * _fxVol);
+ _vm->_mixer->setChannelVolume(_fx[i]._handle, _fx[i]._volume * _fxVol / 16);
}
/**
@@ -1082,7 +1077,7 @@
_fx[i]._volume = vol;
if (!_fxMuted) {
- _vm->_mixer->setChannelVolume(_fx[i]._handle, _fx[i]._volume * _fxVol);
+ _vm->_mixer->setChannelVolume(_fx[i]._handle, _fx[i]._volume * _fxVol / 16);
_vm->_mixer->setChannelBalance(_fx[i]._handle, _panTable[pan + 16]);
}
@@ -1098,7 +1093,7 @@
_fx[i]._volume = vol;
if (!_fxMuted)
- _vm->_mixer->setChannelVolume(_fx[i]._handle, vol * _fxVol);
+ _vm->_mixer->setChannelVolume(_fx[i]._handle, vol * _fxVol / 16);
return RD_OK;
}
@@ -1195,14 +1190,14 @@
if (!_soundOn)
return RD_OK;
- byte volume = _fxMuted ? 0 : vol * _fxVol;
+ byte volume = _fxMuted ? 0 : vol * _fxVol / 16;
// All lead-ins and lead-outs I've heard are music, so we use
// the music volume setting for them.
if (type == RDSE_FXLEADIN || type == RDSE_FXLEADOUT) {
id = (type == RDSE_FXLEADIN) ? -2 : -1;
- volume = _musicMuted ? 0 : _musicVolTable[_musicVol];
+ volume = _musicMuted ? 0 : _musicVol;
}
WavInfo wavInfo;
Index: d_sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- d_sound.h 27 Nov 2004 13:54:09 -0000 1.54
+++ d_sound.h 27 Dec 2004 03:00:36 -0000 1.55
@@ -64,24 +64,23 @@
int32 _panTable[33];
bool _soundOn;
- static int32 _musicVolTable[17];
MusicInputStream *_music[MAXMUS];
int16 *_mixBuffer;
int _mixBufferLen;
bool _musicPaused;
bool _musicMuted;
- uint8 _musicVol;
+ uint _musicVol;
PlayingSoundHandle _soundHandleSpeech;
bool _speechPaused;
bool _speechMuted;
- uint8 _speechVol;
+ uint _speechVol;
FxHandle _fx[MAXFX];
bool _fxPaused;
bool _fxMuted;
- uint8 _fxVol;
+ uint _fxVol;
int32 getFxIndex(int32 id);
void stopFxHandle(int i);
@@ -105,7 +104,7 @@
void muteMusic(bool mute);
bool isMusicMute(void);
- void setMusicVolume(uint8 vol);
+ void setMusicVolume(uint vol);
uint8 getMusicVolume(void);
void pauseMusic(void);
void unpauseMusic(void);
@@ -116,7 +115,7 @@
void muteSpeech(bool mute);
bool isSpeechMute(void);
- void setSpeechVolume(uint8 vol);
+ void setSpeechVolume(uint vol);
uint8 getSpeechVolume(void);
void pauseSpeech(void);
void unpauseSpeech(void);
@@ -129,7 +128,7 @@
void muteFx(bool mute);
bool isFxMute(void);
uint8 getFxVolume(void);
- void setFxVolume(uint8 vol);
+ void setFxVolume(uint vol);
int32 setFxIdVolumePan(int32 id, uint8 vol, int8 pan);
int32 setFxIdVolume(int32 id, uint8 vol);
void pauseFx(void);
More information about the Scummvm-git-logs
mailing list