diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c index 0d4e01efd..f8a4c70ad 100644 --- a/src/pulsecore/sample-util.c +++ b/src/pulsecore/sample-util.c @@ -975,34 +975,11 @@ pa_volume_s24_32re_c (uint32_t *samples, int32_t *volumes, unsigned channels, un } typedef void (*pa_do_volume_func_t) (void *samples, void *volumes, unsigned channels, unsigned length); -typedef void (*pa_calc_volume_func_t) (void *volumes, const pa_cvolume *volume); - -typedef union { - float f; - uint32_t i; -} volume_val; typedef struct pa_sample_func_t { - pa_calc_volume_func_t calc_volume; pa_do_volume_func_t do_volume; } pa_sample_func_t; -static const pa_calc_volume_func_t calc_volume_table[] = { - [PA_SAMPLE_U8] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_ALAW] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_ULAW] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S16LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S16BE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_FLOAT32LE] = (pa_calc_volume_func_t) calc_linear_float_volume, - [PA_SAMPLE_FLOAT32BE] = (pa_calc_volume_func_t) calc_linear_float_volume, - [PA_SAMPLE_S32LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S32BE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S24LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S24BE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S24_32LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, - [PA_SAMPLE_S24_32BE] = (pa_calc_volume_func_t) calc_linear_integer_volume -}; - static pa_do_volume_func_t do_volume_table[] = { [PA_SAMPLE_U8] = (pa_do_volume_func_t) pa_volume_u8_c, @@ -1020,6 +997,29 @@ static pa_do_volume_func_t do_volume_table[] = [PA_SAMPLE_S24_32RE] = (pa_do_volume_func_t) pa_volume_s24_32re_c }; +typedef union { + float f; + uint32_t i; +} volume_val; + +typedef void (*pa_calc_volume_func_t) (void *volumes, const pa_cvolume *volume); + +static const pa_calc_volume_func_t calc_volume_table[] = { + [PA_SAMPLE_U8] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_ALAW] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_ULAW] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S16LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S16BE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_FLOAT32LE] = (pa_calc_volume_func_t) calc_linear_float_volume, + [PA_SAMPLE_FLOAT32BE] = (pa_calc_volume_func_t) calc_linear_float_volume, + [PA_SAMPLE_S32LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S32BE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S24LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S24BE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S24_32LE] = (pa_calc_volume_func_t) calc_linear_integer_volume, + [PA_SAMPLE_S24_32BE] = (pa_calc_volume_func_t) calc_linear_integer_volume +}; + void pa_volume_memchunk( pa_memchunk*c, const pa_sample_spec *spec,