| 178 | } |
| 179 | |
| 180 | ALeffect *AllocEffect(ALCdevice *device) |
| 181 | { |
| 182 | auto sublist = std::find_if(device->EffectList.begin(), device->EffectList.end(), |
| 183 | [](const EffectSubList &entry) noexcept -> bool |
| 184 | { return entry.FreeMask != 0; } |
| 185 | ); |
| 186 | auto lidx = static_cast<ALuint>(std::distance(device->EffectList.begin(), sublist)); |
| 187 | auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask)); |
| 188 | |
| 189 | ALeffect *effect{::new (sublist->Effects + slidx) ALeffect{}}; |
| 190 | InitEffectParams(effect, AL_EFFECT_NULL); |
| 191 | |
| 192 | /* Add 1 to avoid effect ID 0. */ |
| 193 | effect->id = ((lidx<<6) | slidx) + 1; |
| 194 | |
| 195 | sublist->FreeMask &= ~(1_u64 << slidx); |
| 196 | |
| 197 | return effect; |
| 198 | } |
| 199 | |
| 200 | void FreeEffect(ALCdevice *device, ALeffect *effect) |
| 201 | { |
no test coverage detected