diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/kyra.cpp | 25 | ||||
-rw-r--r-- | engines/kyra/sound.h | 14 | ||||
-rw-r--r-- | engines/kyra/sound_towns.cpp | 29 |
3 files changed, 13 insertions, 55 deletions
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index c6f9bd5625..61027555a5 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -96,27 +96,10 @@ int KyraEngine::init() { // TODO: currently we don't support the PC98 sound data, // but since it has the FM-Towns data files, we just use the // FM-Towns driver - - // Since we handle the volume internally for our FM-Towns driver we set the global - // volume for those sound types to the maximum. - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, Audio::Mixer::kMaxMixerVolume); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume); - - if (_flags.gameID == GI_KYRA1) { - SoundTowns *snd = new SoundTowns(this, _mixer); - - snd->setMusicVolume(ConfMan.getInt("music_volume")); - snd->setSoundEffectsVolume(ConfMan.getInt("sfx_volume")); - - _sound = snd; - } else { - SoundTowns_v2 *snd = new SoundTowns_v2(this, _mixer); - - snd->setMusicVolume(ConfMan.getInt("music_volume")); - snd->setSoundEffectsVolume(ConfMan.getInt("sfx_volume")); - - _sound = snd; - } + if (_flags.gameID == GI_KYRA1) + _sound = new SoundTowns(this, _mixer); + else + _sound = new SoundTowns_v2(this, _mixer); } else if (midiDriver == MD_ADLIB) { _sound = new SoundAdlibPC(this, _mixer); assert(_sound); diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 9cf712e8ce..e0c5398300 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -370,12 +370,6 @@ public: void setVolume(int) {} int getVolume() { return 255; } - // TODO: this should be moved to Sound or at least - // supplied by Sound as a pure virtual method. - // TODO: define ranges for those two functions - void setMusicVolume(int volume); - void setSoundEffectsVolume(int volume) { _sfxVolume = CLIP(volume, 0, 255); } - void loadSoundFile(uint file); void playTrack(uint8 track); @@ -412,7 +406,6 @@ private: uint _sfxFileIndex; uint8 *_sfxFileData; - uint8 _sfxVolume; SoundTowns_EuphonyDriver * _driver; MidiParser * _parser; @@ -435,12 +428,6 @@ public: void setVolume(int) {} int getVolume() { return 255; } - // TODO: this should be moved to Sound or at least - // supplied by Sound as a pure virtual method. - // TODO: define ranges for those two functions - void setMusicVolume(int volume); - void setSoundEffectsVolume(int volume) { _sfxVolume = CLIP(volume, 0, 255); } - void loadSoundFile(uint file) {} void playTrack(uint8 track); @@ -455,7 +442,6 @@ private: Audio::AudioStream *_currentSFX; Audio::SoundHandle _sfxHandle; - uint8 _sfxVolume; //SoundTowns_v2_TwnDriver * _driver; uint8 * _twnTrackData; diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index d77bd87efc..65f53d60ff 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -1084,14 +1084,14 @@ void SoundTowns_EuphonyTrackQueue::initDriver() { _driver->send(0x79B0); } -SoundTowns::SoundTowns(KyraEngine *vm, Audio::Mixer *mixer) : Sound(vm, mixer), _lastTrack(-1), - _currentSFX(0), _sfxFileData(0), _sfxFileIndex((uint)-1), _sfxWDTable(0), _parser(0), _sfxVolume(255) { +SoundTowns::SoundTowns(KyraEngine *vm, Audio::Mixer *mixer) + : Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), _sfxFileData(0), + _sfxFileIndex((uint)-1), _sfxWDTable(0), _parser(0) { _driver = new SoundTowns_EuphonyDriver(_mixer); int ret = open(); - if (ret != MERR_ALREADY_OPEN && ret != 0) { + if (ret != MERR_ALREADY_OPEN && ret != 0) error("couldn't open midi driver"); - } } SoundTowns::~SoundTowns() { @@ -1190,13 +1190,6 @@ void SoundTowns::haltTrack() { _driver->queue()->release(); } -void SoundTowns::setMusicVolume(int volume) { - volume = CLIP<int>(volume, 0, Audio::Mixer::kMaxMixerVolume); - - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume); - _driver->setVolume(255); -} - void SoundTowns::loadSoundFile(uint file) { if (_sfxFileIndex == file) return; @@ -1293,7 +1286,7 @@ void SoundTowns::playSoundEffect(uint8 track) { _currentSFX = Audio::makeLinearInputStream(sfxPlaybackBuffer, playbackBufferSize, outputRate, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_AUTOFREE, 0, 0); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX, -1, _sfxVolume); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX); } void SoundTowns::beginFadeOut() { @@ -1422,9 +1415,9 @@ const uint8 SoundTowns::_sfxBTTable[256] = { // KYRA 2 -SoundTowns_v2::SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer) : - Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), /*_driver(0),*/ - _twnTrackData(0), _sfxVolume(255) { +SoundTowns_v2::SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer) + : Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), /*_driver(0),*/ + _twnTrackData(0) { } SoundTowns_v2::~SoundTowns_v2() { @@ -1448,10 +1441,6 @@ void SoundTowns_v2::process() { AudioCD.updateCD(); } -void SoundTowns_v2::setMusicVolume(int volume) { - /* TODO */ -} - void SoundTowns_v2::playTrack(uint8 track) { if (track == _lastTrack && _musicEnabled) return; @@ -1541,7 +1530,7 @@ void SoundTowns_v2::voicePlay(const char *file) { _currentSFX = Audio::makeLinearInputStream(sfx, outsize, outputRate, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_AUTOFREE, 0, 0); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX, -1, _sfxVolume); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX); delete [] data; } |