TONY: Rename sound variables

This commit is contained in:
Strangerke 2012-06-16 19:04:19 +02:00
parent 25d95bd5e3
commit ac4567dcb6
3 changed files with 67 additions and 70 deletions

View file

@ -331,7 +331,7 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
if (_ctx->curVoc) { if (_ctx->curVoc) {
if (_ctx->i == 0) { if (_ctx->i == 0) {
_ctx->voice->play(); _ctx->voice->play();
_ctx->text.setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); _ctx->text.setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
} else { } else {
_vm->_vdbFP.seek(_ctx->curOffset); _vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.createSfx(&_ctx->voice); _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->curOffset = _vm->_vdbFP.pos();
_ctx->voice->setLoop(false); _ctx->voice->setLoop(false);
_ctx->voice->play(); _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); _ctx->voice->setLoop(false);
if (bIsBack) _ctx->voice->setVolume(55); if (bIsBack) _ctx->voice->setVolume(55);
_ctx->voice->play(); _ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
_ctx->curOffset = _vm->_vdbFP.pos(); _ctx->curOffset = _vm->_vdbFP.pos();
} }
@ -1749,7 +1749,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
if (bIsBack) if (bIsBack)
_ctx->voice->setVolume(55); _ctx->voice->setVolume(55);
_ctx->voice->play(); _ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
_ctx->curOffset = _vm->_vdbFP.pos(); _ctx->curOffset = _vm->_vdbFP.pos();
} }
@ -1912,7 +1912,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
if (_ctx->curVoc) { if (_ctx->curVoc) {
_ctx->voice->play(); _ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer); _ctx->text->setCustomSkipHandle2(_ctx->voice->_hEndOfBuffer);
} }
// Wait for the end of display // Wait for the end of display

View file

@ -56,7 +56,7 @@ namespace Tony {
\****************************************************************************/ \****************************************************************************/
FPSound::FPSound() { FPSound::FPSound() {
bSoundSupported = false; _bSoundSupported = false;
} }
@ -72,8 +72,8 @@ FPSound::FPSound() {
\****************************************************************************/ \****************************************************************************/
bool FPSound::init() { bool FPSound::init() {
bSoundSupported = g_system->getMixer()->isReady(); _bSoundSupported = g_system->getMixer()->isReady();
return bSoundSupported; return _bSoundSupported;
} }
@ -112,7 +112,7 @@ FPSound::~FPSound() {
\****************************************************************************/ \****************************************************************************/
bool FPSound::createStream(FPStream **lplpStream) { bool FPSound::createStream(FPStream **lplpStream) {
(*lplpStream) = new FPStream(bSoundSupported); (*lplpStream) = new FPStream(_bSoundSupported);
return (*lplpStream != NULL); return (*lplpStream != NULL);
} }
@ -136,7 +136,7 @@ bool FPSound::createStream(FPStream **lplpStream) {
\****************************************************************************/ \****************************************************************************/
bool FPSound::createSfx(FPSfx **lplpSfx) { bool FPSound::createSfx(FPSfx **lplpSfx) {
(*lplpSfx) = new FPSfx(bSoundSupported); (*lplpSfx) = new FPSfx(_bSoundSupported);
return (*lplpSfx != NULL); return (*lplpSfx != NULL);
} }
@ -154,7 +154,7 @@ bool FPSound::createSfx(FPSfx **lplpSfx) {
\****************************************************************************/ \****************************************************************************/
void FPSound::setMasterVolume(int dwVolume) { void FPSound::setMasterVolume(int dwVolume) {
if (!bSoundSupported) if (!_bSoundSupported)
return; return;
g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, CLIP<int>(dwVolume, 0, 63) * Audio::Mixer::kMaxChannelVolume / 63); 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) { void FPSound::getMasterVolume(int *lpdwVolume) {
if (!bSoundSupported) if (!_bSoundSupported)
return; return;
*lpdwVolume = g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) * 63 / Audio::Mixer::kMaxChannelVolume; *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) { FPSfx::FPSfx(bool bSoundOn) {
bSoundSupported = bSoundOn; _bSoundSupported = bSoundOn;
bFileLoaded = false; _bFileLoaded = false;
lastVolume = 63; _lastVolume = 63;
hEndOfBuffer = CORO_INVALID_PID_VALUE; _hEndOfBuffer = CORO_INVALID_PID_VALUE;
bIsVoice = false; _bIsVoice = false;
_loopStream = 0; _loopStream = 0;
_rewindableStream = 0; _rewindableStream = 0;
bPaused = false; _bPaused = false;
_vm->_activeSfx.push_back(this); _vm->_activeSfx.push_back(this);
} }
@ -217,7 +217,7 @@ FPSfx::FPSfx(bool bSoundOn) {
\****************************************************************************/ \****************************************************************************/
FPSfx::~FPSfx() { FPSfx::~FPSfx() {
if (!bSoundSupported) if (!_bSoundSupported)
return; return;
g_system->getMixer()->stopHandle(_handle); g_system->getMixer()->stopHandle(_handle);
@ -276,8 +276,8 @@ bool FPSfx::loadWave(Common::SeekableReadStream *stream) {
if (!_rewindableStream) if (!_rewindableStream)
return false; return false;
bFileLoaded = true; _bFileLoaded = true;
setVolume(lastVolume); setVolume(_lastVolume);
return true; return true;
} }
@ -297,23 +297,23 @@ bool FPSfx::loadWave(Common::SeekableReadStream *stream) {
\****************************************************************************/ \****************************************************************************/
bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) { bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) {
if (!bSoundSupported) if (!_bSoundSupported)
return true; return true;
uint32 size = vdbFP.readUint32LE(); uint32 size = vdbFP.readUint32LE();
uint32 rate = vdbFP.readUint32LE(); uint32 rate = vdbFP.readUint32LE();
bIsVoice = true; _bIsVoice = true;
_rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1); _rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1);
bFileLoaded = true; _bFileLoaded = true;
setVolume(62); setVolume(62);
return true; return true;
} }
bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) { bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
if (!bSoundSupported) if (!_bSoundSupported)
return true; return true;
Common::File file; Common::File file;
@ -343,7 +343,7 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
_rewindableStream = Audio::makeRawStream(buffer, rate, flags, DisposeAfterUse::YES); _rewindableStream = Audio::makeRawStream(buffer, rate, flags, DisposeAfterUse::YES);
} }
bFileLoaded = true; _bFileLoaded = true;
return true; return true;
} }
@ -361,7 +361,7 @@ bool FPSfx::loadFile(const char *lpszFileName, uint32 dwCodec) {
bool FPSfx::play() { bool FPSfx::play() {
stop(); // sanity check stop(); // sanity check
if (bFileLoaded) { if (_bFileLoaded) {
// FIXME // FIXME
//if (hEndOfBuffer != CORO_INVALID_PID_VALUE) //if (hEndOfBuffer != CORO_INVALID_PID_VALUE)
// ResetEvent(hEndOfBuffer); // ResetEvent(hEndOfBuffer);
@ -370,7 +370,7 @@ bool FPSfx::play() {
Audio::AudioStream *stream = _rewindableStream; Audio::AudioStream *stream = _rewindableStream;
if (bLoop) { if (_bLoop) {
if (!_loopStream) if (!_loopStream)
_loopStream = Audio::makeLoopingAudioStream(_rewindableStream, 0); _loopStream = Audio::makeLoopingAudioStream(_rewindableStream, 0);
@ -380,9 +380,9 @@ bool FPSfx::play() {
g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, stream, -1, g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_handle, stream, -1,
Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
setVolume(lastVolume); setVolume(_lastVolume);
if (bPaused) if (_bPaused)
g_system->getMixer()->pauseHandle(_handle, true); g_system->getMixer()->pauseHandle(_handle, true);
} }
@ -401,9 +401,9 @@ bool FPSfx::play() {
\****************************************************************************/ \****************************************************************************/
bool FPSfx::stop() { bool FPSfx::stop() {
if (bFileLoaded) { if (_bFileLoaded) {
g_system->getMixer()->stopHandle(_handle); g_system->getMixer()->stopHandle(_handle);
bPaused = false; _bPaused = false;
} }
return true; return true;
@ -428,15 +428,15 @@ bool FPSfx::stop() {
\****************************************************************************/ \****************************************************************************/
void FPSfx::setLoop(bool bLop) { void FPSfx::setLoop(bool bLop) {
bLoop = bLop; _bLoop = bLop;
} }
void FPSfx::pause(bool bPause) { void FPSfx::pause(bool bPause) {
if (bFileLoaded) { if (_bFileLoaded) {
if (g_system->getMixer()->isSoundHandleActive(_handle) && (bPause ^ bPaused)) if (g_system->getMixer()->isSoundHandleActive(_handle) && (bPause ^ _bPaused))
g_system->getMixer()->pauseHandle(_handle, bPause); g_system->getMixer()->pauseHandle(_handle, bPause);
bPaused = bPause; _bPaused = bPause;
} }
} }
@ -457,9 +457,9 @@ void FPSfx::setVolume(int dwVolume) {
if (dwVolume < 0) if (dwVolume < 0)
dwVolume = 0; dwVolume = 0;
lastVolume = dwVolume; _lastVolume = dwVolume;
if (bIsVoice) { if (_bIsVoice) {
if (!GLOBALS._bCfgDubbing) if (!GLOBALS._bCfgDubbing)
dwVolume = 0; dwVolume = 0;
else { 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) { for (_ctx->i = _vm->_activeSfx.begin(); _ctx->i != _vm->_activeSfx.end(); ++_ctx->i) {
FPSfx *sfx = *_ctx->i; FPSfx *sfx = *_ctx->i;
if (sfx->endOfBuffer()) if (sfx->endOfBuffer())
CoroScheduler.setEvent(sfx->hEndOfBuffer); CoroScheduler.setEvent(sfx->_hEndOfBuffer);
} }
// Delay until the next check is done // Delay until the next check is done
@ -1035,7 +1035,7 @@ void FPStream::waitForSync(FPStream *toplay) {
/* Disalloca e chiude il CODEC */ /* Disalloca e chiude il CODEC */
delete lpCodec; delete lpCodec;
#endif #endif
bIsPlaying = false; _bIsPlaying = false;
} }
/****************************************************************************\ /****************************************************************************\
@ -1178,7 +1178,7 @@ void FPStream::playThread(FPStream *This) {
\****************************************************************************/ \****************************************************************************/
void FPStream::setLoop(bool loop) { void FPStream::setLoop(bool loop) {
bLoop = loop; _bLoop = loop;
} }

View file

@ -62,7 +62,7 @@ class FPSound {
private: private:
bool bSoundSupported; bool _bSoundSupported;
/****************************************************************************\ /****************************************************************************\
* Methods * Methods
@ -176,20 +176,20 @@ class FPSfx {
\****************************************************************************/ \****************************************************************************/
private: private:
bool bSoundSupported; // True if the sound is active bool _bSoundSupported; // True if the sound is active
bool bFileLoaded; // True is a file is opened bool _bFileLoaded; // True is a file is opened
bool bLoop; // True is sound effect should loop bool _bLoop; // True is sound effect should loop
int lastVolume; int _lastVolume;
bool bIsVoice; bool _bIsVoice;
bool bPaused; bool _bPaused;
Audio::AudioStream *_loopStream; Audio::AudioStream *_loopStream;
Audio::RewindableAudioStream *_rewindableStream; Audio::RewindableAudioStream *_rewindableStream;
Audio::SoundHandle _handle; Audio::SoundHandle _handle;
public: public:
uint32 hEndOfBuffer; uint32 _hEndOfBuffer;
private: private:
@ -352,33 +352,33 @@ private:
LPDIRECTSOUNDBUFFER lpDSBuffer; // DirectSound circular buffer LPDIRECTSOUNDBUFFER lpDSBuffer; // DirectSound circular buffer
LPDIRECTSOUNDNOTIFY lpDSNotify; // Notify hotspots in the 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 _dwBufferSize; // Buffer size (bytes)
uint32 dwSize; // Stream size (bytes) uint32 _dwSize; // Stream size (bytes)
uint32 dwCodec; // CODEC used 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 Common::File _file; // File handle used for the stream
HANDLE hPlayThread; // Handle of the Play thread HANDLE _hPlayThread; // Handle of the Play thread
HANDLE hHot1, hHot2, hHot3; // Events set by DirectSoundNotify HANDLE _hHot1, _hHot2, _hHot3; // Events set by DirectSoundNotify
HANDLE hPlayThread_PlayFast; HANDLE _hPlayThreadPlayFast;
HANDLE hPlayThread_PlayNormal; HANDLE _hPlayThreadPlayNormal;
bool bSoundSupported; // True if the sound is active bool _bSoundSupported; // True if the sound is active
bool bFileLoaded; // True if the file is open bool _bFileLoaded; // True if the file is open
bool bLoop; // True if the stream should loop bool _bLoop; // True if the stream should loop
bool bDoFadeOut; // True if fade out is required bool _bDoFadeOut; // True if fade out is required
bool bSyncExit; bool _bSyncExit;
bool bPaused; bool _bPaused;
int lastVolume; int _lastVolume;
FPStream *SyncToPlay; FPStream *_syncToPlay;
// DSBPOSITIONNOTIFY dspnHot[3]; // DSBPOSITIONNOTIFY dspnHot[3];
bool createBuffer(int nBufSize); bool createBuffer(int nBufSize);
public: public:
bool bIsPlaying; // True if the stream is playing bool _bIsPlaying; // True if the stream is playing
private: private:
@ -521,8 +521,6 @@ public:
void setVolume(int dwVolume); void setVolume(int dwVolume);
/****************************************************************************\ /****************************************************************************\
* *
* Function: void getVolume(LPINT lpdwVolume); * Function: void getVolume(LPINT lpdwVolume);
@ -536,7 +534,6 @@ public:
void getVolume(int *lpdwVolume); void getVolume(int *lpdwVolume);
}; };
} // End of namespace Tony } // End of namespace Tony
#endif #endif