MCPcopy Create free account
hub / github.com/audacity/audacity / Clear

Method Clear

libraries/lib-audio-io/RingBuffer.cpp:164–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164size_t RingBuffer::Clear(sampleFormat format, size_t samplesToClear)
165{
166 auto start = mStart.load( std::memory_order_acquire );
167 auto end = mWritten;
168 samplesToClear = std::min( samplesToClear, Free( start, end ) );
169 size_t cleared = 0;
170 auto pos = end;
171
172 while(samplesToClear) {
173 auto block = std::min( samplesToClear, mBufferSize - pos );
174
175 ClearSamples(mBuffer.ptr(), format, pos, block);
176
177 pos = (pos + block) % mBufferSize;
178 samplesToClear -= block;
179 cleared += block;
180 }
181
182 mWritten = pos;
183
184 return cleared;
185}
186
187std::pair<samplePtr, size_t> RingBuffer::GetUnflushed(unsigned iBlock)
188{

Callers 3

StartStreamMethod · 0.45
StartStreamCleanupMethod · 0.45
StopStreamMethod · 0.45

Calls 4

ClearSamplesFunction · 0.85
ptrMethod · 0.80
minFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected