diff options
| author | David Corrales | 2007-06-23 18:51:33 +0000 |
|---|---|---|
| committer | David Corrales | 2007-06-23 18:51:33 +0000 |
| commit | cacd7a28fd51d960947de88abbf30c487e66529d (patch) | |
| tree | f3baa59853bfb307e452b86b9d93c4737b1fa6ab /engines/scumm/imuse_digi | |
| parent | 0ac96302fe9c04df79cb01a77d19535b45fe2db0 (diff) | |
| parent | 90c2210dae8c91fa8babc6b05564e15c9d445d18 (diff) | |
| download | scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.gz scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.bz2 scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.zip | |
Merged the FSNode branch with trunk r27031:27680
svn-id: r27681
Diffstat (limited to 'engines/scumm/imuse_digi')
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 128 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse.h | 90 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_bndmgr.cpp | 94 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_bndmgr.h | 21 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_codecs.cpp | 150 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_music.cpp | 18 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_script.cpp | 24 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 2 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.h | 2 | ||||
| -rw-r--r-- | engines/scumm/imuse_digi/dimuse_track.cpp | 56 |
10 files changed, 292 insertions, 293 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index bee1a56b82..0221657966 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); } } } @@ -275,8 +275,8 @@ void IMuseDigital::callback() { type = Audio::Mixer::kMusicSoundType; if (track->stream) { - byte *data = NULL; - int32 result = 0; + byte *tmpSndBufferPtr = NULL; + int32 curFeedSize = 0; if (track->curRegion == -1) { switchToNextRegion(track); @@ -287,81 +287,81 @@ void IMuseDigital::callback() { int bits = _sound->getBits(track->soundHandle); int channels = _sound->getChannels(track->soundHandle); - int32 mixer_size = track->iteration / _callbackFps; + int32 feedSize = track->feedSize / _callbackFps; if (track->stream->endOfData()) { - mixer_size *= 2; + feedSize *= 2; } if ((bits == 12) || (bits == 16)) { if (channels == 1) - mixer_size &= ~1; + feedSize &= ~1; if (channels == 2) - mixer_size &= ~3; + feedSize &= ~3; } else { if (channels == 2) - mixer_size &= ~1; + feedSize &= ~1; } - if (mixer_size == 0) + if (feedSize == 0) continue; do { if (bits == 12) { - byte *ptr = NULL; + byte *tmpPtr = NULL; - mixer_size += track->mod; - int mixer_size_12 = (mixer_size * 3) / 4; - int length = (mixer_size_12 / 3) * 4; - track->mod = mixer_size - length; + feedSize += track->dataMod12Bit; + int tmpFeedSize12Bits = (feedSize * 3) / 4; + int tmpLength12Bits = (tmpFeedSize12Bits / 3) * 4; + track->dataMod12Bit = feedSize - tmpLength12Bits; - int32 offset = (track->regionOffset * 3) / 4; - int result2 = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &ptr, offset, mixer_size_12); - result = BundleCodecs::decode12BitsSample(ptr, &data, result2); + int32 tmpOffset = (track->regionOffset * 3) / 4; + int tmpFeedSize = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &tmpPtr, tmpOffset, tmpFeedSize12Bits); + curFeedSize = BundleCodecs::decode12BitsSample(tmpPtr, &tmpSndBufferPtr, tmpFeedSize); - free(ptr); + free(tmpPtr); } else if (bits == 16) { - result = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &data, track->regionOffset, mixer_size); + curFeedSize = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &tmpSndBufferPtr, track->regionOffset, feedSize); if (channels == 1) { - result &= ~1; + curFeedSize &= ~1; } if (channels == 2) { - result &= ~3; + curFeedSize &= ~3; } } else if (bits == 8) { - result = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &data, track->regionOffset, mixer_size); + curFeedSize = _sound->getDataFromRegion(track->soundHandle, track->curRegion, &tmpSndBufferPtr, track->regionOffset, feedSize); if (channels == 2) { - result &= ~1; + curFeedSize &= ~1; } } - if (result > mixer_size) - result = mixer_size; + if (curFeedSize > feedSize) + curFeedSize = feedSize; if (_mixer->isReady()) { - _mixer->setChannelVolume(track->handle, vol); - _mixer->setChannelBalance(track->handle, pan); - track->stream->queueBuffer(data, result); - track->regionOffset += result; + _mixer->setChannelVolume(track->mixChanHandle, vol); + _mixer->setChannelBalance(track->mixChanHandle, pan); + track->stream->queueBuffer(tmpSndBufferPtr, curFeedSize); + track->regionOffset += curFeedSize; } else - delete[] data; + delete[] tmpSndBufferPtr; if (_sound->isEndOfRegion(track->soundHandle, track->curRegion)) { switchToNextRegion(track); if (track->toBeRemoved) break; } - mixer_size -= result; - assert(mixer_size >= 0); - } while (mixer_size != 0); - } else if (track->stream2) { + feedSize -= curFeedSize; + assert(feedSize >= 0); + } while (feedSize != 0); + } 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 8cfe0f8542..1b088298df 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -67,41 +67,41 @@ enum { class IMuseDigital : public MusicEngine { private: - int _callbackFps; + int _callbackFps; // value how many times callback needs to be called per second struct Track { - int trackId; - - int8 pan; // pan - int32 vol; // volume - int32 volFadeDest; // - int32 volFadeStep; // - int32 volFadeDelay; // - bool volFadeUsed; // - - int32 soundId; - char soundName[15]; - bool used; - bool toBeRemoved; - bool readyToRemove; - bool started; - bool souStream; - bool compressed; - int32 priority; - int32 regionOffset; - int32 dataOffset; - int32 curRegion; - int32 curHookId; - int32 volGroupId; - int32 soundType; - int32 iteration; - int32 mod; - int32 flags; - - ImuseDigiSndMgr::soundStruct *soundHandle; - Audio::SoundHandle handle; - Audio::AppendableAudioStream *stream; - Audio::AudioStream *stream2; + int trackId; // used to identify track by value (0-15) + + int8 pan; // panning value of sound + int32 vol; // volume level (values 0-127 * 1000) + int32 volFadeDest; // volume level which fading target (values 0-127 * 1000) + int32 volFadeStep; // delta of step while changing volume at each imuse callback + int32 volFadeDelay; // time in ms how long fading volume must be + bool volFadeUsed; // flag if fading is in progress + + int32 soundId; // sound id used by scumm script + char soundName[15]; // sound name but also filename of sound in bundle data + 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 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 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 mixChanHandle; // sound mixer's channel handle + Audio::AppendableAudioStream *stream; // sound mixer's audio stream handle for *.la1 and *.bun + Audio::AudioStream *streamSou; // sound mixer's audio stream handle for *.sou Track(); }; @@ -113,16 +113,16 @@ private: Audio::Mixer *_mixer; ImuseDigiSndMgr *_sound; - char *_audioNames; - int32 _numAudioNames; + char *_audioNames; // filenames of sound SFX used in FT + int32 _numAudioNames; // number of above filenames - bool _pause; + bool _pause; // flag mean that iMuse callback should be idle - int32 _attributes[188]; - int32 _nextSeqToPlay; - int32 _curMusicState; - int32 _curMusicSeq; - int32 _curMusicCue; + int32 _attributes[188]; // internal atributes for each music file to store and check later + int32 _nextSeqToPlay; // id of sequence type of music needed played + int32 _curMusicState; // current or previous id of music + int32 _curMusicSeq; // current or previous id of sequence music + int32 _curMusicCue; // current cue for current music. used in FT int32 makeMixerFlags(int32 flags); static void timer_handler(void *refConf); @@ -201,7 +201,7 @@ struct imuseRoomMap { }; struct imuseDigTable { - byte opcode; + byte transitionType; int16 soundId; char name[20]; byte atribPos; @@ -210,7 +210,7 @@ struct imuseDigTable { }; struct imuseComiTable { - byte opcode; + byte transitionType; int16 soundId; char name[20]; byte atribPos; @@ -226,14 +226,14 @@ struct imuseFtNames { struct imuseFtStateTable { char audioName[9]; - byte opcode; + byte transitionType; byte volume; char name[21]; }; struct imuseFtSeqTable { char audioName[9]; - byte opcode; + byte transitionType; byte volume; }; diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index 6592be8848..03b3e4e74a 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -36,7 +36,7 @@ BundleDirCache::BundleDirCache() { _budleDirCache[fileId].bundleTable = NULL; _budleDirCache[fileId].fileName[0] = 0; _budleDirCache[fileId].numFiles = 0; - _budleDirCache[fileId].compressedBun = false; + _budleDirCache[fileId].isCompressed = false; _budleDirCache[fileId].indexTable = NULL; } } @@ -60,8 +60,8 @@ BundleDirCache::IndexNode *BundleDirCache::getIndexTable(int slot) { return _budleDirCache[slot].indexTable; } -bool BundleDirCache::isCompressed(int slot) { - return _budleDirCache[slot].compressedBun; +bool BundleDirCache::isSndDataExtComp(int slot) { + return _budleDirCache[slot].isCompressed; } int BundleDirCache::matchFile(const char *filename) { @@ -93,7 +93,7 @@ int BundleDirCache::matchFile(const char *filename) { tag = file.readUint32BE(); if (tag == MKID_BE('LB23')) - _budleDirCache[freeSlot].compressedBun = true; + _budleDirCache[freeSlot].isCompressed = true; offset = file.readUint32BE(); strcpy(_budleDirCache[freeSlot].fileName, filename); @@ -146,10 +146,10 @@ BundleMgr::BundleMgr(BundleDirCache *cache) { _compTable = NULL; _numFiles = 0; _numCompItems = 0; - _curSample = -1; + _curSampleId = -1; _fileBundleId = -1; _file = new ScummFile(); - _compInput = NULL; + _compInputBuff = NULL; } BundleMgr::~BundleMgr() { @@ -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); @@ -209,11 +209,11 @@ void BundleMgr::close() { _compTableLoaded = false; _lastBlock = -1; _outputSize = 0; - _curSample = -1; + _curSampleId = -1; free(_compTable); _compTable = NULL; - free(_compInput); - _compInput = NULL; + free(_compInputBuff); + _compInputBuff = NULL; } } @@ -241,19 +241,19 @@ bool BundleMgr::loadCompTable(int32 index) { maxSize = _compTable[i].size; } // CMI hack: one more byte at the end of input buffer - _compInput = (byte *)malloc(maxSize + 1); - assert(_compInput); + _compInputBuff = (byte *)malloc(maxSize + 1); + assert(_compInputBuff); return true; } -int32 BundleMgr::decompressSampleByCurIndex(int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside) { - return decompressSampleByIndex(_curSample, offset, size, comp_final, header_size, header_outside); +int32 BundleMgr::decompressSampleByCurIndex(int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside) { + return decompressSampleByIndex(_curSampleId, offset, size, compFinal, headerSize, headerOutside); } -int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside) { - int32 i, final_size, output_size; - int skip, first_block, last_block; +int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside) { + int32 i, finalSize, outputSize; + int skip, firstBlock, lastBlock; assert(0 <= index && index < _numFiles); @@ -262,10 +262,10 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, return 0; } - if (_curSample == -1) - _curSample = index; + if (_curSampleId == -1) + _curSampleId = index; - assert(_curSample == index); + assert(_curSampleId == index); if (!_compTableLoaded) { _compTableLoaded = loadCompTable(index); @@ -273,54 +273,54 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, return 0; } - first_block = (offset + header_size) / 0x2000; - last_block = (offset + header_size + size - 1) / 0x2000; + firstBlock = (offset + headerSize) / 0x2000; + lastBlock = (offset + headerSize + size - 1) / 0x2000; // Clip last_block by the total number of blocks (= "comp items") - if ((last_block >= _numCompItems) && (_numCompItems > 0)) - last_block = _numCompItems - 1; + if ((lastBlock >= _numCompItems) && (_numCompItems > 0)) + lastBlock = _numCompItems - 1; - int32 blocks_final_size = 0x2000 * (1 + last_block - first_block); - *comp_final = (byte *)malloc(blocks_final_size); - assert(*comp_final); - final_size = 0; + int32 blocksFinalSize = 0x2000 * (1 + lastBlock - firstBlock); + *compFinal = (byte *)malloc(blocksFinalSize); + assert(*compFinal); + finalSize = 0; - skip = (offset + header_size) % 0x2000; + skip = (offset + headerSize) % 0x2000; - for (i = first_block; i <= last_block; i++) { + for (i = firstBlock; i <= lastBlock; i++) { if (_lastBlock != i) { // CMI hack: one more zero byte at the end of input buffer - _compInput[_compTable[i].size] = 0; + _compInputBuff[_compTable[i].size] = 0; _file->seek(_bundleTable[index].offset + _compTable[i].offset, SEEK_SET); - _file->read(_compInput, _compTable[i].size); - _outputSize = BundleCodecs::decompressCodec(_compTable[i].codec, _compInput, _compOutput, _compTable[i].size); + _file->read(_compInputBuff, _compTable[i].size); + _outputSize = BundleCodecs::decompressCodec(_compTable[i].codec, _compInputBuff, _compOutputBuff, _compTable[i].size); if (_outputSize > 0x2000) { error("_outputSize: %d", _outputSize); } _lastBlock = i; } - output_size = _outputSize; + outputSize = _outputSize; - if (header_outside) { - output_size -= skip; + if (headerOutside) { + outputSize -= skip; } else { - if ((header_size != 0) && (skip >= header_size)) - output_size -= skip; + if ((headerSize != 0) && (skip >= headerSize)) + outputSize -= skip; } - if ((output_size + skip) > 0x2000) // workaround - output_size -= (output_size + skip) - 0x2000; + if ((outputSize + skip) > 0x2000) // workaround + outputSize -= (outputSize + skip) - 0x2000; - if (output_size > size) - output_size = size; + if (outputSize > size) + outputSize = size; - assert(final_size + output_size <= blocks_final_size); + assert(finalSize + outputSize <= blocksFinalSize); - memcpy(*comp_final + final_size, _compOutput + skip, output_size); - final_size += output_size; + memcpy(*compFinal + finalSize, _compOutputBuff + skip, outputSize); + finalSize += outputSize; - size -= output_size; + size -= outputSize; assert(size >= 0); if (size == 0) break; @@ -328,7 +328,7 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, skip = 0; } - return final_size; + return finalSize; } int32 BundleMgr::decompressSampleByName(const char *name, int32 offset, int32 size, byte **comp_final, bool header_outside) { diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.h b/engines/scumm/imuse_digi/dimuse_bndmgr.h index ba044a24ed..65360d8ba4 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.h @@ -51,7 +51,7 @@ private: char fileName[20]; AudioTable *bundleTable; int32 numFiles; - bool compressedBun; + bool isCompressed; IndexNode *indexTable; } _budleDirCache[4]; @@ -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 { @@ -80,14 +80,15 @@ private: BundleDirCache::AudioTable *_bundleTable; BundleDirCache::IndexNode *_indexTable; CompTable *_compTable; + int _numFiles; int _numCompItems; - int _curSample; + int _curSampleId; BaseScummFile *_file; bool _compTableLoaded; int _fileBundleId; - byte _compOutput[0x2000]; - byte *_compInput; + byte _compOutputBuff[0x2000]; + byte *_compInputBuff; int _outputSize; int _lastBlock; @@ -98,19 +99,19 @@ public: BundleMgr(BundleDirCache *_cache); ~BundleMgr(); - bool open(const char *filename, bool &compressed, bool errorFlag=false); + bool open(const char *filename, bool &compressed, bool errorFlag = false); void close(); Common::File *getFile(const char *filename, int32 &offset, int32 &size); - int32 decompressSampleByName(const char *name, int32 offset, int32 size, byte **comp_final, bool header_outside); - int32 decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside); - int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **comp_final, int header_size, bool header_outside); + int32 decompressSampleByName(const char *name, int32 offset, int32 size, byte **compFinal, bool headerOutside); + int32 decompressSampleByIndex(int32 index, int32 offset, int32 size, byte **compFinal, int header_size, bool headerOutside); + int32 decompressSampleByCurIndex(int32 offset, int32 size, byte **compFinal, int headerSize, bool headerOutside); }; namespace BundleCodecs { uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size); void initializeImcTables(); -int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 input_size); +int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize); } // End of namespace BundleCodecs diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp index 601bfddbe9..17082f5256 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.cpp +++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp @@ -188,51 +188,51 @@ static int32 compDecode(byte *src, byte *dst) { } #undef NextBit -int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 input_size) { - int32 output_size, channels; +int32 decompressCodec(int32 codec, byte *compInput, byte *compOutput, int32 inputSize) { + int32 outputSize, channels; int32 offset1, offset2, offset3, length, k, c, s, j, r, t, z; byte *src, *t_table, *p, *ptr; byte t_tmp1, t_tmp2; switch (codec) { case 0: - memcpy(comp_output, comp_input, input_size); - output_size = input_size; + memcpy(compOutput, compInput, inputSize); + outputSize = inputSize; break; case 1: - output_size = compDecode(comp_input, comp_output); + outputSize = compDecode(compInput, compOutput); break; case 2: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 1; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; break; case 3: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; break; case 4: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; - t_table = (byte *)malloc(output_size); + t_table = (byte *)malloc(outputSize); assert(t_table); - src = comp_output; - length = (output_size << 3) / 12; + src = compOutput; + length = (outputSize << 3) / 12; k = 0; if (length > 0) { c = -12; @@ -258,23 +258,23 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in } offset1 = ((length - 1) * 3) >> 1; t_table[offset1 + 1] = (t_table[offset1 + 1]) | (src[length - 1] & 0xf0); - memcpy(src, t_table, output_size); + memcpy(src, t_table, outputSize); free(t_table); break; case 5: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; - t_table = (byte *)malloc(output_size); + t_table = (byte *)malloc(outputSize); assert(t_table); - src = comp_output; - length = (output_size << 3) / 12; + src = compOutput; + length = (outputSize << 3) / 12; k = 1; c = 0; s = 12; @@ -300,29 +300,29 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in j++; } while (k < t); } - memcpy(src, t_table, output_size); + memcpy(src, t_table, outputSize); free(t_table); break; case 6: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; - t_table = (byte *)malloc(output_size); + t_table = (byte *)malloc(outputSize); assert(t_table); - src = comp_output; - length = (output_size << 3) / 12; + src = compOutput; + length = (outputSize << 3) / 12; k = 0; c = 0; j = 0; s = -12; - t_table[0] = src[output_size - 1]; - t_table[output_size - 1] = src[length - 1]; + t_table[0] = src[outputSize - 1]; + t_table[outputSize - 1] = src[length - 1]; t = length - 1; if (t > 0) { do { @@ -343,26 +343,26 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in j++; } while (k < t); } - memcpy(src, t_table, output_size); + memcpy(src, t_table, outputSize); free(t_table); break; case 10: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; - t_table = (byte *)malloc(output_size); + t_table = (byte *)malloc(outputSize); assert(t_table); - memcpy(t_table, p, output_size); + memcpy(t_table, p, outputSize); - offset1 = output_size / 3; + offset1 = outputSize / 3; offset2 = offset1 << 1; offset3 = offset2; - src = comp_output; + src = compOutput; while (offset1--) { offset2 -= 2; @@ -371,8 +371,8 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in t_table[offset2 + 1] = src[offset3]; } - src = comp_output; - length = (output_size << 3) / 12; + src = compOutput; + length = (outputSize << 3) / 12; k = 0; if (length > 0) { c = -12; @@ -402,21 +402,21 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in break; case 11: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; - t_table = (byte *)malloc(output_size); + t_table = (byte *)malloc(outputSize); assert(t_table); - memcpy(t_table, p, output_size); + memcpy(t_table, p, outputSize); - offset1 = output_size / 3; + offset1 = outputSize / 3; offset2 = offset1 << 1; offset3 = offset2; - src = comp_output; + src = compOutput; while (offset1--) { offset2 -= 2; @@ -425,8 +425,8 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in t_table[offset2 + 1] = src[offset3]; } - src = comp_output; - length = (output_size << 3) / 12; + src = compOutput; + length = (outputSize << 3) / 12; k = 1; c = 0; s = 12; @@ -456,21 +456,21 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in break; case 12: - output_size = compDecode(comp_input, comp_output); - p = comp_output; - for (z = 2; z < output_size; z++) + outputSize = compDecode(compInput, compOutput); + p = compOutput; + for (z = 2; z < outputSize; z++) p[z] += p[z - 1]; - for (z = 1; z < output_size; z++) + for (z = 1; z < outputSize; z++) p[z] += p[z - 1]; - t_table = (byte *)malloc(output_size); + t_table = (byte *)malloc(outputSize); assert(t_table); - memcpy(t_table, p, output_size); + memcpy(t_table, p, outputSize); - offset1 = output_size / 3; + offset1 = outputSize / 3; offset2 = offset1 << 1; offset3 = offset2; - src = comp_output; + src = compOutput; while (offset1--) { offset2 -= 2; @@ -479,13 +479,13 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in t_table[offset2 + 1] = src[offset3]; } - src = comp_output; - length = (output_size << 3) / 12; + src = compOutput; + length = (outputSize << 3) / 12; k = 0; c = 0; s = -12; - src[0] = t_table[output_size - 1]; - src[output_size - 1] = t_table[length - 1]; + src[0] = t_table[outputSize - 1]; + src[outputSize - 1] = t_table[length - 1]; t = length - 1; if (t > 0) { do { @@ -536,9 +536,9 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in // We only support mono and stereo assert(channels == 1 || channels == 2); - src = comp_input; - dst = comp_output; - output_size = 0x2000; + src = compInput; + dst = compOutput; + outputSize = 0x2000; outputSamplesLeft = 0x1000; // Every data packet contains 0x2000 bytes of audio data @@ -641,11 +641,11 @@ int32 decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 in default: error("BundleCodecs::decompressCodec() Unknown codec %d!", (int)codec); - output_size = 0; + outputSize = 0; break; } - return output_size; + return outputSize; } } // End of namespace BundleCodecs diff --git a/engines/scumm/imuse_digi/dimuse_music.cpp b/engines/scumm/imuse_digi/dimuse_music.cpp index ad734c7311..bdfc4bf4fa 100644 --- a/engines/scumm/imuse_digi/dimuse_music.cpp +++ b/engines/scumm/imuse_digi/dimuse_music.cpp @@ -110,7 +110,7 @@ void IMuseDigital::setDigMusicSequence(int seqId) { _nextSeqToPlay = 0; _attributes[DIG_SEQ_OFFSET + num] = 1; } else { - if ((_digSeqMusicTable[_curMusicSeq].opcode == 4) || (_digSeqMusicTable[_curMusicSeq].opcode == 6)) { + if ((_digSeqMusicTable[_curMusicSeq].transitionType == 4) || (_digSeqMusicTable[_curMusicSeq].transitionType == 6)) { _nextSeqToPlay = num; return; } else { @@ -174,7 +174,7 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table fadeOutMusic(120); - switch (table->opcode) { + switch (table->transitionType) { case 0: case 5: case 6: @@ -252,7 +252,7 @@ void IMuseDigital::setComiMusicSequence(int seqId) { playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true); _nextSeqToPlay = 0; } else { - if ((_comiSeqMusicTable[_curMusicSeq].opcode == 4) || (_comiSeqMusicTable[_curMusicSeq].opcode == 6)) { + if ((_comiSeqMusicTable[_curMusicSeq].transitionType == 4) || (_comiSeqMusicTable[_curMusicSeq].transitionType == 6)) { _nextSeqToPlay = num; return; } else { @@ -295,7 +295,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab } } - switch (table->opcode) { + switch (table->transitionType) { case 0: fadeOutMusic(120); break; @@ -333,7 +333,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab startMusic(table->filename, table->soundId, 0, 127); return; } - if (table->opcode == 12) { + if (table->transitionType == 12) { startMusic(table->filename, table->soundId, table->hookId, 127); } else { startMusic(table->filename, table->soundId, hookId, 127); @@ -355,7 +355,7 @@ void IMuseDigital::setFtMusicState(int stateId) { if (stateId == 0) playFtMusic(NULL, 0, 0); else - playFtMusic(_ftStateMusicTable[stateId].audioName, _ftStateMusicTable[stateId].opcode, _ftStateMusicTable[stateId].volume); + playFtMusic(_ftStateMusicTable[stateId].audioName, _ftStateMusicTable[stateId].transitionType, _ftStateMusicTable[stateId].volume); } _curMusicState = stateId; @@ -374,11 +374,11 @@ void IMuseDigital::setFtMusicSequence(int seqId) { if (_curMusicState == 0) playFtMusic(NULL, 0, 0); else { - playFtMusic(_ftStateMusicTable[_curMusicState].audioName, _ftStateMusicTable[_curMusicState].opcode, _ftStateMusicTable[_curMusicState].volume); + playFtMusic(_ftStateMusicTable[_curMusicState].audioName, _ftStateMusicTable[_curMusicState].transitionType, _ftStateMusicTable[_curMusicState].volume); } } else { int seq = (seqId - 1) * 4; - playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].opcode, _ftSeqMusicTable[seq].volume); + playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].transitionType, _ftSeqMusicTable[seq].volume); } _curMusicSeq = seqId; @@ -401,7 +401,7 @@ void IMuseDigital::setFtMusicCuePoint(int cueId) { playFtMusic(NULL, 0, 0); else { int seq = ((_curMusicSeq - 1) * 4) + cueId; - playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].opcode, _ftSeqMusicTable[seq].volume); + playFtMusic(_ftSeqMusicTable[seq].audioName, _ftSeqMusicTable[seq].transitionType, _ftSeqMusicTable[seq].volume); } _curMusicCue = cueId; 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; |
