diff options
author | Alejandro Marzini | 2010-08-06 03:21:21 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-08-06 03:21:21 +0000 |
commit | 33e40e1a20c4cc60031854c87d6da5e461f9eb73 (patch) | |
tree | f76425d516e75d147ffbbacbec3fad49297da1b1 /backends/audiocd | |
parent | f97809a9a62a2d8840229facb2c2b6f75e37bad3 (diff) | |
parent | 6c8bcd2ba1cad1312f0a588ca284110bbbb81ccc (diff) | |
download | scummvm-rg350-33e40e1a20c4cc60031854c87d6da5e461f9eb73.tar.gz scummvm-rg350-33e40e1a20c4cc60031854c87d6da5e461f9eb73.tar.bz2 scummvm-rg350-33e40e1a20c4cc60031854c87d6da5e461f9eb73.zip |
Merged from trunk, from r51495 to r51775
svn-id: r51776
Diffstat (limited to 'backends/audiocd')
-rw-r--r-- | backends/audiocd/audiocd.h | 13 | ||||
-rw-r--r-- | backends/audiocd/default/default-audiocd.cpp | 36 | ||||
-rw-r--r-- | backends/audiocd/default/default-audiocd.h | 2 |
3 files changed, 50 insertions, 1 deletions
diff --git a/backends/audiocd/audiocd.h b/backends/audiocd/audiocd.h index 70eabf650b..5ea5bfcfd4 100644 --- a/backends/audiocd/audiocd.h +++ b/backends/audiocd/audiocd.h @@ -27,6 +27,7 @@ #define BACKENDS_AUDIOCD_ABSTRACT_H #include "common/noncopyable.h" +#include "common/scummsys.h" /** * Abstract Audio CD manager class. Subclasses implement the actual @@ -45,6 +46,8 @@ public: int start; int duration; int numLoops; + int volume; + int balance; }; /** @@ -72,6 +75,16 @@ public: virtual bool isPlaying() const = 0; /** + * Set the audio volume + */ + virtual void setVolume(byte volume) = 0; + + /** + * Set the speakers balance + */ + virtual void setBalance(int8 balance) = 0; + + /** * Stop CD or emulated audio playback. */ virtual void stop() = 0; diff --git a/backends/audiocd/default/default-audiocd.cpp b/backends/audiocd/default/default-audiocd.cpp index 0e7dc66ba1..56e737d359 100644 --- a/backends/audiocd/default/default-audiocd.cpp +++ b/backends/audiocd/default/default-audiocd.cpp @@ -33,6 +33,8 @@ DefaultAudioCDManager::DefaultAudioCDManager() { _cd.start = 0; _cd.duration = 0; _cd.numLoops = 0; + _cd.volume = Audio::Mixer::kMaxChannelVolume; + _cd.balance = 0; _mixer = g_system->getMixer(); _emulating = false; assert(_mixer); @@ -70,7 +72,7 @@ void DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int du */ _emulating = true; _mixer->playStream(Audio::Mixer::kMusicSoundType, &_handle, - Audio::makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops)); + Audio::makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops), -1, _cd.volume, _cd.balance); } else { _emulating = false; if (!only_emulate) @@ -100,6 +102,38 @@ bool DefaultAudioCDManager::isPlaying() const { } } +void DefaultAudioCDManager::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 DefaultAudioCDManager::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 DefaultAudioCDManager::update() { if (_emulating) { // Check whether the audio track stopped playback diff --git a/backends/audiocd/default/default-audiocd.h b/backends/audiocd/default/default-audiocd.h index ec209d9eb5..3f9df0bbbb 100644 --- a/backends/audiocd/default/default-audiocd.h +++ b/backends/audiocd/default/default-audiocd.h @@ -40,6 +40,8 @@ public: void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false); void stop(); bool isPlaying() const; + void setVolume(byte volume); + void setBalance(int8 balance); void update(); virtual Status getStatus() const; // Subclasses should override for better status results |