本文整理汇总了C++中common::Serializer::syncArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::syncArray方法的具体用法?C++ Serializer::syncArray怎么用?C++ Serializer::syncArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::syncArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveLoadEarly
void IMuseDigital::saveLoadEarly(Common::Serializer &s) {
Common::StackLock lock(_mutex, "IMuseDigital::saveLoadEarly()");
s.skip(4, VER(31), VER(42)); // _volVoice
s.skip(4, VER(31), VER(42)); // _volSfx
s.skip(4, VER(31), VER(42)); // _volMusic
s.syncAsSint32LE(_curMusicState, VER(31));
s.syncAsSint32LE(_curMusicSeq, VER(31));
s.syncAsSint32LE(_curMusicCue, VER(31));
s.syncAsSint32LE(_nextSeqToPlay, VER(31));
s.syncAsByte(_radioChatterSFX, VER(76));
s.syncArray(_attributes, 188, Common::Serializer::Sint32LE, VER(31));
for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
Track *track = _track[l];
if (s.isLoading()) {
memset(track, 0, sizeof(Track));
}
syncWithSerializer(s, *track);
if (s.isLoading()) {
_track[l]->trackId = l;
if (!track->used)
continue;
if ((track->toBeRemoved) || (track->souStreamUsed) || (track->curRegion == -1)) {
track->used = false;
continue;
}
// TODO: The code below has a lot in common with that in IMuseDigital::startSound.
// Try to refactor them to reduce the code duplication.
track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, -1);
if (!track->soundDesc)
track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, 1);
if (!track->soundDesc)
track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, 2);
if (!track->soundDesc) {
warning("IMuseDigital::saveOrLoad: Can't open sound so will not be resumed");
track->used = false;
continue;
}
track->sndDataExtComp = _sound->isSndDataExtComp(track->soundDesc);
track->dataOffset = _sound->getRegionOffset(track->soundDesc, track->curRegion);
int bits = _sound->getBits(track->soundDesc);
int channels = _sound->getChannels(track->soundDesc);
int freq = _sound->getFreq(track->soundDesc);
track->feedSize = freq * channels;
track->mixerFlags = 0;
if (channels == 2)
track->mixerFlags = kFlagStereo;
if ((bits == 12) || (bits == 16)) {
track->mixerFlags |= kFlag16Bits;
track->feedSize *= 2;
} else if (bits == 8) {
track->mixerFlags |= kFlagUnsigned;
} else
error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits);
track->stream = Audio::makeQueuingAudioStream(freq, (track->mixerFlags & kFlagStereo) != 0);
_mixer->playStream(track->getType(), &track->mixChanHandle, track->stream, -1, track->getVol(), track->getPan());
_mixer->pauseHandle(track->mixChanHandle, true);
}
}
}