aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/sound
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2012-09-04 22:17:23 +0200
committerWillem Jan Palenstijn2012-09-04 22:17:23 +0200
commitb4090ead4d4334e08725323ff72fd355c93b63d5 (patch)
tree4eb58e5698b1cfd1a89d2b038f929071264ffeb9 /engines/wintermute/base/sound
parentdf80820184c90a87511f0cabdca4addb9fa13a66 (diff)
downloadscummvm-rg350-b4090ead4d4334e08725323ff72fd355c93b63d5.tar.gz
scummvm-rg350-b4090ead4d4334e08725323ff72fd355c93b63d5.tar.bz2
scummvm-rg350-b4090ead4d4334e08725323ff72fd355c93b63d5.zip
WINTERMUTE: Convert CRLF to LF
Diffstat (limited to 'engines/wintermute/base/sound')
-rw-r--r--engines/wintermute/base/sound/base_sound.cpp584
-rw-r--r--engines/wintermute/base/sound/base_sound.h174
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.cpp594
-rw-r--r--engines/wintermute/base/sound/base_sound_buffer.h200
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.cpp564
-rw-r--r--engines/wintermute/base/sound/base_sound_manager.h136
6 files changed, 1126 insertions, 1126 deletions
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
index aac68baccd..00d07cd3c2 100644
--- a/engines/wintermute/base/sound/base_sound.cpp
+++ b/engines/wintermute/base/sound/base_sound.cpp
@@ -1,292 +1,292 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This file is based on WME Lite.
- * http://dead-code.org/redir.php?target=wmelite
- * Copyright (c) 2011 Jan Nedoma
- */
-
-#include "engines/wintermute/base/sound/base_sound.h"
-#include "engines/wintermute/base/base_game.h"
-#include "engines/wintermute/base/sound/base_sound_manager.h"
-#include "engines/wintermute/base/sound/base_sound_buffer.h"
-
-namespace Wintermute {
-
-IMPLEMENT_PERSISTENT(BaseSound, false)
-
-BaseSound::BaseSound(BaseGame *inGame) : BaseClass(inGame) {
- _sound = NULL;
- _soundFilename = "";
-
- _soundType = Audio::Mixer::kSFXSoundType;
- _soundStreamed = false;
- _soundLooping = false;
- _soundPlaying = false;
- _soundPaused = false;
- _soundFreezePaused = false;
- _soundPosition = 0;
- _soundPrivateVolume = 0;
- _soundLoopStart = 0;
-
- _sFXType = SFX_NONE;
- _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
-}
-
-BaseSound::~BaseSound() {
- if (_sound) {
- _gameRef->_soundMgr->removeSound(_sound);
- }
- _sound = NULL;
-}
-
-bool BaseSound::setSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) {
- if (_sound) {
- _gameRef->_soundMgr->removeSound(_sound);
- _sound = NULL;
- }
- _soundFilename = Common::String(); // Set empty
-
- _sound = _gameRef->_soundMgr->addSound(filename, type, streamed);
- if (_sound) {
- _soundFilename = filename;
-
- _soundType = type;
- _soundStreamed = streamed;
-
- return STATUS_OK;
- } else {
- return STATUS_FAILED;
- }
-}
-
-bool BaseSound::setSoundSimple() {
- _sound = _gameRef->_soundMgr->addSound(_soundFilename, _soundType, _soundStreamed);
- if (_sound) {
- if (_soundPosition) {
- _sound->setPosition(_soundPosition);
- }
- _sound->setLooping(_soundLooping);
- _sound->setPrivateVolume(_soundPrivateVolume);
- _sound->setLoopStart(_soundLoopStart);
- _sound->_freezePaused = _soundFreezePaused;
- if (_soundPlaying) {
- return _sound->resume();
- } else {
- return STATUS_OK;
- }
- } else {
- return STATUS_FAILED;
- }
-}
-
-uint32 BaseSound::getLength() {
- if (_sound) {
- return _sound->getLength();
- } else {
- return 0;
- }
-}
-
-bool BaseSound::play(bool looping) {
- if (_sound) {
- _soundPaused = false;
- return _sound->play(looping, _soundPosition);
- } else {
- return STATUS_FAILED;
- }
-}
-
-bool BaseSound::stop() {
- if (_sound) {
- _soundPaused = false;
- return _sound->stop();
- } else {
- return STATUS_FAILED;
- }
-}
-
-bool BaseSound::pause(bool freezePaused) {
- if (_sound) {
- _soundPaused = true;
- if (freezePaused) {
- _sound->_freezePaused = true;
- }
- return _sound->pause();
- } else {
- return STATUS_FAILED;
- }
-}
-
-bool BaseSound::resume() {
- if (_sound && _soundPaused) {
- _soundPaused = false;
- return _sound->resume();
- } else {
- return STATUS_FAILED;
- }
-}
-
-bool BaseSound::persist(BasePersistenceManager *persistMgr) {
- if (persistMgr->getIsSaving() && _sound) {
- _soundPlaying = _sound->isPlaying();
- _soundLooping = _sound->_looping;
- _soundPrivateVolume = _sound->_privateVolume;
- if (_soundPlaying) {
- _soundPosition = _sound->getPosition();
- }
- _soundLoopStart = _sound->_loopStart;
- _soundFreezePaused = _sound->_freezePaused;
- }
-
- if (persistMgr->getIsSaving()) {
- _sFXType = SFX_NONE;
- _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
- }
-
- persistMgr->transfer(TMEMBER(_gameRef));
-
- persistMgr->transfer(TMEMBER(_soundFilename));
- persistMgr->transfer(TMEMBER(_soundLooping));
- persistMgr->transfer(TMEMBER(_soundPaused));
- persistMgr->transfer(TMEMBER(_soundFreezePaused));
- persistMgr->transfer(TMEMBER(_soundPlaying));
- persistMgr->transfer(TMEMBER(_soundPosition));
- persistMgr->transfer(TMEMBER(_soundPrivateVolume));
- persistMgr->transfer(TMEMBER(_soundStreamed));
- persistMgr->transfer(TMEMBER_INT(_soundType));
- persistMgr->transfer(TMEMBER(_soundLoopStart));
-
- return STATUS_OK;
-}
-
-bool BaseSound::isPlaying() {
- return _sound && _sound->isPlaying();
-}
-
-bool BaseSound::isPaused() {
- return _sound && _soundPaused;
-}
-
-bool BaseSound::setPositionTime(uint32 time) {
- if (!_sound) {
- return STATUS_FAILED;
- }
- _soundPosition = time;
- bool ret = _sound->setPosition(_soundPosition);
- if (_sound->isPlaying()) {
- _soundPosition = 0;
- }
- return ret;
-}
-
-uint32 BaseSound::getPositionTime() {
- if (!_sound) {
- return 0;
- }
-
- if (!_sound->isPlaying()) {
- return 0;
- } else {
- return _sound->getPosition();
- }
-}
-
-bool BaseSound::setVolumePercent(int percent) {
- if (!_sound) {
- return STATUS_FAILED;
- } else {
- return _sound->setPrivateVolume(percent * 255 / 100);
- }
-}
-
-bool BaseSound::setVolume(int volume) {
- if (!_sound) {
- return STATUS_FAILED;
- } else {
- return _sound->setPrivateVolume(volume);
- }
-}
-
-bool BaseSound::setPrivateVolume(int volume) {
- if (!_sound) {
- return STATUS_FAILED;
- } else {
- _sound->_privateVolume = volume;
- return STATUS_OK;
- }
-}
-
-int BaseSound::getVolumePercent() {
- if (!_sound) {
- return 0;
- } else {
- return _sound->_privateVolume * 100 / 255;
- }
-}
-
-int BaseSound::getVolume() {
- if (!_sound) {
- return 0;
- } else {
- return _sound->_privateVolume;
- }
-}
-
-bool BaseSound::setLoopStart(uint32 pos) {
- if (!_sound) {
- return STATUS_FAILED;
- } else {
- _sound->setLoopStart(pos);
- return STATUS_OK;
- }
-}
-
-bool BaseSound::setPan(float pan) {
- if (_sound) {
- return _sound->setPan(pan);
- } else {
- return STATUS_FAILED;
- }
-}
-
-bool BaseSound::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
- if (!_sound) {
- return STATUS_OK;
- }
-
- if (type != _sFXType || param1 != _sFXParam1 || param2 != _sFXParam2 || param3 != _sFXParam3 || param4 != _sFXParam4) {
- bool ret = _sound->applyFX(type, param1, param2, param3, param4);
-
- _sFXType = type;
- _sFXParam1 = param1;
- _sFXParam2 = param2;
- _sFXParam3 = param3;
- _sFXParam4 = param4;
-
- return ret;
- }
- return STATUS_OK;
-}
-
-} // end of namespace Wintermute
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/sound/base_sound.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/sound/base_sound_buffer.h"
+
+namespace Wintermute {
+
+IMPLEMENT_PERSISTENT(BaseSound, false)
+
+BaseSound::BaseSound(BaseGame *inGame) : BaseClass(inGame) {
+ _sound = NULL;
+ _soundFilename = "";
+
+ _soundType = Audio::Mixer::kSFXSoundType;
+ _soundStreamed = false;
+ _soundLooping = false;
+ _soundPlaying = false;
+ _soundPaused = false;
+ _soundFreezePaused = false;
+ _soundPosition = 0;
+ _soundPrivateVolume = 0;
+ _soundLoopStart = 0;
+
+ _sFXType = SFX_NONE;
+ _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
+}
+
+BaseSound::~BaseSound() {
+ if (_sound) {
+ _gameRef->_soundMgr->removeSound(_sound);
+ }
+ _sound = NULL;
+}
+
+bool BaseSound::setSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) {
+ if (_sound) {
+ _gameRef->_soundMgr->removeSound(_sound);
+ _sound = NULL;
+ }
+ _soundFilename = Common::String(); // Set empty
+
+ _sound = _gameRef->_soundMgr->addSound(filename, type, streamed);
+ if (_sound) {
+ _soundFilename = filename;
+
+ _soundType = type;
+ _soundStreamed = streamed;
+
+ return STATUS_OK;
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::setSoundSimple() {
+ _sound = _gameRef->_soundMgr->addSound(_soundFilename, _soundType, _soundStreamed);
+ if (_sound) {
+ if (_soundPosition) {
+ _sound->setPosition(_soundPosition);
+ }
+ _sound->setLooping(_soundLooping);
+ _sound->setPrivateVolume(_soundPrivateVolume);
+ _sound->setLoopStart(_soundLoopStart);
+ _sound->_freezePaused = _soundFreezePaused;
+ if (_soundPlaying) {
+ return _sound->resume();
+ } else {
+ return STATUS_OK;
+ }
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+uint32 BaseSound::getLength() {
+ if (_sound) {
+ return _sound->getLength();
+ } else {
+ return 0;
+ }
+}
+
+bool BaseSound::play(bool looping) {
+ if (_sound) {
+ _soundPaused = false;
+ return _sound->play(looping, _soundPosition);
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::stop() {
+ if (_sound) {
+ _soundPaused = false;
+ return _sound->stop();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::pause(bool freezePaused) {
+ if (_sound) {
+ _soundPaused = true;
+ if (freezePaused) {
+ _sound->_freezePaused = true;
+ }
+ return _sound->pause();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::resume() {
+ if (_sound && _soundPaused) {
+ _soundPaused = false;
+ return _sound->resume();
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::persist(BasePersistenceManager *persistMgr) {
+ if (persistMgr->getIsSaving() && _sound) {
+ _soundPlaying = _sound->isPlaying();
+ _soundLooping = _sound->_looping;
+ _soundPrivateVolume = _sound->_privateVolume;
+ if (_soundPlaying) {
+ _soundPosition = _sound->getPosition();
+ }
+ _soundLoopStart = _sound->_loopStart;
+ _soundFreezePaused = _sound->_freezePaused;
+ }
+
+ if (persistMgr->getIsSaving()) {
+ _sFXType = SFX_NONE;
+ _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
+ }
+
+ persistMgr->transfer(TMEMBER(_gameRef));
+
+ persistMgr->transfer(TMEMBER(_soundFilename));
+ persistMgr->transfer(TMEMBER(_soundLooping));
+ persistMgr->transfer(TMEMBER(_soundPaused));
+ persistMgr->transfer(TMEMBER(_soundFreezePaused));
+ persistMgr->transfer(TMEMBER(_soundPlaying));
+ persistMgr->transfer(TMEMBER(_soundPosition));
+ persistMgr->transfer(TMEMBER(_soundPrivateVolume));
+ persistMgr->transfer(TMEMBER(_soundStreamed));
+ persistMgr->transfer(TMEMBER_INT(_soundType));
+ persistMgr->transfer(TMEMBER(_soundLoopStart));
+
+ return STATUS_OK;
+}
+
+bool BaseSound::isPlaying() {
+ return _sound && _sound->isPlaying();
+}
+
+bool BaseSound::isPaused() {
+ return _sound && _soundPaused;
+}
+
+bool BaseSound::setPositionTime(uint32 time) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ }
+ _soundPosition = time;
+ bool ret = _sound->setPosition(_soundPosition);
+ if (_sound->isPlaying()) {
+ _soundPosition = 0;
+ }
+ return ret;
+}
+
+uint32 BaseSound::getPositionTime() {
+ if (!_sound) {
+ return 0;
+ }
+
+ if (!_sound->isPlaying()) {
+ return 0;
+ } else {
+ return _sound->getPosition();
+ }
+}
+
+bool BaseSound::setVolumePercent(int percent) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ return _sound->setPrivateVolume(percent * 255 / 100);
+ }
+}
+
+bool BaseSound::setVolume(int volume) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ return _sound->setPrivateVolume(volume);
+ }
+}
+
+bool BaseSound::setPrivateVolume(int volume) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ _sound->_privateVolume = volume;
+ return STATUS_OK;
+ }
+}
+
+int BaseSound::getVolumePercent() {
+ if (!_sound) {
+ return 0;
+ } else {
+ return _sound->_privateVolume * 100 / 255;
+ }
+}
+
+int BaseSound::getVolume() {
+ if (!_sound) {
+ return 0;
+ } else {
+ return _sound->_privateVolume;
+ }
+}
+
+bool BaseSound::setLoopStart(uint32 pos) {
+ if (!_sound) {
+ return STATUS_FAILED;
+ } else {
+ _sound->setLoopStart(pos);
+ return STATUS_OK;
+ }
+}
+
+bool BaseSound::setPan(float pan) {
+ if (_sound) {
+ return _sound->setPan(pan);
+ } else {
+ return STATUS_FAILED;
+ }
+}
+
+bool BaseSound::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
+ if (!_sound) {
+ return STATUS_OK;
+ }
+
+ if (type != _sFXType || param1 != _sFXParam1 || param2 != _sFXParam2 || param3 != _sFXParam3 || param4 != _sFXParam4) {
+ bool ret = _sound->applyFX(type, param1, param2, param3, param4);
+
+ _sFXType = type;
+ _sFXParam1 = param1;
+ _sFXParam2 = param2;
+ _sFXParam3 = param3;
+ _sFXParam4 = param4;
+
+ return ret;
+ }
+ return STATUS_OK;
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h
index d65757474a..637061b7cc 100644
--- a/engines/wintermute/base/sound/base_sound.h
+++ b/engines/wintermute/base/sound/base_sound.h
@@ -1,87 +1,87 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This file is based on WME Lite.
- * http://dead-code.org/redir.php?target=wmelite
- * Copyright (c) 2011 Jan Nedoma
- */
-
-#ifndef WINTERMUTE_BASE_SOUND_H
-#define WINTERMUTE_BASE_SOUND_H
-
-#include "engines/wintermute/base/base.h"
-#include "engines/wintermute/dctypes.h" // Added by ClassView
-#include "engines/wintermute/persistent.h"
-#include "audio/mixer.h"
-
-namespace Wintermute {
-
-class BaseSoundBuffer;
-class BaseSound : public BaseClass {
-public:
- bool setPan(float pan);
- int getVolume();
- int getVolumePercent();
- bool setVolumePercent(int percent);
- bool setVolume(int volume);
- bool setPrivateVolume(int volume);
- bool setLoopStart(uint32 pos);
- uint32 getPositionTime();
- bool setPositionTime(uint32 time);
- bool isPlaying();
- bool isPaused();
- DECLARE_PERSISTENT(BaseSound, BaseClass)
- bool resume();
- bool pause(bool freezePaused = false);
- bool stop();
- bool play(bool looping = false);
- uint32 getLength();
- const char *getFilename() { return _soundFilename.c_str(); }
- bool setSoundSimple();
- bool setSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
- BaseSound(BaseGame *inGame);
- virtual ~BaseSound();
-
- bool applyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0);
-private:
- Common::String _soundFilename;
- bool _soundStreamed;
- Audio::Mixer::SoundType _soundType;
- int _soundPrivateVolume;
- uint32 _soundLoopStart;
- uint32 _soundPosition;
- bool _soundPlaying;
- bool _soundLooping;
- bool _soundPaused;
- bool _soundFreezePaused;
- TSFXType _sFXType;
- float _sFXParam1;
- float _sFXParam2;
- float _sFXParam3;
- float _sFXParam4;
- BaseSoundBuffer *_sound;
-};
-
-} // end of namespace Wintermute
-
-#endif
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SOUND_H
+#define WINTERMUTE_BASE_SOUND_H
+
+#include "engines/wintermute/base/base.h"
+#include "engines/wintermute/dctypes.h" // Added by ClassView
+#include "engines/wintermute/persistent.h"
+#include "audio/mixer.h"
+
+namespace Wintermute {
+
+class BaseSoundBuffer;
+class BaseSound : public BaseClass {
+public:
+ bool setPan(float pan);
+ int getVolume();
+ int getVolumePercent();
+ bool setVolumePercent(int percent);
+ bool setVolume(int volume);
+ bool setPrivateVolume(int volume);
+ bool setLoopStart(uint32 pos);
+ uint32 getPositionTime();
+ bool setPositionTime(uint32 time);
+ bool isPlaying();
+ bool isPaused();
+ DECLARE_PERSISTENT(BaseSound, BaseClass)
+ bool resume();
+ bool pause(bool freezePaused = false);
+ bool stop();
+ bool play(bool looping = false);
+ uint32 getLength();
+ const char *getFilename() { return _soundFilename.c_str(); }
+ bool setSoundSimple();
+ bool setSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
+ BaseSound(BaseGame *inGame);
+ virtual ~BaseSound();
+
+ bool applyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0);
+private:
+ Common::String _soundFilename;
+ bool _soundStreamed;
+ Audio::Mixer::SoundType _soundType;
+ int _soundPrivateVolume;
+ uint32 _soundLoopStart;
+ uint32 _soundPosition;
+ bool _soundPlaying;
+ bool _soundLooping;
+ bool _soundPaused;
+ bool _soundFreezePaused;
+ TSFXType _sFXType;
+ float _sFXParam1;
+ float _sFXParam2;
+ float _sFXParam3;
+ float _sFXParam4;
+ BaseSoundBuffer *_sound;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp
index e2d9c8c13f..3fd6c4d5f2 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.cpp
+++ b/engines/wintermute/base/sound/base_sound_buffer.cpp
@@ -1,297 +1,297 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This file is based on WME Lite.
- * http://dead-code.org/redir.php?target=wmelite
- * Copyright (c) 2011 Jan Nedoma
- */
-
-#include "engines/wintermute/base/file/base_file.h"
-#include "engines/wintermute/base/base_game.h"
-#include "engines/wintermute/base/sound/base_sound_manager.h"
-#include "engines/wintermute/base/sound/base_sound_buffer.h"
-#include "engines/wintermute/base/base_file_manager.h"
-#include "engines/wintermute/utils/utils.h"
-#include "engines/wintermute/wintermute.h"
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/vorbis.h"
-#include "audio/decoders/wave.h"
-#include "audio/decoders/raw.h"
-#include "common/system.h"
-#include "common/substream.h"
-
-namespace Wintermute {
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-#define MAX_NONSTREAMED_FILE_SIZE 1024*1024
-
-//////////////////////////////////////////////////////////////////////////
-BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame) : BaseClass(inGame) {
- _stream = NULL;
- _handle = NULL;
-// _sync = NULL;
-
- _streamed = false;
- _filename = "";
- _file = NULL;
- _privateVolume = 255;
- _volume = 255;
-
- _looping = false;
- _loopStart = 0;
- _startPos = 0;
-
- _type = Audio::Mixer::kSFXSoundType;
-
- _freezePaused = false;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-BaseSoundBuffer::~BaseSoundBuffer() {
- stop();
-
- if (_handle) {
- g_system->getMixer()->stopHandle(*_handle);
- delete _handle;
- _handle = NULL;
- }
- delete _stream;
- _stream = NULL;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void BaseSoundBuffer::setStreaming(bool streamed, uint32 numBlocks, uint32 blockSize) {
- _streamed = streamed;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::loadFromFile(const Common::String &filename, bool forceReload) {
- debugC(kWintermuteDebugAudio, "BSoundBuffer::LoadFromFile(%s,%d)", filename.c_str(), forceReload);
-
- // Load a file, but avoid having the File-manager handle the disposal of it.
- _file = BaseFileManager::getEngineInstance()->openFile(filename, true, false);
- if (!_file) {
- _gameRef->LOG(0, "Error opening sound file '%s'", filename.c_str());
- return STATUS_FAILED;
- }
- Common::String strFilename(filename);
- strFilename.toLowercase();
- if (strFilename.hasSuffix(".ogg")) {
- _stream = Audio::makeVorbisStream(_file, DisposeAfterUse::YES);
- } else if (strFilename.hasSuffix(".wav")) {
- int waveSize, waveRate;
- byte waveFlags;
- uint16 waveType;
-
- if (Audio::loadWAVFromStream(*_file, waveSize, waveRate, waveFlags, &waveType)) {
- if (waveType == 1) {
- // We need to wrap the file in a substream to make sure the size is right.
- _file = new Common::SeekableSubReadStream(_file, 0, waveSize);
- _stream = Audio::makeRawStream(_file, waveRate, waveFlags, DisposeAfterUse::YES);
- } else {
- error("BSoundBuffer::LoadFromFile - WAVE not supported yet for %s with type %d", filename.c_str(), waveType);
- }
- }
- } else {
- error("BSoundBuffer::LoadFromFile - Unknown filetype for %s", filename.c_str());
- }
- if (!_stream) {
- return STATUS_FAILED;
- }
- _filename = filename;
-
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::play(bool looping, uint32 startSample) {
- if (_handle) {
- g_system->getMixer()->stopHandle(*_handle);
- delete _handle;
- _handle = NULL;
- }
- // Store the loop-value for save-games.
- setLooping(looping);
- if (_stream) {
- _stream->seek(startSample);
- _handle = new Audio::SoundHandle;
- if (_looping) {
- Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
- g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, 0, DisposeAfterUse::YES);
- } else {
- g_system->getMixer()->playStream(_type, _handle, _stream, -1, _volume, 0, DisposeAfterUse::NO);
- }
- }
-
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void BaseSoundBuffer::setLooping(bool looping) {
- if (isPlaying()) {
- // This warning is here, to see if this is ever the case.
- warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); // TODO
- }
- _looping = looping;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::resume() {
- // If the sound was paused while active:
- if (_stream && _handle) {
- g_system->getMixer()->pauseHandle(*_handle, false);
- } else if (_stream) { // Otherwise we come from a savegame, and thus have no handle
- play(_looping, _startPos);
- } else {
- warning("BaseSoundBuffer::resume - Called without a handle or a stream");
- }
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::stop() {
- if (_stream && _handle) {
- g_system->getMixer()->stopHandle(*_handle);
- }
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::pause() {
- if (_stream && _handle) {
- g_system->getMixer()->pauseHandle(*_handle, true);
- }
- return STATUS_OK;
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-uint32 BaseSoundBuffer::getLength() {
- if (_stream) {
- uint32 len = _stream->getLength().msecs();
- return len * 1000;
- }
- return 0;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void BaseSoundBuffer::setType(Audio::Mixer::SoundType type) {
- _type = type;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void BaseSoundBuffer::updateVolume() {
- setVolume(_privateVolume);
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::setVolume(int volume) {
- _volume = volume * _gameRef->_soundMgr->getMasterVolume() / 255;
- if (_stream && _handle) {
- byte vol = (byte)(_volume);
- g_system->getMixer()->setChannelVolume(*_handle, vol);
- }
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::setPrivateVolume(int volume) {
- _privateVolume = volume;
- return setVolume(_privateVolume);
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::isPlaying() {
- if (_stream && _handle) {
- return _freezePaused || g_system->getMixer()->isSoundHandleActive(*_handle);
- } else {
- return false;
- }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-uint32 BaseSoundBuffer::getPosition() {
- if (_stream && _handle) {
- uint32 pos = g_system->getMixer()->getSoundElapsedTime(*_handle);
- return pos;
- }
- return 0;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::setPosition(uint32 pos) {
- if (isPlaying()) {
- warning("BaseSoundBuffer::SetPosition - not implemented for playing sounds yet.");
- }
- _startPos = pos;
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::setLoopStart(uint32 pos) {
- _loopStart = pos;
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::setPan(float pan) {
- if (_handle) {
- g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127));
- }
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
- // This function was already stubbed out in WME Lite, and thus isn't reimplemented here either.
- switch (type) {
- case SFX_ECHO:
- //warning("BaseSoundBuffer::ApplyFX(SFX_ECHO, %f, %f, %f, %f) - not implemented yet", param1, param2, param3, param4);
- break;
-
- case SFX_REVERB:
- //warning("BaseSoundBuffer::ApplyFX(SFX_REVERB, %f, %f, %f, %f) - not implemented yet", param1, param2, param3, param4);
- break;
-
- default:
- break;
- }
- return STATUS_OK;
-}
-
-} // end of namespace Wintermute
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/file/base_file.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/sound/base_sound_buffer.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/wintermute.h"
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
+#include "audio/decoders/vorbis.h"
+#include "audio/decoders/wave.h"
+#include "audio/decoders/raw.h"
+#include "common/system.h"
+#include "common/substream.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+#define MAX_NONSTREAMED_FILE_SIZE 1024*1024
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundBuffer::BaseSoundBuffer(BaseGame *inGame) : BaseClass(inGame) {
+ _stream = NULL;
+ _handle = NULL;
+// _sync = NULL;
+
+ _streamed = false;
+ _filename = "";
+ _file = NULL;
+ _privateVolume = 255;
+ _volume = 255;
+
+ _looping = false;
+ _loopStart = 0;
+ _startPos = 0;
+
+ _type = Audio::Mixer::kSFXSoundType;
+
+ _freezePaused = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundBuffer::~BaseSoundBuffer() {
+ stop();
+
+ if (_handle) {
+ g_system->getMixer()->stopHandle(*_handle);
+ delete _handle;
+ _handle = NULL;
+ }
+ delete _stream;
+ _stream = NULL;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::setStreaming(bool streamed, uint32 numBlocks, uint32 blockSize) {
+ _streamed = streamed;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::loadFromFile(const Common::String &filename, bool forceReload) {
+ debugC(kWintermuteDebugAudio, "BSoundBuffer::LoadFromFile(%s,%d)", filename.c_str(), forceReload);
+
+ // Load a file, but avoid having the File-manager handle the disposal of it.
+ _file = BaseFileManager::getEngineInstance()->openFile(filename, true, false);
+ if (!_file) {
+ _gameRef->LOG(0, "Error opening sound file '%s'", filename.c_str());
+ return STATUS_FAILED;
+ }
+ Common::String strFilename(filename);
+ strFilename.toLowercase();
+ if (strFilename.hasSuffix(".ogg")) {
+ _stream = Audio::makeVorbisStream(_file, DisposeAfterUse::YES);
+ } else if (strFilename.hasSuffix(".wav")) {
+ int waveSize, waveRate;
+ byte waveFlags;
+ uint16 waveType;
+
+ if (Audio::loadWAVFromStream(*_file, waveSize, waveRate, waveFlags, &waveType)) {
+ if (waveType == 1) {
+ // We need to wrap the file in a substream to make sure the size is right.
+ _file = new Common::SeekableSubReadStream(_file, 0, waveSize);
+ _stream = Audio::makeRawStream(_file, waveRate, waveFlags, DisposeAfterUse::YES);
+ } else {
+ error("BSoundBuffer::LoadFromFile - WAVE not supported yet for %s with type %d", filename.c_str(), waveType);
+ }
+ }
+ } else {
+ error("BSoundBuffer::LoadFromFile - Unknown filetype for %s", filename.c_str());
+ }
+ if (!_stream) {
+ return STATUS_FAILED;
+ }
+ _filename = filename;
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::play(bool looping, uint32 startSample) {
+ if (_handle) {
+ g_system->getMixer()->stopHandle(*_handle);
+ delete _handle;
+ _handle = NULL;
+ }
+ // Store the loop-value for save-games.
+ setLooping(looping);
+ if (_stream) {
+ _stream->seek(startSample);
+ _handle = new Audio::SoundHandle;
+ if (_looping) {
+ Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
+ g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, 0, DisposeAfterUse::YES);
+ } else {
+ g_system->getMixer()->playStream(_type, _handle, _stream, -1, _volume, 0, DisposeAfterUse::NO);
+ }
+ }
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::setLooping(bool looping) {
+ if (isPlaying()) {
+ // This warning is here, to see if this is ever the case.
+ warning("BSoundBuffer::SetLooping(%d) - won't change a playing sound", looping); // TODO
+ }
+ _looping = looping;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::resume() {
+ // If the sound was paused while active:
+ if (_stream && _handle) {
+ g_system->getMixer()->pauseHandle(*_handle, false);
+ } else if (_stream) { // Otherwise we come from a savegame, and thus have no handle
+ play(_looping, _startPos);
+ } else {
+ warning("BaseSoundBuffer::resume - Called without a handle or a stream");
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::stop() {
+ if (_stream && _handle) {
+ g_system->getMixer()->stopHandle(*_handle);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::pause() {
+ if (_stream && _handle) {
+ g_system->getMixer()->pauseHandle(*_handle, true);
+ }
+ return STATUS_OK;
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseSoundBuffer::getLength() {
+ if (_stream) {
+ uint32 len = _stream->getLength().msecs();
+ return len * 1000;
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::setType(Audio::Mixer::SoundType type) {
+ _type = type;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundBuffer::updateVolume() {
+ setVolume(_privateVolume);
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setVolume(int volume) {
+ _volume = volume * _gameRef->_soundMgr->getMasterVolume() / 255;
+ if (_stream && _handle) {
+ byte vol = (byte)(_volume);
+ g_system->getMixer()->setChannelVolume(*_handle, vol);
+ }
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setPrivateVolume(int volume) {
+ _privateVolume = volume;
+ return setVolume(_privateVolume);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::isPlaying() {
+ if (_stream && _handle) {
+ return _freezePaused || g_system->getMixer()->isSoundHandleActive(*_handle);
+ } else {
+ return false;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 BaseSoundBuffer::getPosition() {
+ if (_stream && _handle) {
+ uint32 pos = g_system->getMixer()->getSoundElapsedTime(*_handle);
+ return pos;
+ }
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setPosition(uint32 pos) {
+ if (isPlaying()) {
+ warning("BaseSoundBuffer::SetPosition - not implemented for playing sounds yet.");
+ }
+ _startPos = pos;
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setLoopStart(uint32 pos) {
+ _loopStart = pos;
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::setPan(float pan) {
+ if (_handle) {
+ g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127));
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
+ // This function was already stubbed out in WME Lite, and thus isn't reimplemented here either.
+ switch (type) {
+ case SFX_ECHO:
+ //warning("BaseSoundBuffer::ApplyFX(SFX_ECHO, %f, %f, %f, %f) - not implemented yet", param1, param2, param3, param4);
+ break;
+
+ case SFX_REVERB:
+ //warning("BaseSoundBuffer::ApplyFX(SFX_REVERB, %f, %f, %f, %f) - not implemented yet", param1, param2, param3, param4);
+ break;
+
+ default:
+ break;
+ }
+ return STATUS_OK;
+}
+
+} // 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 29402ee76e..9c39f4c34b 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.h
+++ b/engines/wintermute/base/sound/base_sound_buffer.h
@@ -1,100 +1,100 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This file is based on WME Lite.
- * http://dead-code.org/redir.php?target=wmelite
- * Copyright (c) 2011 Jan Nedoma
- */
-
-#ifndef WINTERMUTE_BASE_SOUNDBUFFER_H
-#define WINTERMUTE_BASE_SOUNDBUFFER_H
-
-
-#include "engines/wintermute/base/base.h"
-#include "audio/mixer.h"
-#include "common/stream.h"
-
-namespace Audio {
-class SeekableAudioStream;
-class SoundHandle;
-}
-
-namespace Wintermute {
-
-class BaseFile;
-class BaseSoundBuffer : public BaseClass {
-public:
-
- BaseSoundBuffer(BaseGame *inGame);
- virtual ~BaseSoundBuffer();
-
- bool pause();
- bool play(bool looping = false, uint32 startSample = 0);
- bool resume();
- bool stop();
- bool isPlaying();
-
- void setLooping(bool looping);
-
- uint32 getPosition();
- bool setPosition(uint32 pos);
- uint32 getLength();
-
- bool setLoopStart(uint32 pos);
- uint32 getLoopStart() const {
- return _loopStart;
- }
-
- bool setPan(float pan);
- bool setPrivateVolume(int colume);
- bool setVolume(int colume);
- void updateVolume();
-
- void setType(Audio::Mixer::SoundType Type);
-
- 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);
-
- //HSTREAM _stream;
- //HSYNC _sync;
- Audio::SeekableAudioStream *_stream;
- Audio::SoundHandle *_handle;
-
- bool _freezePaused;
- uint32 _loopStart;
- Audio::Mixer::SoundType _type;
- bool _looping;
-
- int _privateVolume;
-private:
- uint32 _startPos;
- Common::String _filename;
- bool _streamed;
- Common::SeekableReadStream *_file;
- int _volume;
-};
-
-} // end of namespace Wintermute
-
-#endif
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SOUNDBUFFER_H
+#define WINTERMUTE_BASE_SOUNDBUFFER_H
+
+
+#include "engines/wintermute/base/base.h"
+#include "audio/mixer.h"
+#include "common/stream.h"
+
+namespace Audio {
+class SeekableAudioStream;
+class SoundHandle;
+}
+
+namespace Wintermute {
+
+class BaseFile;
+class BaseSoundBuffer : public BaseClass {
+public:
+
+ BaseSoundBuffer(BaseGame *inGame);
+ virtual ~BaseSoundBuffer();
+
+ bool pause();
+ bool play(bool looping = false, uint32 startSample = 0);
+ bool resume();
+ bool stop();
+ bool isPlaying();
+
+ void setLooping(bool looping);
+
+ uint32 getPosition();
+ bool setPosition(uint32 pos);
+ uint32 getLength();
+
+ bool setLoopStart(uint32 pos);
+ uint32 getLoopStart() const {
+ return _loopStart;
+ }
+
+ bool setPan(float pan);
+ bool setPrivateVolume(int colume);
+ bool setVolume(int colume);
+ void updateVolume();
+
+ void setType(Audio::Mixer::SoundType Type);
+
+ 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);
+
+ //HSTREAM _stream;
+ //HSYNC _sync;
+ Audio::SeekableAudioStream *_stream;
+ Audio::SoundHandle *_handle;
+
+ bool _freezePaused;
+ uint32 _loopStart;
+ Audio::Mixer::SoundType _type;
+ bool _looping;
+
+ int _privateVolume;
+private:
+ uint32 _startPos;
+ Common::String _filename;
+ bool _streamed;
+ Common::SeekableReadStream *_file;
+ int _volume;
+};
+
+} // end of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index 2bfe0499f9..f7788cd255 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -1,282 +1,282 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This file is based on WME Lite.
- * http://dead-code.org/redir.php?target=wmelite
- * Copyright (c) 2011 Jan Nedoma
- */
-
-#include "engines/wintermute/base/sound/base_sound_manager.h"
-#include "engines/wintermute/base/base_engine.h"
-#include "engines/wintermute/utils/path_util.h"
-#include "engines/wintermute/utils/string_util.h"
-#include "engines/wintermute/base/base_game.h"
-#include "engines/wintermute/base/base_file_manager.h"
-#include "engines/wintermute/base/sound/base_sound_buffer.h"
-#include "engines/wintermute/wintermute.h"
-#include "common/config-manager.h"
-#include "audio/mixer.h"
-
-namespace Wintermute {
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-//IMPLEMENT_PERSISTENT(BaseSoundMgr, true);
-
-//////////////////////////////////////////////////////////////////////////
-BaseSoundMgr::BaseSoundMgr(BaseGame *inGame) : BaseClass(inGame) {
- _soundAvailable = false;
- _volumeMaster = 255;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-BaseSoundMgr::~BaseSoundMgr() {
- saveSettings();
- cleanup();
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::cleanup() {
- for (uint32 i = 0; i < _sounds.size(); i++) {
- delete _sounds[i];
- }
- _sounds.clear();
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void BaseSoundMgr::saveSettings() {
- if (_soundAvailable) {
- ConfMan.setInt("master_volume", _volumeMaster);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::initialize() {
- _soundAvailable = false;
-
- if (!g_system->getMixer()->isReady()) {
- return STATUS_FAILED;
- }
- _volumeMaster = (ConfMan.hasKey("master_volume") ? ConfMan.getInt("master_volume") : 255);
- _soundAvailable = true;
-
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) {
- if (!_soundAvailable) {
- return NULL;
- }
-
- BaseSoundBuffer *sound;
-
- Common::String useFilename = filename;
- // try to switch WAV to OGG file (if available)
- AnsiString ext = PathUtil::getExtension(filename);
- if (StringUtil::compareNoCase(ext, "wav")) {
- AnsiString path = PathUtil::getDirectoryName(filename);
- AnsiString name = PathUtil::getFileNameWithoutExtension(filename);
-
- AnsiString newFile = PathUtil::combine(path, name + "ogg");
- if (BaseFileManager::getEngineInstance()->hasFile(newFile)) {
- useFilename = newFile;
- }
- }
-
- sound = new BaseSoundBuffer(_gameRef);
- if (!sound) {
- return NULL;
- }
-
- sound->setStreaming(streamed);
- sound->setType(type);
-
-
- bool res = sound->loadFromFile(useFilename);
- if (DID_FAIL(res)) {
- _gameRef->LOG(res, "Error loading sound '%s'", useFilename.c_str());
- delete sound;
- return NULL;
- }
-
- // Make sure the master-volume is applied to the sound.
- sound->updateVolume();
-
- // register sound
- _sounds.push_back(sound);
-
- return sound;
-
- return NULL;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type) {
- if (!sound) {
- return STATUS_FAILED;
- }
-
- // Make sure the master-volume is applied to the sound.
- sound->updateVolume();
-
- // register sound
- _sounds.push_back(sound);
-
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::removeSound(BaseSoundBuffer *sound) {
- for (uint32 i = 0; i < _sounds.size(); i++) {
- if (_sounds[i] == sound) {
- delete _sounds[i];
- _sounds.remove_at(i);
- return STATUS_OK;
- }
- }
-
- return STATUS_FAILED;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) {
- if (!_soundAvailable) {
- return STATUS_OK;
- }
-
- switch (type) {
- case Audio::Mixer::kSFXSoundType:
- ConfMan.setInt("sfx_volume", volume);
- break;
- case Audio::Mixer::kSpeechSoundType:
- ConfMan.setInt("speech_volume", volume);
- break;
- case Audio::Mixer::kMusicSoundType:
- ConfMan.setInt("music_volume", volume);
- break;
- case Audio::Mixer::kPlainSoundType:
- error("Plain sound type shouldn't be used in WME");
- }
- g_engine->syncSoundSettings();
-
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) {
- return setVolume(type, percent * 255 / 100);
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-byte BaseSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) {
- int volume = 0;
-
- switch (type) {
- case Audio::Mixer::kSFXSoundType:
- case Audio::Mixer::kSpeechSoundType:
- case Audio::Mixer::kMusicSoundType:
- volume = g_system->getMixer()->getVolumeForSoundType(type);
- break;
- default:
- error("Sound-type not set");
- break;
- }
-
- return (byte)(volume * 100 / 255);
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::setMasterVolume(byte value) {
- _volumeMaster = value;
- for (uint32 i = 0; i < _sounds.size(); i++) {
- _sounds[i]->updateVolume();
- }
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::setMasterVolumePercent(byte percent) {
- setMasterVolume(percent * 255 / 100);
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-byte BaseSoundMgr::getMasterVolumePercent() {
- return getMasterVolume() * 100 / 255;
-}
-
-//////////////////////////////////////////////////////////////////////////
-byte BaseSoundMgr::getMasterVolume() {
- return (byte)_volumeMaster;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::pauseAll(bool includingMusic) {
-
- for (uint32 i = 0; i < _sounds.size(); i++) {
- if (_sounds[i]->isPlaying() && (_sounds[i]->_type != Audio::Mixer::kMusicSoundType || includingMusic)) {
- _sounds[i]->pause();
- _sounds[i]->_freezePaused = true;
- }
- }
-
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseSoundMgr::resumeAll() {
-
- for (uint32 i = 0; i < _sounds.size(); i++) {
- if (_sounds[i]->_freezePaused) {
- _sounds[i]->resume();
- _sounds[i]->_freezePaused = false;
- }
- }
-
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-float BaseSoundMgr::posToPan(int x, int y) {
- float relPos = (float)x / ((float)_gameRef->_renderer->_width);
-
- float minPan = -0.7f;
- float maxPan = 0.7f;
-
- return minPan + relPos * (maxPan - minPan);
-}
-
-} // end of namespace Wintermute
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/base/sound/base_sound_manager.h"
+#include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/utils/path_util.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/base/sound/base_sound_buffer.h"
+#include "engines/wintermute/wintermute.h"
+#include "common/config-manager.h"
+#include "audio/mixer.h"
+
+namespace Wintermute {
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+//IMPLEMENT_PERSISTENT(BaseSoundMgr, true);
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundMgr::BaseSoundMgr(BaseGame *inGame) : BaseClass(inGame) {
+ _soundAvailable = false;
+ _volumeMaster = 255;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundMgr::~BaseSoundMgr() {
+ saveSettings();
+ cleanup();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::cleanup() {
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ delete _sounds[i];
+ }
+ _sounds.clear();
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void BaseSoundMgr::saveSettings() {
+ if (_soundAvailable) {
+ ConfMan.setInt("master_volume", _volumeMaster);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::initialize() {
+ _soundAvailable = false;
+
+ if (!g_system->getMixer()->isReady()) {
+ return STATUS_FAILED;
+ }
+ _volumeMaster = (ConfMan.hasKey("master_volume") ? ConfMan.getInt("master_volume") : 255);
+ _soundAvailable = true;
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::Mixer::SoundType type, bool streamed) {
+ if (!_soundAvailable) {
+ return NULL;
+ }
+
+ BaseSoundBuffer *sound;
+
+ Common::String useFilename = filename;
+ // try to switch WAV to OGG file (if available)
+ AnsiString ext = PathUtil::getExtension(filename);
+ if (StringUtil::compareNoCase(ext, "wav")) {
+ AnsiString path = PathUtil::getDirectoryName(filename);
+ AnsiString name = PathUtil::getFileNameWithoutExtension(filename);
+
+ AnsiString newFile = PathUtil::combine(path, name + "ogg");
+ if (BaseFileManager::getEngineInstance()->hasFile(newFile)) {
+ useFilename = newFile;
+ }
+ }
+
+ sound = new BaseSoundBuffer(_gameRef);
+ if (!sound) {
+ return NULL;
+ }
+
+ sound->setStreaming(streamed);
+ sound->setType(type);
+
+
+ bool res = sound->loadFromFile(useFilename);
+ if (DID_FAIL(res)) {
+ _gameRef->LOG(res, "Error loading sound '%s'", useFilename.c_str());
+ delete sound;
+ return NULL;
+ }
+
+ // Make sure the master-volume is applied to the sound.
+ sound->updateVolume();
+
+ // register sound
+ _sounds.push_back(sound);
+
+ return sound;
+
+ return NULL;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type) {
+ if (!sound) {
+ return STATUS_FAILED;
+ }
+
+ // Make sure the master-volume is applied to the sound.
+ sound->updateVolume();
+
+ // register sound
+ _sounds.push_back(sound);
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::removeSound(BaseSoundBuffer *sound) {
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ if (_sounds[i] == sound) {
+ delete _sounds[i];
+ _sounds.remove_at(i);
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_FAILED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) {
+ if (!_soundAvailable) {
+ return STATUS_OK;
+ }
+
+ switch (type) {
+ case Audio::Mixer::kSFXSoundType:
+ ConfMan.setInt("sfx_volume", volume);
+ break;
+ case Audio::Mixer::kSpeechSoundType:
+ ConfMan.setInt("speech_volume", volume);
+ break;
+ case Audio::Mixer::kMusicSoundType:
+ ConfMan.setInt("music_volume", volume);
+ break;
+ case Audio::Mixer::kPlainSoundType:
+ error("Plain sound type shouldn't be used in WME");
+ }
+ g_engine->syncSoundSettings();
+
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) {
+ return setVolume(type, percent * 255 / 100);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+byte BaseSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) {
+ int volume = 0;
+
+ switch (type) {
+ case Audio::Mixer::kSFXSoundType:
+ case Audio::Mixer::kSpeechSoundType:
+ case Audio::Mixer::kMusicSoundType:
+ volume = g_system->getMixer()->getVolumeForSoundType(type);
+ break;
+ default:
+ error("Sound-type not set");
+ break;
+ }
+
+ return (byte)(volume * 100 / 255);
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setMasterVolume(byte value) {
+ _volumeMaster = value;
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ _sounds[i]->updateVolume();
+ }
+ return STATUS_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::setMasterVolumePercent(byte percent) {
+ setMasterVolume(percent * 255 / 100);
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+byte BaseSoundMgr::getMasterVolumePercent() {
+ return getMasterVolume() * 100 / 255;
+}
+
+//////////////////////////////////////////////////////////////////////////
+byte BaseSoundMgr::getMasterVolume() {
+ return (byte)_volumeMaster;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::pauseAll(bool includingMusic) {
+
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ if (_sounds[i]->isPlaying() && (_sounds[i]->_type != Audio::Mixer::kMusicSoundType || includingMusic)) {
+ _sounds[i]->pause();
+ _sounds[i]->_freezePaused = true;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+bool BaseSoundMgr::resumeAll() {
+
+ for (uint32 i = 0; i < _sounds.size(); i++) {
+ if (_sounds[i]->_freezePaused) {
+ _sounds[i]->resume();
+ _sounds[i]->_freezePaused = false;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+float BaseSoundMgr::posToPan(int x, int y) {
+ float relPos = (float)x / ((float)_gameRef->_renderer->_width);
+
+ float minPan = -0.7f;
+ float maxPan = 0.7f;
+
+ return minPan + relPos * (maxPan - minPan);
+}
+
+} // end of namespace Wintermute
diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h
index d0b782b2b7..36a729b5ae 100644
--- a/engines/wintermute/base/sound/base_sound_manager.h
+++ b/engines/wintermute/base/sound/base_sound_manager.h
@@ -1,68 +1,68 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This file is based on WME Lite.
- * http://dead-code.org/redir.php?target=wmelite
- * Copyright (c) 2011 Jan Nedoma
- */
-
-#ifndef WINTERMUTE_BASE_SOUNDMGR_H
-#define WINTERMUTE_BASE_SOUNDMGR_H
-
-#include "engines/wintermute/coll_templ.h"
-#include "engines/wintermute/base/base.h"
-#include "audio/mixer.h"
-#include "common/array.h"
-
-namespace Wintermute {
-class BaseSoundBuffer;
-class BaseSoundMgr : public BaseClass {
-public:
- float posToPan(int x, int y);
- bool resumeAll();
- bool pauseAll(bool includingMusic = true);
- bool cleanup();
- //DECLARE_PERSISTENT(BaseSoundMgr, BaseClass);
- byte getMasterVolumePercent();
- byte getMasterVolume();
- bool setMasterVolume(byte percent);
- bool setMasterVolumePercent(byte percent);
- byte getVolumePercent(Audio::Mixer::SoundType type);
- bool setVolumePercent(Audio::Mixer::SoundType type, byte percent);
- bool setVolume(Audio::Mixer::SoundType type, int volume);
- uint32 _volumeOriginal;
- int _volumeMaster;
- bool removeSound(BaseSoundBuffer *sound);
- BaseSoundBuffer *addSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
- bool addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType);
- bool initialize();
- bool _soundAvailable;
- BaseSoundMgr(BaseGame *inGame);
- virtual ~BaseSoundMgr();
- Common::Array<BaseSoundBuffer *> _sounds;
- void saveSettings();
-};
-
-} // end of namespace Wintermute
-
-#endif
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_BASE_SOUNDMGR_H
+#define WINTERMUTE_BASE_SOUNDMGR_H
+
+#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/base/base.h"
+#include "audio/mixer.h"
+#include "common/array.h"
+
+namespace Wintermute {
+class BaseSoundBuffer;
+class BaseSoundMgr : public BaseClass {
+public:
+ float posToPan(int x, int y);
+ bool resumeAll();
+ bool pauseAll(bool includingMusic = true);
+ bool cleanup();
+ //DECLARE_PERSISTENT(BaseSoundMgr, BaseClass);
+ byte getMasterVolumePercent();
+ byte getMasterVolume();
+ bool setMasterVolume(byte percent);
+ bool setMasterVolumePercent(byte percent);
+ byte getVolumePercent(Audio::Mixer::SoundType type);
+ bool setVolumePercent(Audio::Mixer::SoundType type, byte percent);
+ bool setVolume(Audio::Mixer::SoundType type, int volume);
+ uint32 _volumeOriginal;
+ int _volumeMaster;
+ bool removeSound(BaseSoundBuffer *sound);
+ BaseSoundBuffer *addSound(const Common::String &filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false);
+ bool addSound(BaseSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType);
+ bool initialize();
+ bool _soundAvailable;
+ BaseSoundMgr(BaseGame *inGame);
+ virtual ~BaseSoundMgr();
+ Common::Array<BaseSoundBuffer *> _sounds;
+ void saveSettings();
+};
+
+} // end of namespace Wintermute
+
+#endif