mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 01:15:58 +00:00
Fix for bug # 1497961 ("KYRA1: in-game "Music" option not working").
svn-id: r22844
This commit is contained in:
parent
50f12fb9aa
commit
6ac60c9c7b
@ -25,6 +25,7 @@
|
||||
#include "kyra/script.h"
|
||||
#include "kyra/text.h"
|
||||
#include "kyra/animator.h"
|
||||
#include "kyra/sound.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/savefile.h"
|
||||
@ -56,6 +57,9 @@ void KyraEngine::readSettings() {
|
||||
_configMusic = ConfMan.getBool("music_mute") ? 0 : 1;
|
||||
_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
|
||||
|
||||
_sound->enableMusic(_configMusic);
|
||||
_sound->enableSFX(_configSounds);
|
||||
|
||||
bool speechMute = ConfMan.getBool("speech_mute");
|
||||
bool subtitles = ConfMan.getBool("subtitles");
|
||||
|
||||
@ -108,6 +112,12 @@ void KyraEngine::writeSettings() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!_configMusic)
|
||||
_sound->beginFadeOut();
|
||||
|
||||
_sound->enableMusic(_configMusic);
|
||||
_sound->enableSFX(_configSounds);
|
||||
|
||||
ConfMan.setBool("speech_mute", speechMute);
|
||||
ConfMan.setBool("subtitles", subtitles);
|
||||
|
||||
|
@ -36,7 +36,8 @@
|
||||
namespace Kyra {
|
||||
|
||||
Sound::Sound(KyraEngine *engine, Audio::Mixer *mixer)
|
||||
: _engine(engine), _mixer(mixer), _currentVocFile(0), _vocHandle(), _compressHandle() {
|
||||
: _engine(engine), _mixer(mixer), _currentVocFile(0), _vocHandle(), _compressHandle(),
|
||||
_musicEnabled(true), _sfxEnabled(false) {
|
||||
}
|
||||
|
||||
Sound::~Sound() {
|
||||
@ -363,7 +364,7 @@ void SoundMidiPC::onTimer(void *refCon) {
|
||||
}
|
||||
|
||||
void SoundMidiPC::playTrack(uint8 track) {
|
||||
if (_parser && (track != 0 || _nativeMT32)) {
|
||||
if (_parser && (track != 0 || _nativeMT32) && _musicEnabled) {
|
||||
_isPlaying = true;
|
||||
_fadeMusicOut = false;
|
||||
_fadeStartTime = 0;
|
||||
@ -387,7 +388,7 @@ void SoundMidiPC::haltTrack() {
|
||||
}
|
||||
|
||||
void SoundMidiPC::playSoundEffect(uint8 track) {
|
||||
if (_soundEffect) {
|
||||
if (_soundEffect && _sfxEnabled) {
|
||||
_sfxIsPlaying = true;
|
||||
_soundEffect->setTrack(track);
|
||||
_soundEffect->jumpToTick(0);
|
||||
|
@ -61,12 +61,20 @@ public:
|
||||
|
||||
virtual void beginFadeOut() = 0;
|
||||
|
||||
void enableMusic(bool enable) { _musicEnabled = enable; }
|
||||
bool musicEnabled() const { return _musicEnabled; }
|
||||
void enableSFX(bool enable) { _sfxEnabled = enable; }
|
||||
bool sfxEnabled() const { return _sfxEnabled; }
|
||||
|
||||
void voicePlay(const char *file);
|
||||
void voiceUnload() {}
|
||||
bool voiceIsPlaying();
|
||||
void voiceStop();
|
||||
|
||||
protected:
|
||||
bool _musicEnabled;
|
||||
bool _sfxEnabled;
|
||||
|
||||
KyraEngine *_engine;
|
||||
Audio::Mixer *_mixer;
|
||||
|
||||
@ -105,6 +113,8 @@ public:
|
||||
|
||||
void beginFadeOut();
|
||||
private:
|
||||
void play(uint8 track);
|
||||
|
||||
void loadSoundFile(const char *file);
|
||||
|
||||
void unk1();
|
||||
|
@ -2196,7 +2196,8 @@ void SoundAdlibPC::loadMusicFile(const char *file) {
|
||||
}
|
||||
|
||||
void SoundAdlibPC::playTrack(uint8 track) {
|
||||
playSoundEffect(track);
|
||||
if (_musicEnabled)
|
||||
play(track);
|
||||
}
|
||||
|
||||
void SoundAdlibPC::haltTrack() {
|
||||
@ -2206,6 +2207,11 @@ void SoundAdlibPC::haltTrack() {
|
||||
}
|
||||
|
||||
void SoundAdlibPC::playSoundEffect(uint8 track) {
|
||||
if (_sfxEnabled)
|
||||
play(track);
|
||||
}
|
||||
|
||||
void SoundAdlibPC::play(uint8 track) {
|
||||
uint8 soundId = _trackEntries[track];
|
||||
if ((int8)soundId == -1 || !_soundDataPtr)
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user