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

Function AllocFilter

3rdparty/openal/al/filter.cpp:309–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307
308
309ALfilter *AllocFilter(ALCdevice *device)
310{
311 auto sublist = std::find_if(device->FilterList.begin(), device->FilterList.end(),
312 [](const FilterSubList &entry) noexcept -> bool
313 { return entry.FreeMask != 0; }
314 );
315 auto lidx = static_cast<ALuint>(std::distance(device->FilterList.begin(), sublist));
316 auto slidx = static_cast<ALuint>(CTZ64(sublist->FreeMask));
317
318 ALfilter *filter{::new (sublist->Filters + slidx) ALfilter{}};
319 InitFilterParams(filter, AL_FILTER_NULL);
320
321 /* Add 1 to avoid filter ID 0. */
322 filter->id = ((lidx<<6) | slidx) + 1;
323
324 sublist->FreeMask &= ~(1_u64 << slidx);
325
326 return filter;
327}
328
329void FreeFilter(ALCdevice *device, ALfilter *filter)
330{

Callers 1

filter.cppFile · 0.85

Calls 4

distanceFunction · 0.85
InitFilterParamsFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected