ref: 9bc5baa619c56c340620bb748e2b8d0ec783754c
parent: 44a99eb48b0e0b45b5808d841e17028e91793910
author: robs <robs>
date: Mon Jan 29 16:12:37 EST 2007
Fix some more effects' stop vs. delete bugs.
--- a/src/biquads.c
+++ b/src/biquads.c
@@ -138,7 +138,7 @@
{
biquad_t p = (biquad_t) effp->priv;
double w0 = 2 * M_PI * p->fc / effp->ininfo.rate;
- double A = exp(p->gain / 40 * log(10));
+ double A = exp(p->gain / 40 * log(10.));
double alpha = 0;
if (w0 > M_PI) {
@@ -160,7 +160,7 @@
break;
case width_bw_oct:
- alpha = sin(w0)*sinh(log(2)/2 * p->width * w0/sin(w0));
+ alpha = sin(w0)*sinh(log(2.)/2 * p->width * w0/sin(w0));
break;
case width_bw_Hz:
@@ -276,7 +276,7 @@
p->width = p->fc / 2;
bw_Hz = p->width_type == width_Q? p->fc / p->width :
p->width_type == width_bw_Hz? p->width :
- p->fc * (pow(2, p->width) - 1) * pow(2, -0.5 * p->width); /* bw_oct */
+ p->fc * (pow(2., p->width) - 1) * pow(2., -0.5 * p->width); /* bw_oct */
#include "band.h" /* Has different licence */
break;
}
--- a/src/compand.c
+++ b/src/compand.c
@@ -374,6 +374,16 @@
compand_t l = (compand_t) effp->priv;
free((char *) l->delay_buf);
+
+ l->delay_buf = NULL;
+
+ return (ST_SUCCESS);
+}
+
+static int delete(eff_t effp)
+{
+ compand_t l = (compand_t) effp->priv;
+
free((char *) l->transferOuts);
free((char *) l->transferIns);
free((char *) l->volume);
@@ -380,7 +390,6 @@
free((char *) l->decayRate);
free((char *) l->attackRate);
- l->delay_buf = NULL;
l->transferOuts = NULL;
l->transferIns = NULL;
l->volume = NULL;
@@ -402,7 +411,7 @@
st_compand_flow,
st_compand_drain,
st_compand_stop,
- st_effect_nothing
+ delete
};
const st_effect_t *st_compand_effect_fn(void)
--- a/src/fade.c
+++ b/src/fade.c
@@ -319,7 +319,7 @@
* Do anything required when you stop reading samples.
* (free allocated memory, etc.)
*/
-static int st_fade_stop(eff_t effp)
+static int delete(eff_t effp)
{
fade_t fade = (fade_t) effp->priv;
@@ -381,8 +381,8 @@
st_fade_start,
st_fade_flow,
st_fade_drain,
- st_fade_stop,
- st_effect_nothing
+ st_effect_nothing,
+ delete
};
const st_effect_t *st_fade_effect_fn(void)
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -656,12 +656,7 @@
for (band = 0; band < c->nBands; band++) {
l = &c->bands[band];
- free(l->transferOuts);
- free(l->transferIns);
- free(l->decayRate);
- free(l->attackRate);
free(l->delay_buf);
- free(l->volume);
if (l->topfreq != 0) {
free(l->filter.xy_low);
free(l->filter.xy_high);
@@ -674,7 +669,17 @@
static int st_mcompand_delete(eff_t effp)
{
compand_t c = (compand_t) effp->priv;
+ comp_band_t l;
+ int band;
+ for (band = 0; band < c->nBands; band++) {
+ l = &c->bands[band];
+ free(l->transferOuts);
+ free(l->transferIns);
+ free(l->decayRate);
+ free(l->attackRate);
+ free(l->volume);
+ }
free(c->bands);
c->bands = NULL;
--- a/src/silence.c
+++ b/src/silence.c
@@ -656,6 +656,15 @@
return(ST_SUCCESS);
}
+static int delete(eff_t effp)
+{
+ silence_t silence = (silence_t) effp->priv;
+
+ free(silence->start_duration_str);
+ free(silence->stop_duration_str);
+ return ST_SUCCESS;
+}
+
static st_effect_t st_silence_effect = {
"silence",
"Usage: silence above_periods [ duration thershold[d | %% ] ] [ below_periods duration threshold[ d | %% ]]",
@@ -665,7 +674,7 @@
st_silence_flow,
st_silence_drain,
st_silence_stop,
- st_effect_nothing
+ delete
};
const st_effect_t *st_silence_effect_fn(void)