mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-13 04:00:29 +00:00
Use the same volume ranges as most of the rest of ScummVM (i.e. 0-255)
svn-id: r16333
This commit is contained in:
parent
357eb38b49
commit
01fc7adffd
@ -891,9 +891,9 @@ public:
|
||||
_fxSwitch->linkSurfaceImages(_musicSwitch, 516, 250);
|
||||
_fxSwitch->reverseStates();
|
||||
|
||||
_musicSlider = new Slider(this, _panel, 16, 309, 161, 170, 27);
|
||||
_speechSlider = new Slider(this, _panel, 14, 309, 208, 170, 27, _musicSlider);
|
||||
_fxSlider = new Slider(this, _panel, 14, 309, 254, 170, 27, _musicSlider);
|
||||
_musicSlider = new Slider(this, _panel, 255, 309, 161, 170, 27);
|
||||
_speechSlider = new Slider(this, _panel, 255, 309, 208, 170, 27, _musicSlider);
|
||||
_fxSlider = new Slider(this, _panel, 255, 309, 254, 170, 27, _musicSlider);
|
||||
_gfxSlider = new Slider(this, _panel, 3, 309, 341, 170, 27, _musicSlider);
|
||||
|
||||
_gfxPreview = new Widget(this, 4);
|
||||
@ -1476,23 +1476,6 @@ public:
|
||||
};
|
||||
|
||||
Gui::Gui(Sword2Engine *vm) : _vm(vm), _baseSlot(0) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(_musicVolume); i++) {
|
||||
_musicVolume[i] = (i * 255) / (ARRAYSIZE(_musicVolume) - 1);
|
||||
if ((i * 255) % (ARRAYSIZE(_musicVolume) - 1))
|
||||
_musicVolume[i]++;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(_soundVolume); i++) {
|
||||
_soundVolume[i] = (i * 255) / (ARRAYSIZE(_soundVolume) - 1);
|
||||
if ((i * 255) % (ARRAYSIZE(_soundVolume) - 1))
|
||||
_soundVolume[i]++;
|
||||
}
|
||||
|
||||
ConfMan.registerDefault("music_volume", _musicVolume[12]);
|
||||
ConfMan.registerDefault("speech_volume", _soundVolume[10]);
|
||||
ConfMan.registerDefault("sfx_volume", _soundVolume[10]);
|
||||
ConfMan.registerDefault("music_mute", false);
|
||||
ConfMan.registerDefault("speech_mute", false);
|
||||
ConfMan.registerDefault("sfx_mute", false);
|
||||
@ -1508,9 +1491,9 @@ void Gui::readOptionSettings(void) {
|
||||
|
||||
updateGraphicsLevel((uint8) ConfMan.getInt("gfx_details"));
|
||||
|
||||
_vm->_sound->setMusicVolume((16 * ConfMan.getInt("music_volume")) / 255);
|
||||
_vm->_sound->setSpeechVolume((14 * ConfMan.getInt("speech_volume")) / 255);
|
||||
_vm->_sound->setFxVolume((14 * ConfMan.getInt("sfx_volume")) / 255);
|
||||
_vm->_sound->setMusicVolume(ConfMan.getInt("music_volume"));
|
||||
_vm->_sound->setSpeechVolume(ConfMan.getInt("speech_volume"));
|
||||
_vm->_sound->setFxVolume(ConfMan.getInt("sfx_volume"));
|
||||
_vm->_sound->muteMusic(ConfMan.getBool("music_mute"));
|
||||
_vm->_sound->muteSpeech(ConfMan.getBool("speech_mute"));
|
||||
_vm->_sound->muteFx(ConfMan.getBool("sfx_mute"));
|
||||
@ -1518,9 +1501,9 @@ void Gui::readOptionSettings(void) {
|
||||
}
|
||||
|
||||
void Gui::writeOptionSettings(void) {
|
||||
ConfMan.set("music_volume", _musicVolume[_vm->_sound->getMusicVolume()]);
|
||||
ConfMan.set("speech_volume", _soundVolume[_vm->_sound->getSpeechVolume()]);
|
||||
ConfMan.set("sfx_volume", _soundVolume[_vm->_sound->getFxVolume()]);
|
||||
ConfMan.set("music_volume", _vm->_sound->getMusicVolume());
|
||||
ConfMan.set("speech_volume", _vm->_sound->getSpeechVolume());
|
||||
ConfMan.set("sfx_volume", _vm->_sound->getFxVolume());
|
||||
ConfMan.set("music_mute", _vm->_sound->isMusicMute());
|
||||
ConfMan.set("speech_mute", _vm->_sound->isSpeechMute());
|
||||
ConfMan.set("sfx_mute", _vm->_sound->isFxMute());
|
||||
|
@ -25,10 +25,6 @@ namespace Sword2 {
|
||||
class Sword2Engine;
|
||||
|
||||
class Gui {
|
||||
private:
|
||||
int _musicVolume[17];
|
||||
int _soundVolume[15];
|
||||
|
||||
public:
|
||||
Sword2Engine *_vm;
|
||||
|
||||
|
@ -469,13 +469,13 @@ Sound::Sound(Sword2Engine *vm) {
|
||||
|
||||
_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 @@ int Sound::readBuffer(int16 *buffer, const int numSamples) {
|
||||
|
||||
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 @@ void Sound::buildPanTable(bool reverse) {
|
||||
// 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 @@ bool Sound::isMusicMute(void) {
|
||||
* @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 @@ void Sound::muteSpeech(bool mute) {
|
||||
_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 @@ bool Sound::isSpeechMute(void) {
|
||||
* @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 @@ int32 Sound::playCompSpeech(uint32 speechid, uint8 vol, int8 pan) {
|
||||
|
||||
// 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 @@ void Sound::muteFx(bool mute) {
|
||||
// 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 @@ uint8 Sound::getFxVolume(void) {
|
||||
* @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 @@ void Sound::setFxVolume(uint8 volume) {
|
||||
// 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 @@ int32 Sound::setFxIdVolumePan(int32 id, uint8 vol, int8 pan) {
|
||||
_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 @@ int32 Sound::setFxIdVolume(int32 id, uint8 vol) {
|
||||
_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 @@ int32 Sound::playFx(int32 id, byte *data, uint8 vol, int8 pan, uint8 type) {
|
||||
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;
|
||||
|
@ -64,24 +64,23 @@ private:
|
||||
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 @@ public:
|
||||
|
||||
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 @@ public:
|
||||
|
||||
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 @@ public:
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user