MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / AllocBuffer

Function AllocBuffer

Engine/lib/openal-soft/al/buffer.cpp:351–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351ALbuffer *AllocBuffer(ALCdevice *device)
352{
353 auto sublist = std::find_if(device->BufferList.begin(), device->BufferList.end(),
354 [](const BufferSubList &entry) noexcept -> bool
355 { return entry.FreeMask != 0; }
356 );
357
358 auto lidx = static_cast<ALuint>(std::distance(device->BufferList.begin(), sublist));
359 auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
360
361 ALbuffer *buffer{::new (sublist->Buffers + slidx) ALbuffer{}};
362
363 /* Add 1 to avoid buffer ID 0. */
364 buffer->id = ((lidx<<6) | slidx) + 1;
365
366 sublist->FreeMask &= ~(1_u64 << slidx);
367
368 return buffer;
369}
370
371void FreeBuffer(ALCdevice *device, ALbuffer *buffer)
372{

Callers 1

buffer.cppFile · 0.85

Calls 4

countr_zeroFunction · 0.85
distanceFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected