summaryrefslogtreecommitdiffstats
path: root/converter.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter.c')
-rw-r--r--converter.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/converter.c b/converter.c
index 799349c..e49945c 100644
--- a/converter.c
+++ b/converter.c
@@ -252,8 +252,7 @@ int converter_init(
if (byteswap_fix(from->format) != c->work_pcm_format) {
c->pre_format_func = get_format_func(byteswap_fix(from->format), c->work_pcm_format);
sa_assert(c->pre_format_func);
- } else
- c->pre_format_func = NULL;
+ }
c->volscale_func = get_volscale_func(c->work_pcm_format);
sa_assert(c->volscale_func);
@@ -267,14 +266,12 @@ int converter_init(
if (resample_required) {
c->resample_func = get_resample_func(c->work_pcm_format);
sa_assert(c->resample_func);
- } else
- c->resample_func = NULL;
+ }
if (c->work_pcm_format != byteswap_fix(to->format)) {
c->post_format_func = get_format_func(c->work_pcm_format, byteswap_fix(to->format));
sa_assert(c->post_format_func);
- } else
- c->post_format_func = NULL;
+ }
c->post_byteswap_func = get_byteswap_func(to->format);
@@ -283,8 +280,10 @@ int converter_init(
/* Initialize resampler */
- if (!(c->speex = speex_resampler_init(c->to_nchannels, c->from_rate, c->to_rate, SPEEX_RESAMPLER_QUALITY_DEFAULT, NULL)))
- goto fail;
+ if (resample_required) {
+ if (!(c->speex = speex_resampler_init(c->to_nchannels, c->from_rate, c->to_rate, SPEEX_RESAMPLER_QUALITY_DEFAULT, NULL)))
+ goto fail;
+ }
/* Initialize processing variables */
@@ -698,7 +697,7 @@ void converter_set_volume(converter_t *c, int vol[]) {
c->volume_factor[i] = 1;
c->volume_divisor[1] = 1;
} else {
- float f = powf(10.0, vol[i] * 10);
+ float f = powf(10.0, (float) vol[i] / 2000);
continued_fraction(f, 0x7FFF, &num, &denom);
@@ -710,6 +709,7 @@ void converter_set_volume(converter_t *c, int vol[]) {
}
}
+ c->no_volume = no_volume;
}
int converter_go_interleaved(