aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorMax Horn2003-12-24 00:25:18 +0000
committerMax Horn2003-12-24 00:25:18 +0000
commite9269257f3da947eca3fb167b279fbe91650157a (patch)
tree62784e4ce6a708398f018855b6d672de6b0345db /sword2
parent3f77642948a824e6e198c93a455fbf3fbab7e507 (diff)
downloadscummvm-rg350-e9269257f3da947eca3fb167b279fbe91650157a.tar.gz
scummvm-rg350-e9269257f3da947eca3fb167b279fbe91650157a.tar.bz2
scummvm-rg350-e9269257f3da947eca3fb167b279fbe91650157a.zip
turned PlayingSoundHandle into an 'opaque' (well not really :-) data type, mainly because people kept (accidentally and sometimes on purpose :-) misusing them
svn-id: r11881
Diffstat (limited to 'sword2')
-rw-r--r--sword2/driver/d_draw.cpp4
-rw-r--r--sword2/driver/d_sound.cpp12
-rw-r--r--sword2/driver/d_sound.h3
3 files changed, 10 insertions, 9 deletions
diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp
index 730abd109b..928de7bf71 100644
--- a/sword2/driver/d_draw.cpp
+++ b/sword2/driver/d_draw.cpp
@@ -173,7 +173,7 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu
tmpPal[255 * 4 + 2] = 255;
_vm->_graphics->setPalette(0, 256, tmpPal, RDPAL_INSTANT);
- PlayingSoundHandle handle = 0;
+ PlayingSoundHandle handle;
bool skipCutscene = false;
@@ -226,7 +226,7 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu
// more importantly - that we don't free the sound buffer while
// it's in use.
- while (handle) {
+ while (handle.isActive()) {
_vm->_system->delay_msecs(100);
};
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 7bee4eceaf..082161f7c9 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -35,6 +35,7 @@
#include "common/stdafx.h"
#include "common/file.h"
#include "sword2/sword2.h"
+#include "sound/rate.h"
namespace Sword2 {
@@ -132,7 +133,6 @@ Sound::Sound(Sword2Engine *vm) {
memset(_fx, 0, sizeof(_fx));
- _soundHandleSpeech = 0;
_soundOn = true;
_converter = makeRateConverter(_music[0].getRate(), _vm->_mixer->getOutputRate(), _music[0].isStereo(), false);
@@ -243,7 +243,7 @@ void Sound::playLeadOut(uint8 *leadOut) {
return;
}
- while (_fx[i]._handle) {
+ while (_fx[i]._handle.isActive()) {
_vm->_graphics->updateDisplay();
_vm->_system->delay_msecs(30);
}
@@ -284,7 +284,7 @@ void Sound::fxServer(int16 *data, uint len) {
*/
int32 Sound::amISpeaking() {
- if (!_speechMuted && !_speechPaused && _soundHandleSpeech != 0)
+ if (!_speechMuted && !_speechPaused && _soundHandleSpeech.isActive())
return RDSE_SPEAKING;
return RDSE_QUIET;
@@ -441,7 +441,7 @@ int32 Sound::getSpeechStatus(void) {
if (_speechPaused)
return RDSE_SAMPLEPLAYING;
- if (!_soundHandleSpeech) {
+ if (!_soundHandleSpeech.isActive()) {
_speechStatus = false;
return RDSE_SAMPLEFINISHED;
}
@@ -459,7 +459,7 @@ void Sound::setSpeechVolume(uint8 volume) {
_speechVol = volume;
- if (_soundHandleSpeech != 0 && !_speechMuted && getSpeechStatus() == RDSE_SAMPLEPLAYING) {
+ if (_soundHandleSpeech.isActive() && !_speechMuted && getSpeechStatus() == RDSE_SAMPLEPLAYING) {
_vm->_mixer->setChannelVolume(_soundHandleSpeech, 16 * _speechVol);
}
}
@@ -558,7 +558,7 @@ int32 Sound::openFx(int32 id, uint8 *data) {
// between rooms.
for (fxi = 0; fxi < MAXFX; fxi++) {
- if (!_fx[fxi]._handle)
+ if (!_fx[fxi]._handle.isActive())
break;
}
diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h
index a62054853d..068376164d 100644
--- a/sword2/driver/d_sound.h
+++ b/sword2/driver/d_sound.h
@@ -22,7 +22,8 @@
#include "sound/audiostream.h"
#include "sound/mixer.h"
-#include "sound/rate.h"
+
+class RateConverter;
namespace Sword2 {