From e51845f053d9f6c9711ee2d16e8be288affba061 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Fri, 1 Jun 2007 11:22:49 +0000 Subject: rename some imuse variables svn-id: r27039 --- engines/scumm/imuse_digi/dimuse.cpp | 74 +++++++++++++++--------------- engines/scumm/imuse_digi/dimuse.h | 18 ++++---- engines/scumm/imuse_digi/dimuse_bndmgr.cpp | 4 +- engines/scumm/imuse_digi/dimuse_bndmgr.h | 2 +- engines/scumm/imuse_digi/dimuse_script.cpp | 24 +++++----- engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 2 +- engines/scumm/imuse_digi/dimuse_sndmgr.h | 2 +- engines/scumm/imuse_digi/dimuse_track.cpp | 56 +++++++++++----------- 8 files changed, 90 insertions(+), 92 deletions(-) diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index bee1a56b82..31c97dac19 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -39,7 +39,7 @@ namespace Scumm { IMuseDigital::Track::Track() - : soundId(-1), used(false), stream(NULL), stream2(NULL) { + : soundId(-1), used(false), stream(NULL), streamSou(NULL) { } void IMuseDigital::timer_handler(void *refCon) { @@ -128,9 +128,9 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { MKARRAY(Track, soundName[0], sleByte, 15, VER(31)), MKLINE(Track, used, sleByte, VER(31)), MKLINE(Track, toBeRemoved, sleByte, VER(31)), - MKLINE(Track, souStream, sleByte, VER(31)), - MKLINE(Track, started, sleByte, VER(31)), - MKLINE(Track, priority, sleInt32, VER(31)), + MKLINE(Track, souStreamUsed, sleByte, VER(31)), + MKLINE(Track, mixerStreamRunning, sleByte, VER(31)), + MKLINE(Track, soundPriority, sleInt32, VER(31)), MKLINE(Track, regionOffset, sleInt32, VER(31)), MK_OBSOLETE(Track, trackOffset, sleInt32, VER(31), VER(31)), MKLINE(Track, dataOffset, sleInt32, VER(31)), @@ -138,12 +138,12 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { MKLINE(Track, curHookId, sleInt32, VER(31)), MKLINE(Track, volGroupId, sleInt32, VER(31)), MKLINE(Track, soundType, sleInt32, VER(31)), - MKLINE(Track, iteration, sleInt32, VER(31)), - MKLINE(Track, mod, sleInt32, VER(31)), - MKLINE(Track, flags, sleInt32, VER(31)), + MKLINE(Track, feedSize, sleInt32, VER(31)), + MKLINE(Track, dataMod12Bit, sleInt32, VER(31)), + MKLINE(Track, mixerFlags, sleInt32, VER(31)), MK_OBSOLETE(Track, mixerVol, sleInt32, VER(31), VER(42)), MK_OBSOLETE(Track, mixerPan, sleInt32, VER(31), VER(42)), - MKLINE(Track, compressed, sleByte, VER(45)), + MKLINE(Track, sndDataExtComp, sleByte, VER(45)), MKEND() }; @@ -152,15 +152,15 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) { Track *track = _track[l]; if (!ser->isSaving()) { - track->compressed = false; + track->sndDataExtComp = false; } ser->saveLoadEntries(track, trackEntries); if (!ser->isSaving()) { if (!track->used) continue; track->readyToRemove = false; - if ((track->toBeRemoved) || (track->souStream) || (track->curRegion == -1)) { - track->stream2 = NULL; + if ((track->toBeRemoved) || (track->souStreamUsed) || (track->curRegion == -1)) { + track->streamSou= NULL; track->stream = NULL; track->used = false; continue; @@ -171,43 +171,43 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { track->volGroupId, -1); if (!track->soundHandle) { warning("IMuseDigital::saveOrLoad: Can't open sound so will not be resumed, propably on diffrent CD"); - track->stream2 = NULL; + track->streamSou = NULL; track->stream = NULL; track->used = false; continue; } - if (track->compressed) { + if (track->sndDataExtComp) { track->regionOffset = 0; } - track->compressed = _sound->isCompressed(track->soundHandle); - if (track->compressed) { + track->sndDataExtComp = _sound->isSndDataExtComp(track->soundHandle); + if (track->sndDataExtComp) { track->regionOffset = 0; } track->dataOffset = _sound->getRegionOffset(track->soundHandle, track->curRegion); int bits = _sound->getBits(track->soundHandle); int channels = _sound->getChannels(track->soundHandle); int freq = _sound->getFreq(track->soundHandle); - track->iteration = freq * channels; - track->flags = 0; + track->feedSize = freq * channels; + track->mixerFlags = 0; if (channels == 2) - track->flags = kFlagStereo | kFlagReverseStereo; + track->mixerFlags = kFlagStereo | kFlagReverseStereo; if ((bits == 12) || (bits == 16)) { - track->flags |= kFlag16Bits; - track->iteration *= 2; + track->mixerFlags |= kFlag16Bits; + track->feedSize *= 2; } else if (bits == 8) { - track->flags |= kFlagUnsigned; + track->mixerFlags |= kFlagUnsigned; } else error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits); #ifdef SCUMM_LITTLE_ENDIAN - if (track->compressed) - track->flags |= kFlagLittleEndian; + if (track->sndDataExtComp) + track->mixerFlags |= kFlagLittleEndian; #endif - track->stream2 = NULL; - track->stream = Audio::makeAppendableAudioStream(freq, makeMixerFlags(track->flags)); + track->streamSou = NULL; + track->stream = Audio::makeAppendableAudioStream(freq, makeMixerFlags(track->mixerFlags)); const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; @@ -220,7 +220,7 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { if (track->volGroupId == 3) type = Audio::Mixer::kMusicSoundType; - _mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false); + _mixer->playInputStream(type, &track->mixChanHandle, track->stream, -1, vol, pan, false); } } } @@ -287,7 +287,7 @@ void IMuseDigital::callback() { int bits = _sound->getBits(track->soundHandle); int channels = _sound->getChannels(track->soundHandle); - int32 mixer_size = track->iteration / _callbackFps; + int32 mixer_size = track->feedSize / _callbackFps; if (track->stream->endOfData()) { mixer_size *= 2; @@ -310,10 +310,10 @@ void IMuseDigital::callback() { if (bits == 12) { byte *ptr = NULL; - mixer_size += track->mod; + mixer_size += track->dataMod12Bit; int mixer_size_12 = (mixer_size * 3) / 4; int length = (mixer_size_12 / 3) * 4; - track->mod = mixer_size - length; + track->dataMod12Bit = mixer_size - length; int32 offset = (track->regionOffset * 3) / 4; int result2 = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &ptr, offset, mixer_size_12); @@ -339,8 +339,8 @@ void IMuseDigital::callback() { result = mixer_size; if (_mixer->isReady()) { - _mixer->setChannelVolume(track->handle, vol); - _mixer->setChannelBalance(track->handle, pan); + _mixer->setChannelVolume(track->mixChanHandle, vol); + _mixer->setChannelBalance(track->mixChanHandle, pan); track->stream->queueBuffer(data, result); track->regionOffset += result; } else @@ -354,14 +354,14 @@ void IMuseDigital::callback() { mixer_size -= result; assert(mixer_size >= 0); } while (mixer_size != 0); - } else if (track->stream2) { + } else if (track->streamSou) { if (_mixer->isReady()) { - if (!track->started) { - track->started = true; - _mixer->playInputStream(type, &track->handle, track->stream2, -1, vol, pan, false); + if (!track->mixerStreamRunning) { + track->mixerStreamRunning = true; + _mixer->playInputStream(type, &track->mixChanHandle, track->streamSou, -1, vol, pan, false); } else { - _mixer->setChannelVolume(track->handle, vol); - _mixer->setChannelBalance(track->handle, pan); + _mixer->setChannelVolume(track->mixChanHandle, vol); + _mixer->setChannelBalance(track->mixChanHandle, pan); } } } diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index 8966b26d07..8da6e831f5 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -84,24 +84,24 @@ private: bool used; // flag mean that track is used bool toBeRemoved; // flag mean that track need to be free bool readyToRemove; // flag mean that track is ready to stop - bool started; // flag mean sound mixer's channel is started - bool souStream; // flag mean that track use stream from sou file - bool compressed; // flag mean that sound data is compressed by scummvm tools - int32 priority; // priority level of played sound (0-127) + bool mixerStreamRunning; // flag mean sound mixer's stream is running + bool souStreamUsed; // flag mean that track use stream from sou file + bool sndDataExtComp;// flag mean that sound data is compressed by scummvm tools + int32 soundPriority;// priority level of played sound (0-127) int32 regionOffset; // offset to sound data relative to begining of current region int32 dataOffset; // offset to sound data relative to begining of 'DATA' chunk int32 curRegion; // id of current used region int32 curHookId; // id of current used hook id int32 volGroupId; // id of volume group (IMUSE_VOLGRP_VOICE, IMUSE_VOLGRP_SFX, IMUSE_VOLGRP_MUSIC) int32 soundType; // type of sound data (kSpeechSoundType, kSFXSoundType, kMusicSoundType) - int32 iteration; // size of sound data needed to be filled at each callback iteration - int32 mod; // value used between all callback to align 12 bit source of data - int32 flags; // flags for sound mixer's channel (kFlagStereo, kFlag16Bits, kFlagReverseStereo, kFlagUnsigned, kFlagLittleEndian) + int32 feedSize; // size of sound data needed to be filled at each callback iteration + int32 dataMod12Bit; // value used between all callback to align 12 bit source of data + int32 mixerFlags; // flags for sound mixer's channel (kFlagStereo, kFlag16Bits, kFlagReverseStereo, kFlagUnsigned, kFlagLittleEndian) ImuseDigiSndMgr::soundStruct *soundHandle; // sound handle used by iMuse sound manager - Audio::SoundHandle handle; // sound mixer's channel handle + Audio::SoundHandle mixChanHandle; // sound mixer's channel handle Audio::AppendableAudioStream *stream; // sound mixer's audio stream handle for *.la1 and *.bun - Audio::AudioStream *stream2; // sound mixer's audio stream handle for *.sou + Audio::AudioStream *streamSou; // sound mixer's audio stream handle for *.sou Track(); }; diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index 6592be8848..c66999bc59 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -60,7 +60,7 @@ BundleDirCache::IndexNode *BundleDirCache::getIndexTable(int slot) { return _budleDirCache[slot].indexTable; } -bool BundleDirCache::isCompressed(int slot) { +bool BundleDirCache::isSndDataExtComp(int slot) { return _budleDirCache[slot].compressedBun; } @@ -187,7 +187,7 @@ bool BundleMgr::open(const char *filename, bool &compressed, bool errorFlag) { int slot = _cache->matchFile(filename); assert(slot != -1); - compressed = _cache->isCompressed(slot); + compressed = _cache->isSndDataExtComp(slot); _numFiles = _cache->getNumFiles(slot); assert(_numFiles); _bundleTable = _cache->getTable(slot); diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.h b/engines/scumm/imuse_digi/dimuse_bndmgr.h index ba044a24ed..34cc58511e 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.h @@ -63,7 +63,7 @@ public: AudioTable *getTable(int slot); IndexNode *getIndexTable(int slot); int32 getNumFiles(int slot); - bool isCompressed(int slot); + bool isSndDataExtComp(int slot); }; class BundleMgr { diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index a61fbcfb24..186d04483e 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -176,17 +176,17 @@ void IMuseDigital::flushTracks() { // appendable stream. We play it nice and wait till all of it // played. if (track->stream->endOfStream()) { - _mixer->stopHandle(track->handle); + _mixer->stopHandle(track->mixChanHandle); delete track->stream; track->stream = NULL; _sound->closeSound(track->soundHandle); track->soundHandle = NULL; track->used = false; } - } else if (track->stream2) { - _mixer->stopHandle(track->handle); - delete track->stream2; - track->stream2 = NULL; + } else if (track->streamSou) { + _mixer->stopHandle(track->mixChanHandle); + delete track->streamSou; + track->streamSou = NULL; track->used = false; } } @@ -273,7 +273,7 @@ int32 IMuseDigital::getPosInMs(int soundId) { for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { Track *track = _track[l]; if ((track->soundId == soundId) && track->used && !track->toBeRemoved) { - int32 pos = (5 * (track->dataOffset + track->regionOffset)) / (track->iteration / 200); + int32 pos = (5 * (track->dataOffset + track->regionOffset)) / (track->feedSize / 200); return pos; } } @@ -287,7 +287,7 @@ int IMuseDigital::getSoundStatus(int sound) const { for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { Track *track = _track[l]; if (track->soundId == sound) { - if ((track->stream2 && _mixer->isSoundHandleActive(track->handle)) || + if ((track->streamSou && _mixer->isSoundHandleActive(track->mixChanHandle)) || (track->stream && track->used && !track->readyToRemove)) { return 1; } @@ -393,15 +393,15 @@ void IMuseDigital::stopAllSounds() { // as we are protected by a mutex, and this method is never called // from IMuseDigital::callback either. if (track->stream) { - _mixer->stopHandle(track->handle); + _mixer->stopHandle(track->mixChanHandle); delete track->stream; track->stream = NULL; _sound->closeSound(track->soundHandle); track->soundHandle = NULL; - } else if (track->stream2) { - _mixer->stopHandle(track->handle); - delete track->stream2; - track->stream2 = NULL; + } else if (track->streamSou) { + _mixer->stopHandle(track->mixChanHandle); + delete track->streamSou; + track->streamSou = NULL; } // Mark the track as unused diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 61c5fece2a..ce963eaeea 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -465,7 +465,7 @@ bool ImuseDigiSndMgr::checkForProperHandle(soundStruct *soundHandle) { return false; } -bool ImuseDigiSndMgr::isCompressed(soundStruct *soundHandle) { +bool ImuseDigiSndMgr::isSndDataExtComp(soundStruct *soundHandle) { assert(checkForProperHandle(soundHandle)); return soundHandle->compressed; } diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.h b/engines/scumm/imuse_digi/dimuse_sndmgr.h index 2bdaed446b..5d2f8c88ba 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.h @@ -120,7 +120,7 @@ public: void closeSound(soundStruct *soundHandle); soundStruct *cloneSound(soundStruct *soundHandle); - bool isCompressed(soundStruct *soundHandle); + bool isSndDataExtComp(soundStruct *soundHandle); int getFreq(soundStruct *soundHandle); int getBits(soundStruct *soundHandle); int getChannels(soundStruct *soundHandle); diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index 6277cfdf01..75dde5e60f 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -52,8 +52,8 @@ int IMuseDigital::allocSlot(int priority) { for (l = 0; l < MAX_DIGITAL_TRACKS; l++) { Track *track = _track[l]; if (track->used && !track->toBeRemoved && - (lowest_priority > track->priority) && !track->stream2) { - lowest_priority = track->priority; + (lowest_priority > track->soundPriority) && !track->streamSou) { + lowest_priority = track->soundPriority; trackId = l; } } @@ -98,15 +98,15 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, track->volFadeDelay = 0; track->volFadeUsed = false; track->soundId = soundId; - track->started = false; + track->mixerStreamRunning = false; track->volGroupId = volGroupId; track->curHookId = hookId; - track->priority = priority; + track->soundPriority = priority; track->curRegion = -1; track->dataOffset = 0; track->regionOffset = 0; - track->mod = 0; - track->flags = 0; + track->dataMod12Bit = 0; + track->mixerFlags = 0; track->toBeRemoved = false; track->readyToRemove = false; track->soundType = soundType; @@ -114,19 +114,19 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int bits = 0, freq = 0, channels = 0; if (input) { - track->iteration = 0; - track->souStream = true; + track->feedSize = 0; + track->souStreamUsed = true; track->soundName[0] = 0; track->soundHandle = NULL; } else { - track->souStream = false; + track->souStreamUsed = false; strcpy(track->soundName, soundName); track->soundHandle = _sound->openSound(soundId, soundName, soundType, volGroupId, -1); if (track->soundHandle == NULL) return; - track->compressed = _sound->isCompressed(track->soundHandle); + track->sndDataExtComp = _sound->isSndDataExtComp(track->soundHandle); bits = _sound->getBits(track->soundHandle); channels = _sound->getChannels(track->soundHandle); @@ -145,28 +145,28 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, assert(channels == 1 || channels == 2); assert(0 < freq && freq <= 65535); - track->iteration = freq * channels; + track->feedSize = freq * channels; if (channels == 2) - track->flags = kFlagStereo | kFlagReverseStereo; + track->mixerFlags = kFlagStereo | kFlagReverseStereo; if ((bits == 12) || (bits == 16)) { - track->flags |= kFlag16Bits; - track->iteration *= 2; + track->mixerFlags |= kFlag16Bits; + track->feedSize *= 2; } else if (bits == 8) { - track->flags |= kFlagUnsigned; + track->mixerFlags |= kFlagUnsigned; } else error("IMuseDigital::startSound(): Can't handle %d bit samples", bits); #ifdef SCUMM_LITTLE_ENDIAN - if (track->compressed) - track->flags |= kFlagLittleEndian; + if (track->sndDataExtComp) + track->mixerFlags |= kFlagLittleEndian; #endif } if (input) { - track->stream2 = input; + track->streamSou = input; track->stream = NULL; - track->started = false; + track->mixerStreamRunning = false; } else { const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; @@ -179,11 +179,10 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, if (track->volGroupId == 3) type = Audio::Mixer::kMusicSoundType; - // setup 1 second stream wrapped buffer - track->stream2 = NULL; - track->stream = Audio::makeAppendableAudioStream(freq, makeMixerFlags(track->flags)); - _mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false); - track->started = true; + track->streamSou = NULL; + track->stream = Audio::makeAppendableAudioStream(freq, makeMixerFlags(track->mixerFlags)); + _mixer->playInputStream(type, &track->mixChanHandle, track->stream, -1, vol, pan, false); + track->mixerStreamRunning = true; } track->used = true; @@ -197,7 +196,7 @@ void IMuseDigital::setPriority(int soundId, int priority) { for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { Track *track = _track[l]; if ((track->soundId == soundId) && track->used && !track->toBeRemoved) { - track->priority = priority; + track->soundPriority = priority; } } } @@ -358,11 +357,10 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(const Track *track, int f type = Audio::Mixer::kPlainSoundType; break; } - fadeTrack->stream = Audio::makeAppendableAudioStream(_sound->getFreq(fadeTrack->soundHandle), makeMixerFlags(fadeTrack->flags)); - _mixer->playInputStream(type, &fadeTrack->handle, fadeTrack->stream, -1, fadeTrack->vol / 1000, fadeTrack->pan, false); + fadeTrack->stream = Audio::makeAppendableAudioStream(_sound->getFreq(fadeTrack->soundHandle), makeMixerFlags(fadeTrack->mixerFlags)); + _mixer->playInputStream(type, &fadeTrack->mixChanHandle, fadeTrack->stream, -1, fadeTrack->vol / 1000, fadeTrack->pan, false); - // Mark the track as, uhh, used & started (surprise, surprise :) - fadeTrack->started = true; + fadeTrack->mixerStreamRunning = true; fadeTrack->used = true; return fadeTrack; -- cgit v1.2.3