diff options
Diffstat (limited to 'engines/kyra/sound_midi.cpp')
-rw-r--r-- | engines/kyra/sound_midi.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 70cc304192..fc6e92abd9 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -323,7 +323,7 @@ void MidiOutput::setSourceVolume(int source, int volume, bool apply) { for (int i = 0; i < 16; ++i) { // Controller 0 in the state table should always be '7' aka // volume control - byte realVol = (_channels[i].controllers[0].value * volume) >> 8; + byte realVol = (_sources[source].controllers[i][0].value * volume) >> 8; sendIntern(0xB0, i, 0x07, realVol); } } @@ -442,6 +442,8 @@ SoundMidiPC::SoundMidiPC(KyraEngine_v1 *vm, Audio::Mixer *mixer, MidiDriver *dri _output = 0; _musicFile = _sfxFile = 0; + _currentResourceSet = 0; + memset(&_resInfo, 0, sizeof(_resInfo)); _music = MidiParser::createParser_XMIDI(); assert(_music); @@ -495,6 +497,9 @@ SoundMidiPC::~SoundMidiPC() { delete[] _sfxFile; delete[] _musicFile; + + for (int i = 0; i < 3; i++) + initAudioResourceInfo(i, 0); } bool SoundMidiPC::init() { @@ -586,8 +591,29 @@ void SoundMidiPC::updateVolumeSettings() { _output->setSourceVolume(i, _sfxVolume, false); } +void SoundMidiPC::initAudioResourceInfo(int set, void *info) { + if (set >= kMusicIntro && set <= kMusicFinale) { + delete _resInfo[set]; + _resInfo[set] = info ? new SoundResourceInfo_PC(*(SoundResourceInfo_PC*)info) : 0; + } +} + +void SoundMidiPC::selectAudioResourceSet(int set) { + if (set >= kMusicIntro && set <= kMusicFinale) { + if (_resInfo[set]) + _currentResourceSet = set; + } +} + +bool SoundMidiPC::hasSoundFile(uint file) const { + if (file < res()->fileListSize) + return (res()->fileList[file] != 0); + return false; +} + void SoundMidiPC::loadSoundFile(uint file) { - loadSoundFile(fileListEntry(file)); + if (file < res()->fileListSize) + loadSoundFile(res()->fileList[file]); } void SoundMidiPC::loadSoundFile(Common::String file) { @@ -757,7 +783,6 @@ void SoundMidiPC::onTimer(void *data) { midi->_sfx[i]->stopPlaying(); } - midi->_output->setSourceVolume(0, midi->_musicVolume, true); midi->_fadeMusicOut = false; } } |