Changed tinsel's volume range (0-127) to match ScummVM's (0-255)

svn-id: r34603
This commit is contained in:
Filippos Karapetis 2008-09-19 13:58:09 +00:00
parent 0068c63f22
commit 221b4a47ae
5 changed files with 13 additions and 18 deletions

View File

@ -39,9 +39,9 @@ namespace Tinsel {
//----------------- GLOBAL GLOBAL DATA --------------------
int dclickSpeed = DOUBLE_CLICK_TIME;
int volMidi = MAXMIDIVOL;
int volSound = MAXSAMPVOL;
int volVoice = MAXSAMPVOL;
int volMidi = Audio::Mixer::kMaxChannelVolume;
int volSound = Audio::Mixer::kMaxChannelVolume;
int volVoice = Audio::Mixer::kMaxChannelVolume;
int speedText = DEFTEXTSPEED;
int bSubtitles = false;
int bSwapButtons = 0;
@ -57,9 +57,9 @@ bool bNoBlocking;
*/
void WriteConfig(void) {
ConfMan.setInt("dclick_speed", dclickSpeed);
ConfMan.setInt("music_volume", (volMidi * Audio::Mixer::kMaxChannelVolume) / MAXMIDIVOL);
ConfMan.setInt("sfx_volume", (volSound * Audio::Mixer::kMaxChannelVolume) / MAXSAMPVOL);
ConfMan.setInt("speech_volume", (volVoice * Audio::Mixer::kMaxChannelVolume) / MAXSAMPVOL);
ConfMan.setInt("music_volume", volMidi);
ConfMan.setInt("sfx_volume", volSound);
ConfMan.setInt("speech_volume", volVoice);
ConfMan.setInt("talkspeed", (speedText * 255) / 100);
ConfMan.setBool("subtitles", bSubtitles);
//ConfMan.setBool("swap_buttons", bSwapButtons ? 1 : 0);
@ -101,9 +101,9 @@ void ReadConfig(void) {
if (ConfMan.hasKey("dclick_speed"))
dclickSpeed = ConfMan.getInt("dclick_speed");
volMidi = (ConfMan.getInt("music_volume") * MAXMIDIVOL) / Audio::Mixer::kMaxChannelVolume;
volSound = (ConfMan.getInt("sfx_volume") * MAXSAMPVOL) / Audio::Mixer::kMaxChannelVolume;
volVoice = (ConfMan.getInt("speech_volume") * MAXSAMPVOL) / Audio::Mixer::kMaxChannelVolume;
volMidi = ConfMan.getInt("music_volume");
volSound = ConfMan.getInt("sfx_volume");
volVoice = ConfMan.getInt("speech_volume");
if (ConfMan.hasKey("talkspeed"))
speedText = (ConfMan.getInt("talkspeed") * 100) / 255;

View File

@ -525,9 +525,9 @@ CONFBOX restartBox[] = {
};
#else
CONFBOX soundBox[] = {
{ SLIDER, MIDIVOL, NULL, SIX_MVOL_SLIDER, 142, 25, MAXMIDIVOL, 2, &volMidi, 0 },
{ SLIDER, NOFUNC, NULL, SIX_SVOL_SLIDER, 142, 25+40, MAXSAMPVOL, 2, &volSound, 0 },
{ SLIDER, NOFUNC, NULL, SIX_VVOL_SLIDER, 142, 25+2*40, MAXSAMPVOL, 2, &volVoice, 0 }
{ SLIDER, MIDIVOL, NULL, SIX_MVOL_SLIDER, 142, 25, Audio::Mixer::kMaxChannelVolume, 2, &volMidi, 0 },
{ SLIDER, NOFUNC, NULL, SIX_SVOL_SLIDER, 142, 25+40, Audio::Mixer::kMaxChannelVolume, 2, &volSound, 0 },
{ SLIDER, NOFUNC, NULL, SIX_VVOL_SLIDER, 142, 25+2*40, Audio::Mixer::kMaxChannelVolume, 2, &volVoice, 0 }
};
#endif

View File

@ -263,7 +263,7 @@ int GetMidiVolume() {
* @param vol New volume - 0..MAXMIDIVOL
*/
void SetMidiVolume(int vol) {
assert(vol >= 0 && vol <= MAXMIDIVOL);
assert(vol >= 0 && vol <= Audio::Mixer::kMaxChannelVolume);
if (vol == 0 && volMidi == 0) {
// Nothing to do
@ -343,8 +343,6 @@ MusicPlayer::~MusicPlayer() {
}
void MusicPlayer::setVolume(int volume) {
// FIXME: Could we simply change MAXMIDIVOL to match ScummVM's range?
volume = CLIP((255 * volume) / MAXMIDIVOL, 0, 255);
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
if (_masterVolume == volume)

View File

@ -34,8 +34,6 @@
namespace Tinsel {
#define MAXMIDIVOL 127
bool PlayMidiSequence( // Plays the specified MIDI sequence through the sound driver
uint32 dwFileOffset, // handle of MIDI sequence data
bool bLoop); // Whether to loop the sequence

View File

@ -37,7 +37,6 @@
namespace Tinsel {
#define MAXSAMPVOL 127
/*----------------------------------------------------------------------*\
|* Function Prototypes *|