mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
svn-id: r30124
This commit is contained in:
parent
308b02f4ca
commit
23313cb82e
@ -221,6 +221,14 @@ void Control::askForCd(void) {
|
|||||||
free(_screenBuf);
|
free(_screenBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int volToBalance(int volL, int volR) {
|
||||||
|
if (volL + volR == 0) {
|
||||||
|
return 50;
|
||||||
|
} else {
|
||||||
|
return (100 * volL / (volL + volR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8 Control::runPanel(void) {
|
uint8 Control::runPanel(void) {
|
||||||
_mouseDown = false;
|
_mouseDown = false;
|
||||||
_restoreBuf = NULL;
|
_restoreBuf = NULL;
|
||||||
@ -310,6 +318,25 @@ uint8 Control::runPanel(void) {
|
|||||||
delay(1000 / 12);
|
delay(1000 / 12);
|
||||||
newMode = getClicks(mode, &retVal);
|
newMode = getClicks(mode, &retVal);
|
||||||
} while ((newMode != BUTTON_DONE) && (retVal == 0) && (!SwordEngine::_systemVars.engineQuit));
|
} while ((newMode != BUTTON_DONE) && (retVal == 0) && (!SwordEngine::_systemVars.engineQuit));
|
||||||
|
|
||||||
|
if (SwordEngine::_systemVars.controlPanelMode == CP_NORMAL) {
|
||||||
|
uint8 volL, volR;
|
||||||
|
_music->giveVolume(&volL, &volR);
|
||||||
|
ConfMan.setInt("music_volume", (int)((volR + volL) / 2));
|
||||||
|
ConfMan.setInt("music_balance", volToBalance(volL, volR));
|
||||||
|
|
||||||
|
_sound->giveSpeechVol(&volL, &volR);
|
||||||
|
ConfMan.setInt("speech_volume", (int)((volR + volL) / 2));
|
||||||
|
ConfMan.setInt("speech_balance", volToBalance(volL, volR));
|
||||||
|
|
||||||
|
_sound->giveSfxVol(&volL, &volR);
|
||||||
|
ConfMan.setInt("sfx_volume", (int)((volR + volL) / 2));
|
||||||
|
ConfMan.setInt("sfx_balance", volToBalance(volL, volR));
|
||||||
|
|
||||||
|
ConfMan.setBool("subtitles", SwordEngine::_systemVars.showText == 1);
|
||||||
|
ConfMan.flushToDisk();
|
||||||
|
}
|
||||||
|
|
||||||
destroyButtons();
|
destroyButtons();
|
||||||
_resMan->resClose(fontId);
|
_resMan->resClose(fontId);
|
||||||
_resMan->resClose(redFontId);
|
_resMan->resClose(redFontId);
|
||||||
|
@ -241,16 +241,50 @@ int SwordEngine::init() {
|
|||||||
uint musicVol = ConfMan.getInt("music_volume");
|
uint musicVol = ConfMan.getInt("music_volume");
|
||||||
uint speechVol = ConfMan.getInt("speech_volume");
|
uint speechVol = ConfMan.getInt("speech_volume");
|
||||||
uint sfxVol = ConfMan.getInt("sfx_volume");
|
uint sfxVol = ConfMan.getInt("sfx_volume");
|
||||||
if (musicVol > 255)
|
uint musicBal = 50;
|
||||||
musicVol = 255;
|
if (ConfMan.hasKey("music_balance")) {
|
||||||
if (speechVol > 255)
|
musicBal = CLIP(ConfMan.getInt("music_balance"), 0, 100);
|
||||||
speechVol = 255;
|
}
|
||||||
if (sfxVol > 255)
|
uint speechBal = 50;
|
||||||
sfxVol = 255;
|
if (ConfMan.hasKey("speech_balance")) {
|
||||||
|
speechBal = CLIP(ConfMan.getInt("speech_balance"), 0, 100);
|
||||||
|
}
|
||||||
|
uint sfxBal = 50;
|
||||||
|
if (ConfMan.hasKey("sfx_balance")) {
|
||||||
|
sfxBal = CLIP(ConfMan.getInt("sfx_balance"), 0, 100);
|
||||||
|
}
|
||||||
|
|
||||||
_music->setVolume(musicVol, musicVol); // these routines expect left and right volume,
|
uint musicVolL = 2 * musicVol * musicBal / 100;
|
||||||
_sound->setSpeechVol(speechVol, speechVol); // but our config manager doesn't support it.
|
uint musicVolR = 2 * musicVol - musicVolL;
|
||||||
_sound->setSfxVol(sfxVol, sfxVol);
|
|
||||||
|
uint speechVolL = 2 * speechVol * speechBal / 100;
|
||||||
|
uint speechVolR = 2 * speechVol - speechVolL;
|
||||||
|
|
||||||
|
uint sfxVolL = 2 * sfxVol * sfxBal / 100;
|
||||||
|
uint sfxVolR = 2 * sfxVol - sfxVolL;
|
||||||
|
|
||||||
|
if (musicVolR > 255) {
|
||||||
|
musicVolR = 255;
|
||||||
|
}
|
||||||
|
if (musicVolL > 255) {
|
||||||
|
musicVolL = 255;
|
||||||
|
}
|
||||||
|
if (speechVolR > 255) {
|
||||||
|
speechVolR = 255;
|
||||||
|
}
|
||||||
|
if (speechVolL > 255) {
|
||||||
|
speechVolL = 255;
|
||||||
|
}
|
||||||
|
if (sfxVolR > 255) {
|
||||||
|
sfxVolR = 255;
|
||||||
|
}
|
||||||
|
if (sfxVolL > 255) {
|
||||||
|
sfxVolL = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
_music->setVolume(musicVolL, musicVolR);
|
||||||
|
_sound->setSpeechVol(speechVolL, speechVolR);
|
||||||
|
_sound->setSfxVol(sfxVolL, sfxVolR);
|
||||||
|
|
||||||
_systemVars.justRestoredGame = 0;
|
_systemVars.justRestoredGame = 0;
|
||||||
_systemVars.currentCD = 0;
|
_systemVars.currentCD = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user