mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-15 01:24:35 +02:00
#23 fix reverberation after all channels ends
This commit is contained in:
22
src/sound.h
22
src/sound.h
@@ -633,11 +633,22 @@ namespace Sound {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void convFrames(FrameHI *from, Frame *to, int count) {
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
to[i].L = clamp(from[i].L, -32768, 32767);
|
||||||
|
to[i].R = clamp(from[i].R, -32768, 32767);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void fill(Frame *frames, int count) {
|
void fill(Frame *frames, int count) {
|
||||||
if (!channelsCount) {
|
if (!channelsCount) {
|
||||||
memset(frames, 0, sizeof(frames[0]) * count);
|
if (result) {
|
||||||
//if (Core::settings.audio.reverb)
|
memset(result, 0, sizeof(FrameHI) * count);
|
||||||
// reverb.process(frames, count);
|
if (Core::settings.audio.reverb)
|
||||||
|
reverb.process(result, count);
|
||||||
|
convFrames(result, frames, count);
|
||||||
|
} else
|
||||||
|
memset(frames, 0, sizeof(frames[0]) * count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,10 +662,7 @@ namespace Sound {
|
|||||||
|
|
||||||
renderChannels(result, count, true);
|
renderChannels(result, count, true);
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
convFrames(result, frames, count);
|
||||||
frames[i].L = clamp(result[i].L, -32768, 32767);
|
|
||||||
frames[i].R = clamp(result[i].R, -32768, 32767);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < channelsCount; i++)
|
for (int i = 0; i < channelsCount; i++)
|
||||||
if (!channels[i]->isPlaying) {
|
if (!channels[i]->isPlaying) {
|
||||||
|
Reference in New Issue
Block a user