| 68 | } |
| 69 | |
| 70 | void LoopStorer::Poll() |
| 71 | { |
| 72 | if (mLooper == nullptr) |
| 73 | return; |
| 74 | |
| 75 | assert(mSamples[0]->mBuffer != mSamples[1]->mBuffer); |
| 76 | |
| 77 | for (int i = 0; i < mSamples.size(); ++i) |
| 78 | mSamples[i]->mIsCurrentBuffer = (i == mCurrentBufferIdx); |
| 79 | |
| 80 | if (mIsSwapping) |
| 81 | { |
| 82 | int loopLength; |
| 83 | ChannelBuffer* buffer = mLooper->GetLoopBuffer(loopLength); |
| 84 | if (buffer == mSamples[mCurrentBufferIdx]->mBuffer) //finished swap |
| 85 | mIsSwapping = false; |
| 86 | } |
| 87 | |
| 88 | if (!mIsSwapping) |
| 89 | { |
| 90 | mSwapMutex.lock(); |
| 91 | int loopLength; |
| 92 | mSamples[mCurrentBufferIdx]->mBuffer = mLooper->GetLoopBuffer(loopLength); |
| 93 | mSamples[mCurrentBufferIdx]->mNumBars = mLooper->GetNumBars(); |
| 94 | mSamples[mCurrentBufferIdx]->mBufferLength = loopLength; |
| 95 | mSwapMutex.unlock(); |
| 96 | } |
| 97 | |
| 98 | assert(mSamples[0]->mBuffer != mSamples[1]->mBuffer); |
| 99 | } |
| 100 | |
| 101 | void LoopStorer::DrawModule() |
| 102 | { |
nothing calls this directly
no test coverage detected