MCPcopy Create free account
hub / github.com/crownengine/crown / getWriteVector

Method getWriteVector

3rdparty/openal/alc/ringbuffer.cpp:222–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222ll_ringbuffer_data_pair RingBuffer::getWriteVector() const noexcept
223{
224 ll_ringbuffer_data_pair ret;
225
226 size_t w{mWritePtr.load(std::memory_order_acquire)};
227 size_t r{mReadPtr.load(std::memory_order_acquire) + mWriteSize - mSizeMask};
228 w &= mSizeMask;
229 r &= mSizeMask;
230 const size_t free_cnt{(r-w-1) & mSizeMask};
231
232 const size_t cnt2{w + free_cnt};
233 if(cnt2 > mSizeMask+1)
234 {
235 /* Two part vector: the rest of the buffer after the current write ptr,
236 * plus some from the start of the buffer. */
237 ret.first.buf = const_cast<al::byte*>(mBuffer.data() + w*mElemSize);
238 ret.first.len = mSizeMask+1 - w;
239 ret.second.buf = const_cast<al::byte*>(mBuffer.data());
240 ret.second.len = cnt2 & mSizeMask;
241 }
242 else
243 {
244 ret.first.buf = const_cast<al::byte*>(mBuffer.data() + w*mElemSize);
245 ret.first.len = free_cnt;
246 ret.second.buf = nullptr;
247 ret.second.len = 0;
248 }
249
250 return ret;
251}

Callers 14

SendStateChangeEventFunction · 0.80
StopEventThrdFunction · 0.80
CalcEffectSlotParamsFunction · 0.80
aluHandleDisconnectFunction · 0.80
SendSourceStoppedEventFunction · 0.80
voice.cppFile · 0.80
mixerProcMethod · 0.80
RecordProcMethod · 0.80
recordProcMethod · 0.80
availableSamplesMethod · 0.80
mixerProcMethod · 0.80
openMethod · 0.80

Calls 2

loadMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected