History

Fix read and write return types: now st_size_t, like the size inputs.

To support this change, turn on lots more compiler warnings, and fix all the warnings generated.

rrt committed 19 years ago

Commit 4d743c41 parent ce1f8f393 files · +875 −1236Browse files

Showing the changes to src/equalizer.c (1 of 93 files). Show all

Unified · Split

src/equalizer.c+20−20
@@ -55,17 +55,17 @@ static st_effect_t st_equalizer_effect; · 54 unmodified lines
55 55
56/* Filter parameters */56/* Filter parameters */
57typedef struct filterparams {57typedef struct filterparams {
58 float rate; // Sample rate58 float rate; /* Sample rate */
59 float Q; // Q-factor59 float Q; /* Q-factor */
60 float cfreq; // Central frequency (Hz)60 float cfreq; /* Central frequency (Hz) */
61 float gain; // Gain (dB)61 float gain; /* Gain (dB) */
62 double x[3]; // In where x[2] <=> x[ n - 2 ]62 double x[3]; /* In where x[2] <=> x[ n - 2 ] */
63 double y[3]; // Out63 double y[3]; /* Out */
64 double b[3]; // From this point, equation constants...64 double b[3]; /* From this point, equation constants... */
65 double a[3];65 double a[3];
66} *equalizer_t;66} *equalizer_t;
67 67
68int st_equalizer_getopts(eff_t effp, int n, char **argv) 68static int st_equalizer_getopts(eff_t effp, int n, char **argv)
69{69{
70 equalizer_t eq = (equalizer_t) effp->priv;70 equalizer_t eq = (equalizer_t) effp->priv;
71 int i;71 int i;
@@ -81,20 +81,20 @@ int st_equalizer_getopts(eff_t effp, int n, char **argv) · 9 unmodified lines
81 sscanf(argv[i++], "%f", &eq->Q);81 sscanf(argv[i++], "%f", &eq->Q);
82 sscanf(argv[i++], "%f", &eq->gain);82 sscanf(argv[i++], "%f", &eq->gain);
83 83
84 // TODO: Would be nice to validate the params..84 /* FIXME: Would be nice to validate the params.. */
85 85
86 return (ST_SUCCESS);86 return (ST_SUCCESS);
87}87}
88 88
89// Set the filter constants89/* Set the filter constants */
90int st_equalizer_start(eff_t effp)90static int st_equalizer_start(eff_t effp)
91{91{
92 equalizer_t eq = (equalizer_t) effp->priv;92 equalizer_t eq = (equalizer_t) effp->priv;
93 double w0;93 double w0;
94 double amp;94 double amp;
95 double alpha;95 double alpha;
96 96
97 // Sample rate97 /* Sample rate */
98 eq->rate = effp->ininfo.rate;98 eq->rate = effp->ininfo.rate;
99 99
100 w0 = 2*M_PI*eq->cfreq/eq->rate;100 w0 = 2*M_PI*eq->cfreq/eq->rate;
@@ -109,7 +109,7 @@ int st_equalizer_start(eff_t effp) · 8 unmodified lines
109 st_debug("amp: %f", amp);109 st_debug("amp: %f", amp);
110 st_debug("alpha: %f", alpha);110 st_debug("alpha: %f", alpha);
111 111
112 // Initialisation112 /* Initialisation */
113 eq->b[0] = 1 + alpha*amp;113 eq->b[0] = 1 + alpha*amp;
114 eq->b[1] = -2*cos(w0);114 eq->b[1] = -2*cos(w0);
115 eq->b[2] = 1 - alpha*amp;115 eq->b[2] = 1 - alpha*amp;
@@ -117,12 +117,12 @@ int st_equalizer_start(eff_t effp) · 1 unmodified line
117 eq->a[1] = -2*cos(w0);117 eq->a[1] = -2*cos(w0);
118 eq->a[2] = 1 - alpha/amp;118 eq->a[2] = 1 - alpha/amp;
119 119
120 eq->x[0] = 0; // x[n]120 eq->x[0] = 0; /* x[n] */
121 eq->x[1] = 0; // x[n-1]121 eq->x[1] = 0; /* x[n-1] */
122 eq->x[2] = 0; // x[n-2]122 eq->x[2] = 0; /* x[n-2] */
123 eq->y[0] = 0; // y[n]123 eq->y[0] = 0; /* y[n] */
124 eq->y[1] = 0; // y[n-1]124 eq->y[1] = 0; /* y[n-1] */
125 eq->y[2] = 0; // y[n-2]125 eq->y[2] = 0; /* y[n-2] */
126 126
127 if (effp->globalinfo.octave_plot_effect)127 if (effp->globalinfo.octave_plot_effect)
128 {128 {
@@ -147,7 +147,7 @@ int st_equalizer_start(eff_t effp) · 18 unmodified lines
147 return (ST_SUCCESS);147 return (ST_SUCCESS);
148}148}
149 149
150int st_equalizer_flow(eff_t effp, const st_sample_t *ibuf,150static int st_equalizer_flow(eff_t effp, const st_sample_t *ibuf,
151 st_sample_t *obuf, st_size_t *isamp,151 st_sample_t *obuf, st_size_t *isamp,
152 st_size_t *osamp)152 st_size_t *osamp)
153{153{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t