CGE2: Rework sound system.

This commit is contained in:
uruk 2014-08-13 20:58:22 +02:00
parent c247125469
commit d7a9ea9e2a
4 changed files with 6 additions and 10 deletions

View File

@ -101,12 +101,11 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_sayVox = !ConfMan.getBool("speech_mute");
if (ConfMan.getBool("mute")) {
_oldMusicVolume = _oldSfxVolume = 0;
_music = _sfx = false;
_music = false;
} else {
_oldMusicVolume = ConfMan.getInt("music_volume");
_oldSfxVolume = ConfMan.getInt("sfx_volume");
_music = _oldMusicVolume != 0;
_sfx = _oldSfxVolume != 0;
}
}

View File

@ -306,7 +306,6 @@ public:
int _oldMusicVolume;
int _oldSfxVolume;
bool _music;
bool _sfx;
ResourceManager *_resman;
Vga *_vga;

View File

@ -543,6 +543,7 @@ void CGE2Engine::checkSounds() {
_sound->checkSoundHandles();
checkVolumeSwitches();
_midiPlayer->syncVolume();
syncSoundSettings();
}
void CGE2Engine::handleFrame() {

View File

@ -123,11 +123,11 @@ void CGE2Engine::setVolume(int idx, int cnt) {
int newVolume = p * kSoundStatetoNumRate;
switch (idx) {
case 0:
_oldSfxVolume = ConfMan.getInt("sfx_volume");
ConfMan.setInt("sfx_volume", newVolume);
break;
case 1:
if (newVolume == 0)
_oldMusicVolume = ConfMan.getInt("music_volume");
_oldMusicVolume = ConfMan.getInt("music_volume");
ConfMan.setInt("music_volume", newVolume);
break;
default:
@ -143,11 +143,8 @@ void CGE2Engine::checkVolumeSwitches() {
_vol[1]->step(musicVolume / kSoundNumtoStateRate);
int sfxVolume = ConfMan.getInt("sfx_volume");
if (sfxVolume != _oldSfxVolume) {
if (sfxVolume != _oldSfxVolume)
_vol[0]->step(sfxVolume / kSoundNumtoStateRate);
_oldSfxVolume = sfxVolume;
_sfx = true;
}
}
void CGE2Engine::switchCap() {
@ -159,8 +156,8 @@ void CGE2Engine::switchCap() {
}
void CGE2Engine::switchVox() {
_mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, _sayVox);
_sayVox = !_sayVox;
_mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, _sayVox);
if (!_sayVox)
_sayCap = true;
keyClick();