aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
Diffstat (limited to 'sword2')
-rw-r--r--sword2/driver/animation.cpp18
-rw-r--r--sword2/driver/animation.h2
-rw-r--r--sword2/driver/d_sound.cpp10
-rw-r--r--sword2/sound.cpp9
-rw-r--r--sword2/sound.h6
5 files changed, 22 insertions, 23 deletions
diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp
index 90da608e69..4dd939be5b 100644
--- a/sword2/driver/animation.cpp
+++ b/sword2/driver/animation.cpp
@@ -167,7 +167,7 @@ void MoviePlayer::drawTextObject(AnimationState *anim, MovieTextObject *obj) {
*/
int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 leadInRes, int32 leadOutRes) {
- PlayingSoundHandle leadInHandle;
+ SoundHandle leadInHandle;
// This happens if the user quits during the "eye" smacker
if (_vm->_quit)
@@ -205,10 +205,10 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 lea
playDummy(filename, text, leadOut, leadOutLen);
#endif
- _vm->_mixer->stopHandle(leadInHandle);
+ _snd->stopHandle(leadInHandle);
// Wait for the lead-out to stop, if there is any.
- while (_leadOutHandle.isActive()) {
+ while (_vm->_mixer->isSoundHandleActive(_leadOutHandle)) {
_vm->_screen->updateDisplay();
_vm->_system->delayMillis(30);
}
@@ -224,7 +224,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 lea
void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *leadOut, uint32 leadOutLen) {
uint frameCounter = 0, textCounter = 0;
- PlayingSoundHandle handle;
+ SoundHandle handle;
bool skipCutscene = false, textVisible = false;
uint32 flags = SoundMixer::FLAG_16BITS;
bool startNextText = false;
@@ -282,7 +282,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
}
}
- if (startNextText && !handle.isActive()) {
+ if (startNextText && !_snd->isSoundHandleActive(handle)) {
_snd->playRaw(&handle, text[textCounter]->speech, text[textCounter]->speechBufferSize, 22050, flags);
startNextText = false;
}
@@ -339,7 +339,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
// If the speech is still playing, redraw the subtitles. At least in
// the English version this is most noticeable in the "carib" cutscene.
- if (textVisible && handle.isActive())
+ if (textVisible && _snd->isSoundHandleActive(handle))
drawTextObject(anim, text[textCounter]);
if (text)
@@ -354,7 +354,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
if (skipCutscene)
_snd->stopHandle(handle);
- while (handle.isActive()) {
+ while (_snd->isSoundHandleActive(handle)) {
_vm->_screen->updateDisplay(false);
_sys->delayMillis(100);
}
@@ -441,7 +441,7 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte
tmpPal[255 * 4 + 2] = 255;
_vm->_screen->setPalette(0, 256, tmpPal, RDPAL_INSTANT);
- PlayingSoundHandle handle;
+ SoundHandle handle;
bool skipCutscene = false;
@@ -493,7 +493,7 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte
// don't cut off the speech in mid-sentence, and - even more
// importantly - that we don't free the sound buffer while it's in use.
- while (handle.isActive()) {
+ while (_snd->isSoundHandleActive(handle)) {
_vm->_screen->updateDisplay(false);
_sys->delayMillis(100);
}
diff --git a/sword2/driver/animation.h b/sword2/driver/animation.h
index 0dcac3fc81..c9d75da66e 100644
--- a/sword2/driver/animation.h
+++ b/sword2/driver/animation.h
@@ -77,7 +77,7 @@ private:
byte *_textSurface;
- PlayingSoundHandle _leadOutHandle;
+ SoundHandle _leadOutHandle;
static struct MovieInfo _movies[];
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 755aa1d73c..774f33c5cf 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -642,7 +642,7 @@ int32 Sound::musicTimeRemaining(void) {
void Sound::muteSpeech(bool mute) {
_speechMuted = mute;
- if (_soundHandleSpeech.isActive()) {
+ if (_vm->_mixer->isSoundHandleActive(_soundHandleSpeech)) {
uint volume = mute ? 0 : SoundMixer::kMaxChannelVolume;
_vm->_mixer->setChannelVolume(_soundHandleSpeech, volume);
@@ -672,7 +672,7 @@ void Sound::unpauseSpeech(void) {
*/
int32 Sound::stopSpeech() {
- if (_soundHandleSpeech.isActive()) {
+ if (_vm->_mixer->isSoundHandleActive(_soundHandleSpeech)) {
_vm->_mixer->stopHandle(_soundHandleSpeech);
return RD_OK;
}
@@ -685,7 +685,7 @@ int32 Sound::stopSpeech() {
*/
int32 Sound::getSpeechStatus() {
- return _soundHandleSpeech.isActive() ? RDSE_SAMPLEPLAYING : RDSE_SAMPLEFINISHED;
+ return _vm->_mixer->isSoundHandleActive(_soundHandleSpeech) ? RDSE_SAMPLEPLAYING : RDSE_SAMPLEFINISHED;
}
/**
@@ -693,7 +693,7 @@ int32 Sound::getSpeechStatus() {
*/
int32 Sound::amISpeaking() {
- if (!_speechMuted && !_speechPaused && _soundHandleSpeech.isActive())
+ if (!_speechMuted && !_speechPaused && _vm->_mixer->isSoundHandleActive(_soundHandleSpeech))
return RDSE_SPEAKING;
return RDSE_QUIET;
@@ -818,7 +818,7 @@ int32 Sound::setFxIdVolumePan(int32 i, int vol, int pan) {
_fxQueue[i].pan = (pan * 127) / 16;
}
- if (!_fxMuted && _fxQueue[i].handle.isActive()) {
+ if (!_fxMuted && _vm->_mixer->isSoundHandleActive(_fxQueue[i].handle)) {
_vm->_mixer->setChannelVolume(_fxQueue[i].handle, _fxQueue[i].volume);
if (pan != -1)
_vm->_mixer->setChannelBalance(_fxQueue[i].handle, _fxQueue[i].pan);
diff --git a/sword2/sound.cpp b/sword2/sound.cpp
index 9955eb5490..addaba928c 100644
--- a/sword2/sound.cpp
+++ b/sword2/sound.cpp
@@ -156,7 +156,7 @@ void Sound::processFxQueue() {
break;
case FX_SPOT2:
// Once the FX has finished remove it from the queue.
- if (!_fxQueue[i].handle.isActive()) {
+ if (!_vm->_mixer->isSoundHandleActive(_fxQueue[i].handle)) {
_vm->_resman->closeResource(_fxQueue[i].resource);
_fxQueue[i].resource = 0;
}
@@ -250,11 +250,11 @@ int32 Sound::playFx(FxQueueEntry *fx) {
return playFx(&fx->handle, fx->data, fx->len, fx->volume, fx->pan, (fx->type == FX_LOOP), SoundMixer::kSFXSoundType);
}
-int32 Sound::playFx(PlayingSoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, SoundMixer::SoundType soundType) {
+int32 Sound::playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, SoundMixer::SoundType soundType) {
if (_fxMuted)
return RD_OK;
- if (handle->isActive())
+ if (_vm->_mixer->isSoundHandleActive(*handle))
return RDERR_FXALREADYOPEN;
Common::MemoryReadStream stream(data, len);
@@ -287,8 +287,7 @@ int32 Sound::stopFx(int32 i) {
if (!_fxQueue[i].resource)
return RDERR_FXNOTOPEN;
- if (_fxQueue[i].handle.isActive())
- _vm->_mixer->stopHandle(_fxQueue[i].handle);
+ _vm->_mixer->stopHandle(_fxQueue[i].handle);
_vm->_resman->closeResource(_fxQueue[i].resource);
_fxQueue[i].resource = 0;
diff --git a/sword2/sound.h b/sword2/sound.h
index 07a8b40c35..f34ba70014 100644
--- a/sword2/sound.h
+++ b/sword2/sound.h
@@ -172,7 +172,7 @@ private:
Common::Mutex _mutex;
struct FxQueueEntry {
- PlayingSoundHandle handle; // sound handle
+ SoundHandle handle; // sound handle
uint32 resource; // resource id of sample
byte *data; // pointer to WAV data
uint32 len; // WAV data length
@@ -198,7 +198,7 @@ private:
int32 _loopingMusicId;
- PlayingSoundHandle _soundHandleSpeech;
+ SoundHandle _soundHandleSpeech;
MusicInputStream *_music[MAXMUS];
//File _musicFile[MAXMUS];
@@ -253,7 +253,7 @@ public:
void queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan);
int32 playFx(FxQueueEntry *fx);
- int32 playFx(PlayingSoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, SoundMixer::SoundType soundType);
+ int32 playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, SoundMixer::SoundType soundType);
int32 stopFx(int32 i);
int32 setFxIdVolumePan(int32 id, int vol, int pan = 255);