diff options
author | Filippos Karapetis | 2015-02-24 23:41:41 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-15 00:05:02 +0100 |
commit | 6842ffbe90867deb214f4f9e7f0f75476fbefdf9 (patch) | |
tree | f3be9b0dc42f198e8593c1d1531aaffd64ebafb2 /engines | |
parent | 22b82d7729a2bd40b981a8faba16eff5c708df21 (diff) | |
download | scummvm-rg350-6842ffbe90867deb214f4f9e7f0f75476fbefdf9.tar.gz scummvm-rg350-6842ffbe90867deb214f4f9e7f0f75476fbefdf9.tar.bz2 scummvm-rg350-6842ffbe90867deb214f4f9e7f0f75476fbefdf9.zip |
LAB: Further clean up of the music and sound effect code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/audioi.cpp | 212 | ||||
-rw-r--r-- | engines/lab/engine.cpp | 34 | ||||
-rw-r--r-- | engines/lab/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/lab/labfun.h | 38 | ||||
-rw-r--r-- | engines/lab/labmusic.cpp | 100 | ||||
-rw-r--r-- | engines/lab/module.mk | 1 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 55 | ||||
-rw-r--r-- | engines/lab/readdiff.cpp | 15 |
8 files changed, 125 insertions, 336 deletions
diff --git a/engines/lab/audioi.cpp b/engines/lab/audioi.cpp deleted file mode 100644 index 10b570e835..0000000000 --- a/engines/lab/audioi.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* 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 code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "audio/mixer.h" -#include "audio/audiostream.h" -#include "audio/decoders/raw.h" - -#include "lab/lab.h" -#include "lab/stddefines.h" -#include "lab/labfun.h" - -namespace Lab { - -#define PLAYBUFSIZE 65536L - -extern bool MusicOn; - -//static sound_buff firstblock, tempblock; -static int bufnum; - - -bool EffectPlaying = false, ContMusic = false, DoMusic = false; -static char *CurMusic, *startMusic; -static uint32 StartMusicLen; -static Audio::SoundHandle g_musicHandle; -static Audio::SoundHandle g_sfxHandle; -static Audio::QueuingAudioStream *queuingAudioStream = NULL; - -static byte *playBuffer; - -void freeAudio() { - if (!DoMusic) - return; - - g_lab->_mixer->stopHandle(g_musicHandle); - g_lab->_mixer->stopHandle(g_sfxHandle); - - delete queuingAudioStream; - queuingAudioStream = NULL; - delete[] playBuffer; -} - - - -bool initAudio() { - playBuffer = new byte[PLAYBUFSIZE]; - return true; -} - - -bool musicBufferEmpty() { - return !g_lab->_mixer->isSoundHandleActive(g_sfxHandle); -} - - -uint16 getPlayingBufferCount() { - return (queuingAudioStream) ? queuingAudioStream->numQueuedStreams() : 0; -} - -void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed) { - bool startMusic = false; - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - if (!queuingAudioStream) { - queuingAudioStream = Audio::makeQueuingAudioStream(SampleSpeed, false); - startMusic = true; - } - - byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (g_lab->getPlatform() == Common::kPlatformWindows) - soundFlags |= Audio::FLAG_16BITS; - else - soundFlags |= Audio::FLAG_UNSIGNED; - - queuingAudioStream->queueBuffer((byte *)Ptr, Size, DisposeAfterUse::YES, soundFlags); - - if (startMusic) - g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &g_musicHandle, queuingAudioStream); -} - - -void updateSoundBuffers() { - if (!DoMusic) - return; - - if (!EffectPlaying) - return; - - // TODO - // FIXME: Very crude implementation - if (musicBufferEmpty()) { - flushAudio(); - EffectPlaying = false; - } - -#if 0 - for (int i = 0; i < 2; i++) { - if ((SDLSoundBufferStatus(i) == DAC_DONE) && firstblock.len) { - // use extra memory for 16-bit samples - tempblock.len = MIN(PLAYBUFSIZE, firstblock.len); - firstblock.len -= tempblock.len; - - if (!(bufnum ^= 1)) { - memcpy(buf1, CurMusic, (unsigned) tempblock.len); - tempblock.sel_data = buf1; - } else { - memcpy(buf2, CurMusic, (unsigned) tempblock.len); - tempblock.sel_data = buf2; - } - - CurMusic += tempblock.len; - - SDLPlayBuffer(i, &tempblock); - } - } - - // - // Playback ends when no bytes are left in the source data and - // the status of both buffers equals DAC_DONE - // - - if (!firstblock.len) { - if (ContMusic) { - CurMusic = startMusic; - firstblock.len = StartMusicLen; - } else if ((SDLSoundBufferStatus(0) == DAC_DONE) && - (SDLSoundBufferStatus(1) == DAC_DONE)) { - flushAudio(); - EffectPlaying = false; - } - } - -#endif -} - - - -void flushAudio() { - if (!DoMusic) - return; - - g_lab->_mixer->stopHandle(g_sfxHandle); - EffectPlaying = false; -} - - - - -void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data) { - if (!DoMusic) - return; - - g_music->pauseBackMusic(); - - if (flush) - flushAudio(); - - if (SampleSpeed < 4000) - SampleSpeed = 4000; - - // TODO: 8-bit mono sample for DOS - //firstblock.len = Length; - bufnum = 0; - - //tempblock = firstblock; - EffectPlaying = true; - CurMusic = (char *)Data; - startMusic = CurMusic; - StartMusicLen = Length; - - byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; - if (g_lab->getPlatform() == Common::kPlatformWindows) - soundFlags |= Audio::FLAG_16BITS; - else - soundFlags |= Audio::FLAG_UNSIGNED; - - Audio::SeekableAudioStream *audStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); - g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &g_sfxHandle, audStream); - - updateSoundBuffers(); -} - -} // End of namespace Lab diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index f8391d3f0d..b4b64093ab 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -47,7 +47,7 @@ bool LongWinInFront = false; TextFont *MsgFont; -extern bool DoBlack, waitForEffect, EffectPlaying, stopsound, DoNotDrawMessage, IsHiRes, nopalchange, DoMusic; +extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, IsHiRes, nopalchange; /* Global parser data */ @@ -698,7 +698,6 @@ static void decIncInv(uint16 *CurInv, bool dec) { static bool nosvgamem = false; static bool didintro = false; -static bool novesa = false, noaudio = false; /******************************************************************************/ /* Processes user input events. */ @@ -750,7 +749,7 @@ static void process() { break; } - g_music->restartBackMusic(); + g_music->resumeBackMusic(); /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ if (doCloseUp(CPtr)) { @@ -1382,8 +1381,6 @@ void LabEngine::go() { bool mem, dointro = false; uint16 counter; - DoMusic = true; - g_music->_turnMusicOn = true; dointro = true; IsHiRes = ((getFeatures() & GF_LOWRES) == 0); @@ -1394,23 +1391,6 @@ void LabEngine::go() { else warning("Running in LowRes mode"); #endif - -#if 0 - for (counter = 1; counter < argc; counter++) { - if (((argv[counter])[0] == 'q') || ((argv[counter])[0] == 'Q')) { - DoMusic = false; - g_music->_turnMusicOn = false; - } - - else if (((argv[counter])[0] == '/') && ((argv[counter])[1] == '?')) { - debug("\n\nPlayer Version 1.0. Copyright (c) 1993 Terra Nova Development\n"); - debug("Player v q\n"); - debug(" q : Start in quiet mode; no sound output.\n\n"); - return; - } - } -#endif - if (initBuffer(BUFFERSIZE, true)) { mem = true; } else { @@ -1418,17 +1398,8 @@ void LabEngine::go() { return; } - if (!initAudio()) { - noaudio = true; - DoMusic = false; - g_music->_turnMusicOn = false; - debug("Could not open Audio."); - g_system->delayMillis(500); - } - if (!setUpScreens()) { IsHiRes = false; - novesa = true; mem = mem && setUpScreens(); } @@ -1484,7 +1455,6 @@ void LabEngine::go() { freeBuffer(); g_music->freeMusic(); - freeAudio(); } /*****************************************************************************/ diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 4ef132a492..5fb12370a3 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -45,11 +45,11 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; extern BitMap RawDiffBM; extern char diffcmap[256 * 3], lastcmap[256 * 3]; -extern bool IsBM, NoFlip, nopalchange, ContMusic; +extern bool IsBM, NoFlip, nopalchange; extern int32 ReadSoFar; extern bool ReadIsDone, ReadIsError; -extern bool DoBlack, EffectPlaying, stopsound; +extern bool DoBlack, stopsound; extern bool IsHiRes; extern TextFont *MsgFont; extern const char *CurFileName; @@ -622,7 +622,7 @@ static void doScrollWipe(char *filename) { width = VGAScaleX(320); height = VGAScaleY(149) + SVGACord(2); - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->newCheckMusic(); waitTOF(); } diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index d976feea38..60b313e190 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -33,6 +33,12 @@ #include "lab/stddefines.h" #include "lab/parsetypes.h" + +// For the Music class - TODO: Move to another header file +#include "audio/mixer.h" +#include "audio/audiostream.h" +#include "audio/decoders/raw.h" + #include "common/file.h" #include "common/savefile.h" @@ -58,22 +64,6 @@ struct SaveGameHeader { }; /*----------------------------*/ -/*------ From Audioi.c -------*/ -/*----------------------------*/ - -bool initAudio(); -void freeAudio(); -bool musicBufferEmpty(); -void playMusicBlock(void *Ptr, uint32 Size, uint16 BufferNum, uint16 SampleSpeed); -uint16 getPlayingBufferCount(); -void updateSoundBuffers(); -void flushAudio(); -void playSoundEffect(uint16 SampleSpeed, uint16 Volume, uint32 Length, bool flush, void *Data); - - - - -/*----------------------------*/ /*----- From graphics.c ------*/ /*----------------------------*/ @@ -228,18 +218,23 @@ public: void freeMusic(); void fillUpMusic(bool doit); void updateMusic(); + uint16 getPlayingBufferCount(); void checkMusic(); void newCheckMusic(); void closeMusic(); void setMusic(bool on); - void restartBackMusic(); + void resumeBackMusic(); void pauseBackMusic(); void changeMusic(const char *newmusic); void resetMusic(); + + void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data); + void stopSoundEffect(); + bool isSoundEffectActive() const; - bool _winmusic, _doNotFileFlushAudio; - bool _turnMusicOn; + bool _winmusic, _doNotFilestopSoundEffect; bool _musicOn; + bool _loopSoundEffect; private: void fillbuffer(byte *musicBuffer); @@ -252,6 +247,11 @@ private: bool _tMusicOn; uint32 _tLeftInFile; uint32 _leftinfile; + + Audio::SoundHandle _musicHandle; + Audio::SoundHandle _sfxHandle; + + Audio::QueuingAudioStream *_queuingAudioStream; }; diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 1f5794b995..9bc0ee0dee 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -28,6 +28,8 @@ * */ +#include "audio/mixer.h" + #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/timing.h" @@ -41,7 +43,6 @@ namespace Lab { #define SAMPLESPEED 15000L -extern bool EffectPlaying; Music *g_music; Music::Music() { @@ -55,9 +56,10 @@ Music::Music() { _leftinfile = 0; _musicOn = false; - _turnMusicOn = false; _winmusic = false; - _doNotFileFlushAudio = false; + _loopSoundEffect = false; + _queuingAudioStream = NULL; + _doNotFilestopSoundEffect = false; } /*****************************************************************************/ @@ -69,18 +71,63 @@ void Music::updateMusic() { updateMouse(); - if (EffectPlaying) - updateSoundBuffers(); - if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { // NOTE: We need to use malloc(), cause this will be freed with free() // by the music code byte *musicBuffer = (byte *)malloc(MUSICBUFSIZE); fillbuffer(musicBuffer); - playMusicBlock(musicBuffer, MUSICBUFSIZE, 0, SAMPLESPEED); + + // Queue a music block, and start the music, if needed + bool startMusic = false; + + if (!_queuingAudioStream) { + _queuingAudioStream = Audio::makeQueuingAudioStream(SAMPLESPEED, false); + startMusic = true; + } + + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (g_lab->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + _queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags); + + if (startMusic) + g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); } } +uint16 Music::getPlayingBufferCount() { + return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0; +} + +void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) { + pauseBackMusic(); + stopSoundEffect(); + + if (SampleSpeed < 4000) + SampleSpeed = 4000; + + byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; + if (g_lab->getPlatform() == Common::kPlatformWindows) + soundFlags |= Audio::FLAG_16BITS; + else + soundFlags |= Audio::FLAG_UNSIGNED; + + Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); + uint loops = (_loopSoundEffect) ? 0 : 1; + Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops, DisposeAfterUse::YES); + g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); +} + +void Music::stopSoundEffect() { + g_lab->_mixer->stopHandle(_sfxHandle); +} + +bool Music::isSoundEffectActive() const { + return g_lab->_mixer->isSoundHandleActive(_sfxHandle); +} void Music::fillbuffer(byte *musicBuffer) { if (MUSICBUFSIZE < _leftinfile) { @@ -114,7 +161,7 @@ void Music::startMusic(bool startatbegin) { if (!_musicOn) return; - flushAudio(); + stopSoundEffect(); if (startatbegin) { _file->seek(0); @@ -130,10 +177,6 @@ void Music::startMusic(bool startatbegin) { /* Initializes the music buffers. */ /*****************************************************************************/ bool Music::initMusic() { - - if (!_turnMusicOn) - return true; - _musicOn = true; _musicPaused = false; @@ -167,6 +210,12 @@ void Music::freeMusic() { _file->close(); _file = 0; + + g_lab->_mixer->stopHandle(_musicHandle); + g_lab->_mixer->stopHandle(_sfxHandle); + + delete _queuingAudioStream; + _queuingAudioStream = NULL; } @@ -177,9 +226,9 @@ void Music::pauseBackMusic() { if (!_musicPaused && _musicOn) { updateMusic(); _musicOn = false; - flushAudio(); + stopSoundEffect(); - // TODO: Pause + g_lab->_mixer->pauseHandle(_musicHandle, true); _musicPaused = true; } @@ -188,21 +237,21 @@ void Music::pauseBackMusic() { /*****************************************************************************/ -/* Restarts the paused background music. */ +/* Resumes the paused background music. */ /*****************************************************************************/ -void Music::restartBackMusic() { +void Music::resumeBackMusic() { if (_musicPaused) { - flushAudio(); + stopSoundEffect(); _musicOn = true; + + g_lab->_mixer->pauseHandle(_musicHandle, false); + updateMusic(); _musicPaused = false; } } - - - /*****************************************************************************/ /* Checks to see if need to fill buffers fill of music. */ /*****************************************************************************/ @@ -232,7 +281,7 @@ void Music::newCheckMusic() { /* Turns the music on and off. */ /*****************************************************************************/ void Music::setMusic(bool on) { - flushAudio(); + stopSoundEffect(); if (on && !_musicOn) { _musicOn = true; @@ -251,15 +300,10 @@ void Music::changeMusic(const char *newmusic) { if (!_tFile) { _tFile = _file; _tMusicOn = _musicOn; -#if defined(DOSCODE) - _tLeftInFile = _leftinfile; -#else _tLeftInFile = _leftinfile + 65536L; if (_tLeftInFile > (uint32)_tFile->size()) _tLeftInFile = _leftinfile; - -#endif } _file = openPartial(newmusic); @@ -336,8 +380,8 @@ byte **Music::newOpen(const char *name) { fillUpMusic(true); } - if (!_doNotFileFlushAudio && EffectPlaying) - flushAudio(); + if (!_doNotFilestopSoundEffect && isSoundEffectActive()) + stopSoundEffect(); file = openFile(name); checkMusic(); diff --git a/engines/lab/module.mk b/engines/lab/module.mk index 8057fad951..7389c18a1d 100644 --- a/engines/lab/module.mk +++ b/engines/lab/module.mk @@ -2,7 +2,6 @@ MODULE := engines/lab MODULE_OBJS := \ allocroom.o \ - audioi.o \ detection.o \ engine.o \ graphics.o \ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 9c5055f01e..54d7605d15 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -62,7 +62,7 @@ const char *ViewPath = "LAB:Rooms/"; const char *NewFileName; extern bool DoNotDrawMessage; -extern bool NoFlip, IsBM, noupdatediff, waitForEffect, mwaitForEffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; +extern bool NoFlip, IsBM, noupdatediff, waitForEffect, mwaitForEffect, QuitLab, soundplaying, MusicOn, DoBlack, DoNotReset; extern char diffcmap[256 * 3]; extern CloseDataPtr CPtr; @@ -407,20 +407,20 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { switch (APtr->ActionType) { case PLAYSOUND: mwaitForEffect = true; /* Plays a sound, but waits for it to be done before continuing */ - ContMusic = false; + g_music->_loopSoundEffect = false; readMusic((char *)APtr->Data); mwaitForEffect = false; break; case PLAYSOUNDB: mwaitForEffect = false; /* Plays a sound in the background. */ - ContMusic = false; + g_music->_loopSoundEffect = false; readMusic((char *)APtr->Data); break; case PLAYSOUNDCONT: - g_music->_doNotFileFlushAudio = true; - ContMusic = true; + g_music->_doNotFilestopSoundEffect = true; + g_music->_loopSoundEffect = true; readMusic((char *)APtr->Data); break; @@ -605,19 +605,13 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case CHANGEMUSIC: - if (g_music->_turnMusicOn) { - g_music->changeMusic((const char *)APtr->Data); - DoNotReset = true; - } - + g_music->changeMusic((const char *)APtr->Data); + DoNotReset = true; break; case RESETMUSIC: - if (g_music->_turnMusicOn) { - g_music->resetMusic(); - DoNotReset = false; - } - + g_music->resetMusic(); + DoNotReset = false; break; case FILLMUSIC: @@ -625,7 +619,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case WAITSOUND: - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); waitTOF(); @@ -634,21 +628,18 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { break; case CLEARSOUND: - if (ContMusic) { - ContMusic = false; - flushAudio(); - } else if (EffectPlaying) - flushAudio(); + if (g_music->_loopSoundEffect) { + g_music->_loopSoundEffect = false; + g_music->stopSoundEffect(); + } else if (g_music->isSoundEffectActive()) + g_music->stopSoundEffect(); break; case WINMUSIC: - if (g_music->_turnMusicOn) { - g_music->_winmusic = true; - g_music->freeMusic(); - g_music->initMusic(); - } - + g_music->_winmusic = true; + g_music->freeMusic(); + g_music->initMusic(); break; case WINGAME: @@ -699,18 +690,18 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { APtr = APtr->NextAction; } - if (ContMusic) { - ContMusic = false; - flushAudio(); + if (g_music->_loopSoundEffect) { + g_music->_loopSoundEffect = false; + g_music->stopSoundEffect(); } else { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); waitTOF(); } } - g_music->_doNotFileFlushAudio = false; + g_music->_doNotFilestopSoundEffect = false; } /*****************************************************************************/ diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 3f7cdc7409..d5e29fabf1 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -64,9 +64,6 @@ bool NoFlip = false, /* Don't flip the new picture to front */ uint16 DataBytesPerRow; -extern bool EffectPlaying; - - #define CONTINUOUS 0xFFFF DIFFHeader headerdata; @@ -274,7 +271,7 @@ void diffNextFrame() { case 30L: case 31L: { if (waitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); } @@ -291,7 +288,7 @@ void diffNextFrame() { uint32 musicsize = size; skip(difffile, size); - playSoundEffect(samplespeed, 64, musicsize, true, music); + g_music->playSoundEffect(samplespeed, musicsize, music); break; } case 65535L: @@ -299,7 +296,7 @@ void diffNextFrame() { int didTOF = 0; if (waitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); @@ -545,7 +542,7 @@ void readSound() { if ((header_ == 30) || (header_ == 31)) { if (mwaitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); } @@ -563,10 +560,10 @@ void readSound() { uint32 musicsize = size_; skip(difffile_, size_); - playSoundEffect(samplespeed_, 64, musicsize, true, music); + g_music->playSoundEffect(samplespeed_, musicsize, music); } else if (header_ == 65535L) { if (mwaitForEffect) { - while (EffectPlaying) { + while (g_music->isSoundEffectActive()) { g_music->updateMusic(); waitTOF(); } |