}
}
+typedef void (*pa_calc_stream_volumes_func_t) (pa_mix_info streams[], unsigned nstreams, const pa_cvolume *volume, const pa_sample_spec *spec);
+
+static const pa_calc_stream_volumes_func_t calc_stream_volumes_table[] = {
+ [PA_SAMPLE_U8] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_ALAW] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_ULAW] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S16LE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S16BE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_FLOAT32LE] = (pa_calc_stream_volumes_func_t) calc_linear_float_stream_volumes,
+ [PA_SAMPLE_FLOAT32BE] = (pa_calc_stream_volumes_func_t) calc_linear_float_stream_volumes,
+ [PA_SAMPLE_S32LE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S32BE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S24LE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S24BE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S24_32LE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes,
+ [PA_SAMPLE_S24_32BE] = (pa_calc_stream_volumes_func_t) calc_linear_integer_stream_volumes
+};
+
size_t pa_mix(
pa_mix_info streams[],
unsigned nstreams,
end = (uint8_t*) data + length;
+ calc_stream_volumes_table[spec->format](streams, nstreams, volume, spec);
+
switch (spec->format) {
case PA_SAMPLE_S16NE:{
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int32_t sum = 0;
unsigned i;
case PA_SAMPLE_S16RE:{
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int32_t sum = 0;
unsigned i;
case PA_SAMPLE_S32NE:{
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int64_t sum = 0;
unsigned i;
case PA_SAMPLE_S32RE:{
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int64_t sum = 0;
unsigned i;
case PA_SAMPLE_S24NE: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int64_t sum = 0;
unsigned i;
case PA_SAMPLE_S24RE: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int64_t sum = 0;
unsigned i;
case PA_SAMPLE_S24_32NE: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int64_t sum = 0;
unsigned i;
case PA_SAMPLE_S24_32RE: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int64_t sum = 0;
unsigned i;
case PA_SAMPLE_U8: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int32_t sum = 0;
unsigned i;
case PA_SAMPLE_ULAW: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int32_t sum = 0;
unsigned i;
case PA_SAMPLE_ALAW: {
unsigned channel = 0;
- calc_linear_integer_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
int32_t sum = 0;
unsigned i;
case PA_SAMPLE_FLOAT32NE: {
unsigned channel = 0;
- calc_linear_float_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
float sum = 0;
unsigned i;
case PA_SAMPLE_FLOAT32RE: {
unsigned channel = 0;
- calc_linear_float_stream_volumes(streams, nstreams, volume, spec);
-
while (data < end) {
float sum = 0;
unsigned i;