MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Poll

Method Poll

Source/LoopStorer.cpp:70–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void 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
101void LoopStorer::DrawModule()
102{

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
GetLoopBufferMethod · 0.80
GetNumBarsMethod · 0.45

Tested by

no test coverage detected