aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2014-10-01 13:42:58 +0200
committerEinar Johan Trøan Sømåen2014-10-01 13:42:58 +0200
commit3bba85278903f50e92d068c895b1fc829bf8f212 (patch)
tree6bf26b0e1b9e0b9e3b98aee81830a15269e124ed
parente37a92fc7bbe990f59cb86a61217268bba18a3d4 (diff)
parenta3ea75e0805d95a7b7ca7301fc958df640c7c117 (diff)
downloadscummvm-rg350-3bba85278903f50e92d068c895b1fc829bf8f212.tar.gz
scummvm-rg350-3bba85278903f50e92d068c895b1fc829bf8f212.tar.bz2
scummvm-rg350-3bba85278903f50e92d068c895b1fc829bf8f212.zip
Merge pull request #515 from tobiatesan/privatize_some_audio
WINTERMUTE: Make a bunch of attributes private in BaseSoundBuffer
-rw-r--r--engines/wintermute/base/sound/base_sound.cpp18
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.cpp20
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.h15
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp8
4 files changed, 42 insertions, 19 deletions
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
index fa452cc0d6..b5b12d55f9 100644
--- a/engines/wintermute/base/sound/base_sound.cpp
+++ b/engines/wintermute/base/sound/base_sound.cpp
@@ -89,7 +89,7 @@ bool BaseSound::setSoundSimple() {
_sound->setLooping(_soundLooping);
_sound->setPrivateVolume(_soundPrivateVolume);
_sound->setLoopStart(_soundLoopStart);
- _sound->_freezePaused = _soundFreezePaused;
+ _sound->setFreezePaused(_soundFreezePaused);
if (_soundPlaying) {
return _sound->resume();
} else {
@@ -130,7 +130,7 @@ bool BaseSound::pause(bool freezePaused) {
if (_sound) {
_soundPaused = true;
if (freezePaused) {
- _sound->_freezePaused = true;
+ _sound->setFreezePaused(true);
}
return _sound->pause();
} else {
@@ -150,13 +150,13 @@ bool BaseSound::resume() {
bool BaseSound::persist(BasePersistenceManager *persistMgr) {
if (persistMgr->getIsSaving() && _sound) {
_soundPlaying = _sound->isPlaying();
- _soundLooping = _sound->_looping;
- _soundPrivateVolume = _sound->_privateVolume;
+ _soundLooping = _sound->isLooping();
+ _soundPrivateVolume = _sound->getPrivateVolume();
if (_soundPlaying) {
_soundPosition = _sound->getPosition();
}
- _soundLoopStart = _sound->_loopStart;
- _soundFreezePaused = _sound->_freezePaused;
+ _soundLoopStart = _sound->getLoopStart();
+ _soundFreezePaused = _sound->isFreezePaused();
}
if (persistMgr->getIsSaving()) {
@@ -232,7 +232,7 @@ bool BaseSound::setPrivateVolume(int volume) {
if (!_sound) {
return STATUS_FAILED;
} else {
- _sound->_privateVolume = volume;
+ _sound->setPrivateVolume(volume);
return STATUS_OK;
}
}
@@ -241,7 +241,7 @@ int BaseSound::getVolumePercent() {
if (!_sound) {
return 0;
} else {
- return _sound->_privateVolume * 100 / 255;
+ return _sound->getPrivateVolume() * 100 / 255;
}
}
@@ -249,7 +249,7 @@ int BaseSound::getVolume() {
if (!_sound) {
return 0;
} else {
- return _sound->_privateVolume;
+ return _sound->getPrivateVolume();
}
}
diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp
index 7ec68ea752..09b82ca26c 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.cpp
+++ b/engines/wintermute/base/sound/base_sound_buffer.cpp
@@ -296,4 +296,24 @@ bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float p
return STATUS_OK;
}
+int32 BaseSoundBuffer::getPrivateVolume() const {
+ return _privateVolume;
+}
+
+bool BaseSoundBuffer::isLooping() const {
+ return _looping;
+}
+
+bool BaseSoundBuffer::isFreezePaused() const {
+ return _freezePaused;
+}
+
+void BaseSoundBuffer::setFreezePaused(bool freezePaused) {
+ _freezePaused = freezePaused;
+}
+
+Audio::Mixer::SoundType BaseSoundBuffer::getType() const {
+ return _type;
+}
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h
index 94bc8dc6ad..b3f3046674 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.h
+++ b/engines/wintermute/base/sound/base_sound_buffer.h
@@ -71,23 +71,26 @@ public:
void updateVolume();
void setType(Audio::Mixer::SoundType Type);
+ Audio::Mixer::SoundType getType() const;
bool loadFromFile(const Common::String &filename, bool forceReload = false);
void setStreaming(bool streamed, uint32 numBlocks = 0, uint32 blockSize = 0);
bool applyFX(TSFXType type, float param1, float param2, float param3, float param4);
-
+ int32 getPrivateVolume() const;
+ void setFreezePaused(bool freezePaused);
+ bool isFreezePaused() const;
+ bool isLooping() const;
//HSTREAM _stream;
//HSYNC _sync;
+
+private:
+ Audio::Mixer::SoundType _type;
Audio::SeekableAudioStream *_stream;
Audio::SoundHandle *_handle;
-
bool _freezePaused;
- uint32 _loopStart;
- Audio::Mixer::SoundType _type;
bool _looping;
-
int32 _privateVolume;
-private:
+ uint32 _loopStart;
uint32 _startPos;
Common::String _filename;
bool _streamed;
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index 41cfe5ea62..f1e0c3b1f9 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -254,9 +254,9 @@ byte BaseSoundMgr::getMasterVolume() {
bool BaseSoundMgr::pauseAll(bool includingMusic) {
for (uint32 i = 0; i < _sounds.size(); i++) {
- if (_sounds[i]->isPlaying() && (_sounds[i]->_type != Audio::Mixer::kMusicSoundType || includingMusic)) {
+ if (_sounds[i]->isPlaying() && (_sounds[i]->getType() != Audio::Mixer::kMusicSoundType || includingMusic)) {
_sounds[i]->pause();
- _sounds[i]->_freezePaused = true;
+ _sounds[i]->setFreezePaused(true);
}
}
@@ -268,9 +268,9 @@ bool BaseSoundMgr::pauseAll(bool includingMusic) {
bool BaseSoundMgr::resumeAll() {
for (uint32 i = 0; i < _sounds.size(); i++) {
- if (_sounds[i]->_freezePaused) {
+ if (_sounds[i]->isFreezePaused()) {
_sounds[i]->resume();
- _sounds[i]->_freezePaused = false;
+ _sounds[i]->setFreezePaused(false);
}
}