diff options
author | Florian Kagerer | 2010-08-04 16:53:09 +0000 |
---|---|---|
committer | Florian Kagerer | 2010-08-04 16:53:09 +0000 |
commit | e5ffc7847cb70f792b4658aa032959949e849669 (patch) | |
tree | 0bba686f2c68bc0c15b5b03e532741299253d842 /sound/audiocd.cpp | |
parent | fbd7c8456705442f12c9c798c58ec146f0a85063 (diff) | |
download | scummvm-rg350-e5ffc7847cb70f792b4658aa032959949e849669.tar.gz scummvm-rg350-e5ffc7847cb70f792b4658aa032959949e849669.tar.bz2 scummvm-rg350-e5ffc7847cb70f792b4658aa032959949e849669.zip |
AUDIO: Implement volume and balance control for the AudioCD manager (needed for music fading in Kyra 1 FM-Towns and probably other FM-Towns games). This addition applies to emulated CD audio only for now. I haven't found a way to implement this for real CDs yet. SDL doesn't seem to support this (but it might be just me? If anyone knows more about this, just tell me).
svn-id: r51741
Diffstat (limited to 'sound/audiocd.cpp')
-rw-r--r-- | sound/audiocd.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index 7afbd12d03..625def58fe 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -42,6 +42,8 @@ AudioCDManager::AudioCDManager() { _cd.start = 0; _cd.duration = 0; _cd.numLoops = 0; + _cd.volume = Mixer::kMaxChannelVolume; + _cd.balance = 0; _mixer = g_system->getMixer(); _emulating = false; assert(_mixer); @@ -79,7 +81,8 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration, */ _emulating = true; _mixer->playStream(Mixer::kMusicSoundType, &_handle, - makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops)); + makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops), -1, _cd.volume, _cd.balance); + } else { _emulating = false; if (!only_emulate) @@ -109,6 +112,38 @@ bool AudioCDManager::isPlaying() const { } } +void AudioCDManager::setVolume(byte volume) { + _cd.volume = volume; + if (_emulating) { + // Audio CD emulation + if (_mixer->isSoundHandleActive(_handle)) + _mixer->setChannelVolume(_handle, _cd.volume); + } else { + // Real Audio CD + + // Unfortunately I can't implement this atm + // since SDL doesn't seem to offer an interface method for this. + + // g_system->setVolumeCD(_cd.volume); + } +} + +void AudioCDManager::setBalance(int8 balance) { + _cd.balance = balance; + if (_emulating) { + // Audio CD emulation + if (isPlaying()) + _mixer->setChannelBalance(_handle, _cd.balance); + } else { + // Real Audio CD + + // Unfortunately I can't implement this atm + // since SDL doesn't seem to offer an interface method for this. + + // g_system->setBalanceCD(_cd.balance); + } +} + void AudioCDManager::updateCD() { if (_emulating) { // Check whether the audio track stopped playback |