Signed-off-by: Sangchul Lee <sc11.lee at samsung.com> --- src/modules/stream-interaction.c | 45 ++++------------------------------------ 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/src/modules/stream-interaction.c b/src/modules/stream-interaction.c index d8e2a6b..e38d30d 100644 --- a/src/modules/stream-interaction.c +++ b/src/modules/stream-interaction.c @@ -174,37 +174,10 @@ static const char *find_global_trigger_stream(struct userdata *u, pa_sink *s, pa return trigger_role; } -static bool is_affected_by_other_groups(struct userdata *u, pa_sink_input *s, struct group *skip_g, pa_volume_t *affected_min_vol) { - bool ret = false; - uint32_t i; - pa_sink_input *si; - pa_volume_t vol = PA_VOLUME_MAX; - - pa_assert(u); - - for (i = 0; i < u->n_groups; i++) { - uint32_t idx; - if (u->groups[i] == skip_g) - continue; - PA_IDXSET_FOREACH(si, u->groups[i]->interacted_inputs, idx) - if (si == s) { - if (u->groups[i]->volume < vol) - vol = u->groups[i]->volume; - ret = true; - } - } - if (ret) - *affected_min_vol = vol; - - return ret; -} - static void cork_or_duck(struct userdata *u, pa_sink_input *i, const char *interaction_role, const char *trigger_role, bool interaction_applied, struct group *g) { if (u->duck && !interaction_applied) { if (g->fade_durs.in || g->fade_durs.out) { - bool affected = false; - pa_volume_t min_vol; pa_cvolume_ramp vol_ramp; pa_cvolume_ramp_set(&vol_ramp, i->volume.channels, PA_VOLUME_RAMP_TYPE_LINEAR, g->fade_durs.out, g->volume); @@ -212,18 +185,16 @@ static void cork_or_duck(struct userdata *u, pa_sink_input *i, const char *inter pa_cvolume vol; vol.channels = 1; vol.values[0] = g->volume; + pa_log_debug("Found a '%s' stream(%u) that should be ducked by '%s'.", interaction_role, i->index, g->name); pa_sink_input_add_volume_factor(i, g->name, &vol); - pa_sink_input_set_volume_ramp(i, &vol_ramp, false); + pa_sink_input_add_volume_ramp_factor(i, g->name, &vol_ramp, false); } else { - affected = is_affected_by_other_groups(u, i, g, &min_vol); - pa_cvolume_ramp_set(&vol_ramp, i->volume.channels, PA_VOLUME_RAMP_TYPE_LINEAR, - g->fade_durs.out, affected ? MIN(g->volume, min_vol) : g->volume); pa_log_debug("Found a '%s' stream(%u) that should be ducked with fade-out(%lums) by '%s'.", interaction_role, i->index, g->fade_durs.out, g->name); - pa_sink_input_set_volume_ramp(i, &vol_ramp, true); + pa_sink_input_add_volume_ramp_factor(i, g->name, &vol_ramp, true); } } else { pa_cvolume vol; @@ -245,21 +216,13 @@ static void uncork_or_unduck(struct userdata *u, pa_sink_input *i, const char *i if (u->duck) { if (g->fade_durs.in || g->fade_durs.out) { - bool affected = false; - pa_volume_t min_vol; - pa_cvolume_ramp vol_ramp; - pa_log_debug("In '%s', found a '%s' stream(%u) that should be unducked with fade-in(%lums)", g->name, interaction_role, i->index, g->fade_durs.in); pa_sink_input_remove_volume_factor(i, g->name); - affected = is_affected_by_other_groups(u, i, g, &min_vol); - pa_cvolume_ramp_set(&vol_ramp, i->volume.channels, PA_VOLUME_RAMP_TYPE_LINEAR, - g->fade_durs.in, affected ? min_vol : PA_VOLUME_NORM); - - pa_sink_input_set_volume_ramp(i, &vol_ramp, true); } else { pa_log_debug("In '%s', found a '%s' stream(%u) that should be unducked", g->name, interaction_role, i->index); pa_sink_input_remove_volume_factor(i, g->name); + pa_sink_input_remove_volume_ramp_factor(i, g->name, true); } } else if (corked || i->muted) { -- 2.7.4