1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
From 7c22f265b8928aca6e5706ab3a8bab2de0e24b8c Mon Sep 17 00:00:00 2001
From: twinaphex <libretro@gmail.com>
Date: Fri, 31 Aug 2018 02:28:20 +0200
Subject: [PATCH] Update libretro-common
---
libretro-common/audio/dsp_filters/reverb.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/libretro-common/audio/dsp_filters/reverb.c b/libretro-common/audio/dsp_filters/reverb.c
index e9bc8170e1..d1a770fd34 100644
--- a/libretro-common/audio/dsp_filters/reverb.c
+++ b/libretro-common/audio/dsp_filters/reverb.c
@@ -96,8 +96,8 @@ struct revmodel
struct comb combL[numcombs];
struct allpass allpassL[numallpasses];
- float **bufcomb;
- float **bufallpass;
+ float *bufcomb[numcombs];
+ float *bufallpass[numallpasses];
float gain;
float roomsize, roomsize1;
@@ -194,27 +194,23 @@ static void revmodel_init(struct revmodel *rev,int srate)
double r = srate * (1 / 44100.0);
unsigned c;
- rev->bufcomb=malloc(numcombs*sizeof(float*));
for (c = 0; c < numcombs; ++c)
{
rev->bufcomb[c] = malloc(r*comb_lengths[c]*sizeof(float));
rev->combL[c].buffer = rev->bufcomb[c];
+ memset(rev->combL[c].buffer,0,r*comb_lengths[c]*sizeof(float));
rev->combL[c].bufsize=r*comb_lengths[c];
}
- rev->bufallpass=malloc(numallpasses*sizeof(float*));
for (c = 0; c < numallpasses; ++c)
{
rev->bufallpass[c] = malloc(r*allpass_lengths[c]*sizeof(float));
rev->allpassL[c].buffer = rev->bufallpass[c];
+ memset(rev->allpassL[c].buffer,0,r*allpass_lengths[c]*sizeof(float));
rev->allpassL[c].bufsize=r*allpass_lengths[c];
+ rev->allpassL[c].feedback = 0.5f;
}
- rev->allpassL[0].feedback = 0.5f;
- rev->allpassL[1].feedback = 0.5f;
- rev->allpassL[2].feedback = 0.5f;
- rev->allpassL[3].feedback = 0.5f;
-
revmodel_setwet(rev, initialwet);
revmodel_setroomsize(rev, initialroom);
revmodel_setdry(rev, initialdry);
@@ -237,15 +233,11 @@ static void reverb_free(void *data)
free(rev->left.bufcomb[i]);
free(rev->right.bufcomb[i]);
}
- free(rev->left.bufcomb);
- free(rev->right.bufcomb);
for (i = 0; i < numallpasses; i++) {
free(rev->left.bufallpass[i]);
free(rev->right.bufallpass[i]);
}
- free(rev->left.bufallpass);
- free(rev->right.bufallpass);
free(data);
}
|