From e9269257f3da947eca3fb167b279fbe91650157a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 24 Dec 2003 00:25:18 +0000 Subject: turned PlayingSoundHandle into an 'opaque' (well not really :-) data type, mainly because people kept (accidentally and sometimes on purpose :-) misusing them svn-id: r11881 --- sword2/driver/d_draw.cpp | 4 ++-- sword2/driver/d_sound.cpp | 12 ++++++------ sword2/driver/d_sound.h | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'sword2') 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 { -- cgit v1.2.3