| 274 | } |
| 275 | |
| 276 | void LoopStorer::LoadState(FileStreamIn& in, int rev) |
| 277 | { |
| 278 | IDrawableModule::LoadState(in, rev); |
| 279 | |
| 280 | if (ModularSynth::sLoadingFileSaveStateRev < 423) |
| 281 | in >> rev; |
| 282 | LoadStateValidate(rev <= GetModuleSaveStateRev()); |
| 283 | |
| 284 | in >> mCurrentBufferIdx; |
| 285 | mQueuedSwapBufferIdx = -1; |
| 286 | for (int i = 0; i < mSamples.size(); ++i) |
| 287 | mSamples[i]->mIsCurrentBuffer = (i == mCurrentBufferIdx); |
| 288 | |
| 289 | if (mCurrentBufferIdx != 0) |
| 290 | { |
| 291 | mSamples[0]->mBuffer = mSamples[mCurrentBufferIdx]->mBuffer; |
| 292 | |
| 293 | int loopLength; |
| 294 | mSamples[mCurrentBufferIdx]->mBuffer = mLooper->GetLoopBuffer(loopLength); |
| 295 | mSamples[mCurrentBufferIdx]->mNumBars = mLooper->GetNumBars(); |
| 296 | mSamples[mCurrentBufferIdx]->mBufferLength = loopLength; |
| 297 | } |
| 298 | |
| 299 | mLoadMutex.lock(); |
| 300 | for (auto* sampleData : mSamples) |
| 301 | { |
| 302 | if (!sampleData->mIsCurrentBuffer) |
| 303 | { |
| 304 | in >> sampleData->mNumBars; |
| 305 | in >> sampleData->mBufferLength; |
| 306 | if (sampleData->mBufferLength != -1) |
| 307 | { |
| 308 | int readLength; |
| 309 | sampleData->mBuffer->Load(in, readLength, ChannelBuffer::LoadMode::kAnyBufferSize); |
| 310 | assert(sampleData->mBufferLength == sampleData->mBuffer->BufferSize()); |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | mLoadMutex.unlock(); |
| 315 | } |
| 316 | |
| 317 | LoopStorer::SampleData::SampleData() |
| 318 | { |
nothing calls this directly
no test coverage detected