diff options
-rw-r--r-- | engines/tony/custom.cpp | 10 | ||||
-rw-r--r-- | engines/tony/sound.cpp | 72 | ||||
-rw-r--r-- | engines/tony/sound.h | 57 |
3 files changed, 68 insertions, 71 deletions
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp index 160fafa47f..375b405400 100644 --- a/engines/tony/custom.cpp +++ b/engines/tony/custom.cpp @@ -331,7 +331,7 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX if (_ctx->curVoc) { if (_ctx->i == 0) { _ctx->voice->play(); - _ctx->text.setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); + _ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer); } else { _vm->_vdbFP.seek(_ctx->curOffset); _vm->_theSound.createSfx(&_ctx->voice); @@ -340,7 +340,7 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX _ctx->curOffset = _vm->_vdbFP.pos(); _ctx->voice->setLoop(false); _ctx->voice->play(); - _ctx->text.setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); + _ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer); } } @@ -1535,7 +1535,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess _ctx->voice->setLoop(false); if (bIsBack) _ctx->voice->setVolume(55); _ctx->voice->play(); - _ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); + _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer); _ctx->curOffset = _vm->_vdbFP.pos(); } @@ -1749,7 +1749,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes if (bIsBack) _ctx->voice->setVolume(55); _ctx->voice->play(); - _ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); + _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer); _ctx->curOffset = _vm->_vdbFP.pos(); } @@ -1912,7 +1912,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg if (_ctx->curVoc) { _ctx->voice->play(); - _ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); + _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer); } // Wait for the end of display diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index 35db3ced38..479cb05a0b 100644 --- a/engines/tony/sound.cpp +++ b/engines/tony/sound.cpp @@ -56,7 +56,7 @@ namespace Tony { \****************************************************************************/ FPSound::FPSound() { - bSoundSupported = false; + _bSoundSupported = false; } @@ -72,8 +72,8 @@ FPSound::FPSound() { \****************************************************************************/ bool FPSound::init() { - bSoundSupported = g_system->getMixer()->isReady(); - return bSoundSupported; + _bSoundSupported = g_system->getMixer()->isReady(); + return _bSoundSupported; } @@ -112,7 +112,7 @@ FPSound::~FPSound() { \****************************************************************************/ bool FPSound::createStream(FPStream **lplpStream) { - (*lplpStream) = new FPStream(bSoundSupported); + (*lplpStream) = new FPStream(_bSoundSupported); return (*lplpStream != NULL); } @@ -136,7 +136,7 @@ bool FPSound::createStream(FPStream **lplpStream) { \****************************************************************************/ bool FPSound::createSfx(FPSfx **lplpSfx) { - (*lplpSfx) = new FPSfx(bSoundSupported); + (*lplpSfx) = new FPSfx(_bSoundSupported); return (*lplpSfx != NULL); } @@ -154,7 +154,7 @@ bool FPSound::createSfx(FPSfx **lplpSfx) { \****************************************************************************/ void FPSound::setMasterVolume(int dwVolume) { - if (!bSoundSupported) + if (!_bSoundSupported) return; g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, CLIP<int>(dwVolume, 0, 63) * Audio::Mixer::kMaxChannelVolume / 63); @@ -172,7 +172,7 @@ void FPSound::setMasterVolume(int dwVolume) { \****************************************************************************/ void FPSound::getMasterVolume(int *lpdwVolume) { - if (!bSoundSupported) + if (!_bSoundSupported) return; *lpdwVolume = g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) * 63 / Audio::Mixer::kMaxChannelVolume; @@ -193,14 +193,14 @@ void FPSound::getMasterVolume(int *lpdwVolume) { \****************************************************************************/ FPSfx::FPSfx(bool bSoundOn) { - bSoundSupported = bSoundOn; - bFileLoaded = false; - lastVolume = 63; - hEndOfBuffer = CORO_INVALID_PID_VALUE; - bIsVoice = false; + _bSoundSupported = bSoundOn; + _bFileLoaded = false; + _lastVolume = 63; + _hEndOfBuffer = CORO_INVALID_PID_VALUE; + _bIsVoice = false; _loopStream = 0; _rewindableStream = 0; - bPaused = false; + _bPaused = false; _vm->_activeSfx.push_back(this); } @@ -217,7 +217,7 @@ FPSfx::FPSfx(bool bSoundOn) { \****************************************************************************/ FPSfx::~FPSfx() { - if (!bSoundSupported) + if (!_bSoundSupported) return; g_system->getMixer()->stopHandle(_handle); @@ -276,8 +276,8 @@ bool FPSfx::loadWave(Common::SeekableReadStream *stream) { if (!_rewindableStream) return false; - bFileLoaded = true; - setVolume(lastVolume); + _bFileLoaded = true; + setVolume(_lastVolume); return true; } @@ -297,23 +297,23 @@ bool FPSfx::loadWave(Common::SeekableReadStream *stream) { \****************************************************************************/ bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) { - if (!bSoundSupported) + if (!_bSoundSupported) return true; uint32 size = vdbFP.readUint32LE(); uint32 rate = vdbFP.readUint32LE(); - bIsVoice = true; + _bIsVoice = true; _rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1); - bFileLoaded = true; + _bFileLoaded = true; setVolume(62); return true; } bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) { - if (!bSoundSupported) + if (!_bSoundSupported) return true; Common::File file; @@ -343,7 +343,7 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) { _rewindableStream = Audio::makeRawStream(buffer, rate, flags, DisposeAfterUse::YES); } - bFileLoaded = true; + _bFileLoaded = true; return true; } @@ -361,7 +361,7 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) { bool FPSfx::play() { stop(); // sanity check - if (bFileLoaded) { + if (_bFileLoaded) { // FIXME //if (hEndOfBuffer != CORO_INVALID_PID_VALUE) // ResetEvent(hEndOfBuffer); @@ -370,7 +370,7 @@ bool FPSfx::play() { Audio::AudioStream *stream = _rewindableStream; - if (bLoop) { + if (_bLoop) { if (!_loopStream) _loopStream = Audio::makeLoopingAudioStream(_rewindableStream, 0); @@ -380,9 +380,9 @@ bool FPSfx::play() { g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); - setVolume(lastVolume); + setVolume(_lastVolume); - if (bPaused) + if (_bPaused) g_system->getMixer()->pauseHandle(_handle, true); } @@ -401,9 +401,9 @@ bool FPSfx::play() { \****************************************************************************/ bool FPSfx::stop() { - if (bFileLoaded) { + if (_bFileLoaded) { g_system->getMixer()->stopHandle(_handle); - bPaused = false; + _bPaused = false; } return true; @@ -428,15 +428,15 @@ bool FPSfx::stop() { \****************************************************************************/ void FPSfx::setLoop(bool bLop) { - bLoop = bLop; + _bLoop = bLop; } void FPSfx::pause(bool bPause) { - if (bFileLoaded) { - if (g_system->getMixer()->isSoundHandleActive(_handle) && (bPause ^ bPaused)) + if (_bFileLoaded) { + if (g_system->getMixer()->isSoundHandleActive(_handle) && (bPause ^ _bPaused)) g_system->getMixer()->pauseHandle(_handle, bPause); - bPaused = bPause; + _bPaused = bPause; } } @@ -457,9 +457,9 @@ void FPSfx::setVolume(int dwVolume) { if (dwVolume < 0) dwVolume = 0; - lastVolume = dwVolume; + _lastVolume = dwVolume; - if (bIsVoice) { + if (_bIsVoice) { if (!GLOBALS._bCfgDubbing) dwVolume = 0; else { @@ -523,7 +523,7 @@ void FPSfx::soundCheckProcess(CORO_PARAM, const void *param) { for (_ctx->i = _vm->_activeSfx.begin(); _ctx->i != _vm->_activeSfx.end(); ++_ctx->i) { FPSfx *sfx = *_ctx->i; if (sfx->endOfBuffer()) - CoroScheduler.setEvent(sfx->hEndOfBuffer); + CoroScheduler.setEvent(sfx->_hEndOfBuffer); } // Delay until the next check is done @@ -1035,7 +1035,7 @@ void FPStream::waitForSync(FPStream *toplay) { /* Disalloca e chiude il CODEC */ delete lpCodec; #endif - bIsPlaying = false; + _bIsPlaying = false; } /****************************************************************************\ @@ -1178,7 +1178,7 @@ void FPStream::playThread(FPStream *This) { \****************************************************************************/ void FPStream::setLoop(bool loop) { - bLoop = loop; + _bLoop = loop; } diff --git a/engines/tony/sound.h b/engines/tony/sound.h index f47393b86d..5e50c31554 100644 --- a/engines/tony/sound.h +++ b/engines/tony/sound.h @@ -62,7 +62,7 @@ class FPSound { private: - bool bSoundSupported; + bool _bSoundSupported; /****************************************************************************\ * Methods @@ -176,20 +176,20 @@ class FPSfx { \****************************************************************************/ private: - bool bSoundSupported; // True if the sound is active - bool bFileLoaded; // True is a file is opened - bool bLoop; // True is sound effect should loop - int lastVolume; + bool _bSoundSupported; // True if the sound is active + bool _bFileLoaded; // True is a file is opened + bool _bLoop; // True is sound effect should loop + int _lastVolume; - bool bIsVoice; - bool bPaused; + bool _bIsVoice; + bool _bPaused; Audio::AudioStream *_loopStream; Audio::RewindableAudioStream *_rewindableStream; Audio::SoundHandle _handle; public: - uint32 hEndOfBuffer; + uint32 _hEndOfBuffer; private: @@ -352,33 +352,33 @@ private: LPDIRECTSOUNDBUFFER lpDSBuffer; // DirectSound circular buffer LPDIRECTSOUNDNOTIFY lpDSNotify; // Notify hotspots in the buffer */ - byte *lpTempBuffer; // Temporary buffer use for decompression + byte *_lpTempBuffer; // Temporary buffer use for decompression - uint32 dwBufferSize; // Buffer size (bytes) - uint32 dwSize; // Stream size (bytes) - uint32 dwCodec; // CODEC used + uint32 _dwBufferSize; // Buffer size (bytes) + uint32 _dwSize; // Stream size (bytes) + uint32 _dwCodec; // CODEC used - HANDLE hThreadEnd; // Event used to close thread + HANDLE _hThreadEnd; // Event used to close thread Common::File _file; // File handle used for the stream - HANDLE hPlayThread; // Handle of the Play thread - HANDLE hHot1, hHot2, hHot3; // Events set by DirectSoundNotify - HANDLE hPlayThread_PlayFast; - HANDLE hPlayThread_PlayNormal; - - bool bSoundSupported; // True if the sound is active - bool bFileLoaded; // True if the file is open - bool bLoop; // True if the stream should loop - bool bDoFadeOut; // True if fade out is required - bool bSyncExit; - bool bPaused; - int lastVolume; - FPStream *SyncToPlay; + HANDLE _hPlayThread; // Handle of the Play thread + HANDLE _hHot1, _hHot2, _hHot3; // Events set by DirectSoundNotify + HANDLE _hPlayThreadPlayFast; + HANDLE _hPlayThreadPlayNormal; + + bool _bSoundSupported; // True if the sound is active + bool _bFileLoaded; // True if the file is open + bool _bLoop; // True if the stream should loop + bool _bDoFadeOut; // True if fade out is required + bool _bSyncExit; + bool _bPaused; + int _lastVolume; + FPStream *_syncToPlay; // DSBPOSITIONNOTIFY dspnHot[3]; bool createBuffer(int nBufSize); public: - bool bIsPlaying; // True if the stream is playing + bool _bIsPlaying; // True if the stream is playing private: @@ -521,8 +521,6 @@ public: void setVolume(int dwVolume); - - /****************************************************************************\ * * Function: void getVolume(LPINT lpdwVolume); @@ -536,7 +534,6 @@ public: void getVolume(int *lpdwVolume); }; - } // End of namespace Tony #endif |