aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects/actions/action_sound.cpp
diff options
context:
space:
mode:
authorwhiterandrek2018-06-09 20:26:32 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commitcf04fb20c76f4c0ce52939e074cb79c40367f93a (patch)
tree134120264f1de871f3ecffadb003ae27bb4a001e /engines/pink/objects/actions/action_sound.cpp
parent4fd0ec3ff71614ecbf66ec7f8b414d99c74b1e32 (diff)
downloadscummvm-rg350-cf04fb20c76f4c0ce52939e074cb79c40367f93a.tar.gz
scummvm-rg350-cf04fb20c76f4c0ce52939e074cb79c40367f93a.tar.bz2
scummvm-rg350-cf04fb20c76f4c0ce52939e074cb79c40367f93a.zip
PINK: rework sound system
Diffstat (limited to 'engines/pink/objects/actions/action_sound.cpp')
-rw-r--r--engines/pink/objects/actions/action_sound.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index d63d57c7f3..e67717f04a 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -31,10 +31,7 @@
namespace Pink {
-ActionSound::ActionSound()
- : _sound(nullptr) {}
-
-ActionSound::~ActionSound(){
+ActionSound::~ActionSound() {
end();
}
@@ -52,16 +49,12 @@ void ActionSound::toConsole() {
}
void ActionSound::start() {
- assert(!_sound);
- _sound = _actor->getPage()->loadSound(_fileName);
-
- Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::kMusicSoundType
- : Audio::Mixer::kSpeechSoundType;
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::kMusicSoundType : Audio::Mixer::kSFXSoundType;
Director *director = _actor->getPage()->getGame()->getDirector();
director->addSound(this);
- _sound->play(soundType, _volume, _isLoop);
+ _sound.play(_actor->getPage()->getResourceStream(_fileName), soundType, _volume, _isLoop);
if (_isLoop)
_actor->endAction();
@@ -69,25 +62,21 @@ void ActionSound::start() {
}
void ActionSound::end() {
- if (_sound) {
- debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ _sound.stop();
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->removeSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
- delete _sound;
- _sound = nullptr;
- }
}
void ActionSound::update() {
- if (!_sound->isPlaying())
+ if (!_sound.isPlaying())
_actor->endAction();
}
void ActionSound::pause(bool paused) {
- if (_sound)
- _sound->pause(paused);
+ _sound.pause(paused);
}
} // End of namespace Pink