From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx> Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net> --- src/pulsecore/mix.c | 7 ++++--- src/pulsecore/sink-input.c | 9 +++++---- src/pulsecore/sink.c | 13 +++++++------ src/pulsecore/source-output.c | 5 +++-- src/pulsecore/source.c | 9 +++++---- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c index c71bd2c..182dba2 100644 --- a/src/pulsecore/mix.c +++ b/src/pulsecore/mix.c @@ -28,6 +28,7 @@ #include <math.h> #include <pulsecore/sample-util.h> +#include <pulsecore/volume-util.h> #include <pulsecore/macro.h> #include <pulsecore/g711.h> #include <pulsecore/endianmacros.h> @@ -635,7 +636,7 @@ size_t pa_mix( if (!volume) volume = pa_cvolume_reset(&full_volume, spec->channels); - if (mute || pa_cvolume_is_muted(volume)) { + if (mute || PA_CVOLUME_IS_MUTED(volume)) { pa_silence_memory(data, length, spec); return length; } @@ -727,12 +728,12 @@ void pa_volume_memchunk( pa_assert(pa_sample_spec_valid(spec)); pa_assert(volume); - if (pa_cvolume_is_muted(volume)) { + if (PA_CVOLUME_IS_MUTED(volume)) { pa_silence_memchunk(c, spec); return; } - if (pa_cvolume_is_norm(volume)) + if (PA_CVOLUME_IS_NORM(volume)) return; pa_volume_memchunk_unchecked(c, spec, volume); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 1e909f3..ca1567d 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -35,6 +35,7 @@ #include <pulsecore/core-format.h> #include <pulsecore/mix.h> #include <pulsecore/stream-util.h> +#include <pulsecore/volume-util.h> #include <pulsecore/core-subscribe.h> #include <pulsecore/log.h> #include <pulsecore/play-memblockq.h> @@ -886,9 +887,9 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa * to adjust the volume *before* we resample. Otherwise we can do * it after and leave it for the sink code */ - do_volume_adj_here = !pa_channel_map_equal(&i->channel_map, &i->sink->channel_map); - volume_is_norm = pa_cvolume_is_norm(&i->thread_info.soft_volume) && !i->thread_info.muted; - need_volume_factor_sink = !pa_cvolume_is_norm(&i->volume_factor_sink); + do_volume_adj_here = !PA_CHANNEL_MAP_EQUAL(&i->channel_map, &i->sink->channel_map); + volume_is_norm = PA_CVOLUME_IS_NORM(&i->thread_info.soft_volume) && !i->thread_info.muted; + need_volume_factor_sink = !PA_CVOLUME_IS_NORM(&i->volume_factor_sink); while (!pa_memblockq_is_readable(i->thread_info.render_memblockq)) { pa_memchunk tchunk; @@ -945,7 +946,7 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa /* If we don't need a resampler we can merge the * post and the pre volume adjustment into one */ - pa_sw_cvolume_multiply(&v, &i->thread_info.soft_volume, &i->volume_factor_sink); + PA_SW_CVOLUME_MULTIPLY(&v, &i->thread_info.soft_volume, &i->volume_factor_sink); pa_volume_memchunk(&wchunk, &i->thread_info.sample_spec, &v); // is_silence nvfs = false; diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 62a68e1..cbed0d9 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -42,6 +42,7 @@ #include <pulsecore/namereg.h> #include <pulsecore/core-util.h> #include <pulsecore/sample-util.h> +#include <pulsecore/volume-util.h> #include <pulsecore/mix.h> #include <pulsecore/core-subscribe.h> #include <pulsecore/log.h> @@ -1191,16 +1192,16 @@ void pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) { if (result->length > length) result->length = length; - pa_sw_cvolume_multiply(&volume, &s->thread_info.soft_volume, &info[0].volume); + PA_SW_CVOLUME_MULTIPLY(&volume, &s->thread_info.soft_volume, &info[0].volume); - if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume)) { + if (s->thread_info.soft_muted || PA_CVOLUME_IS_MUTED(&volume)) { pa_memblock_unref(result->memblock); pa_silence_memchunk_get(&s->core->silence_cache, s->core->mempool, result, &s->sample_spec, result->length); - } else if (!pa_cvolume_is_norm(&volume)) { + } else if (!PA_CVOLUME_IS_NORM(&volume)) { pa_memchunk_make_writable(result, 0); pa_volume_memchunk_unchecked(result, &s->sample_spec, &volume); } @@ -1268,9 +1269,9 @@ void pa_sink_render_into(pa_sink*s, pa_memchunk *target) { if (target->length > length) target->length = length; - pa_sw_cvolume_multiply(&volume, &s->thread_info.soft_volume, &info[0].volume); + PA_SW_CVOLUME_MULTIPLY(&volume, &s->thread_info.soft_volume, &info[0].volume); - if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume)) + if (s->thread_info.soft_muted || PA_CVOLUME_IS_MUTED(&volume)) pa_silence_memchunk(target, &s->sample_spec); else { pa_memchunk vchunk; @@ -1281,7 +1282,7 @@ void pa_sink_render_into(pa_sink*s, pa_memchunk *target) { if (vchunk.length > length) vchunk.length = length; - if (!pa_cvolume_is_norm(&volume)) { + if (!PA_CVOLUME_IS_NORM(&volume)) { pa_memchunk_make_writable(&vchunk, 0); pa_volume_memchunk_unchecked(&vchunk, &s->sample_spec, &volume); } diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index c3a12ac..bd53f44 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -35,6 +35,7 @@ #include <pulsecore/core-format.h> #include <pulsecore/mix.h> #include <pulsecore/stream-util.h> +#include <pulsecore/volume-util.h> #include <pulsecore/core-subscribe.h> #include <pulsecore/log.h> #include <pulsecore/namereg.h> @@ -735,8 +736,8 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { limit = o->process_rewind ? 0 : o->source->thread_info.max_rewind; - volume_is_norm = pa_cvolume_is_norm(&o->thread_info.soft_volume) && !o->thread_info.muted; - need_volume_factor_source = !pa_cvolume_is_norm(&o->volume_factor_source); + volume_is_norm = PA_CVOLUME_IS_NORM(&o->thread_info.soft_volume) && !o->thread_info.muted; + need_volume_factor_source = !PA_CVOLUME_IS_NORM(&o->volume_factor_source); if (limit > 0 && o->source->monitor_of) { pa_usec_t latency; diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 23bb061..336d0f8 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -36,6 +36,7 @@ #include <pulse/internal.h> #include <pulsecore/core-util.h> +#include <pulsecore/volume-util.h> #include <pulsecore/source-output.h> #include <pulsecore/namereg.h> #include <pulsecore/core-subscribe.h> @@ -911,13 +912,13 @@ void pa_source_post(pa_source*s, const pa_memchunk *chunk) { if (s->thread_info.state == PA_SOURCE_SUSPENDED) return; - if (s->thread_info.soft_muted || !pa_cvolume_is_norm(&s->thread_info.soft_volume)) { + if (s->thread_info.soft_muted || !PA_CVOLUME_IS_NORM(&s->thread_info.soft_volume)) { pa_memchunk vchunk = *chunk; pa_memblock_ref(vchunk.memblock); pa_memchunk_make_writable(&vchunk, 0); - if (s->thread_info.soft_muted || pa_cvolume_is_muted(&s->thread_info.soft_volume)) + if (s->thread_info.soft_muted || PA_CVOLUME_IS_MUTED(&s->thread_info.soft_volume)) pa_silence_memchunk(&vchunk, &s->sample_spec); else pa_volume_memchunk_unchecked(&vchunk, &s->sample_spec, &s->thread_info.soft_volume); @@ -953,13 +954,13 @@ void pa_source_post_direct(pa_source*s, pa_source_output *o, const pa_memchunk * if (s->thread_info.state == PA_SOURCE_SUSPENDED) return; - if (s->thread_info.soft_muted || !pa_cvolume_is_norm(&s->thread_info.soft_volume)) { + if (s->thread_info.soft_muted || !PA_CVOLUME_IS_NORM(&s->thread_info.soft_volume)) { pa_memchunk vchunk = *chunk; pa_memblock_ref(vchunk.memblock); pa_memchunk_make_writable(&vchunk, 0); - if (s->thread_info.soft_muted || pa_cvolume_is_muted(&s->thread_info.soft_volume)) + if (s->thread_info.soft_muted || PA_CVOLUME_IS_MUTED(&s->thread_info.soft_volume)) pa_silence_memchunk(&vchunk, &s->sample_spec); else pa_volume_memchunk_unchecked(&vchunk, &s->sample_spec, &s->thread_info.soft_volume); -- 1.9.1