Use memmove instead of memcpy as the blocks overlap.

This commit is contained in:
Kai Blaschke 2024-02-18 13:36:37 +01:00 committed by Kai Blaschke
parent 30e1871d3f
commit c731eedeaf
No known key found for this signature in database
GPG Key ID: B014B6811527389F

View File

@ -433,7 +433,7 @@ void Voice::update(float dt, PositionalAttenuationFunction positionalAttenuation
speaker->channelVolumes = Vec2F::filled(1.0f); speaker->channelVolumes = Vec2F::filled(1.0f);
auto& dbHistory = speaker->dbHistory; auto& dbHistory = speaker->dbHistory;
memcpy(&dbHistory[1], &dbHistory[0], (dbHistory.size() - 1) * sizeof(float)); memmove(&dbHistory[1], &dbHistory[0], (dbHistory.size() - 1) * sizeof(float));
dbHistory[0] = speaker->decibelLevel; dbHistory[0] = speaker->decibelLevel;
float smoothDb = 0.0f; float smoothDb = 0.0f;
for (float dB : dbHistory) for (float dB : dbHistory)