summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-05 01:22:57 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-05 01:22:57 +0100
commitf6ffd2dd5a019e6ea5b2cbd1d19c3a4417043e59 (patch)
treead2024e44c5fce4053e23ad20152727fb608076f
parentde86c6e3ade17c3b29fd57afb47efb3a88a423d4 (diff)
make module-position-event-sounds use volume factor
-rw-r--r--src/modules/module-position-event-sounds.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/modules/module-position-event-sounds.c b/src/modules/module-position-event-sounds.c
index e17cbe80..6252ebab 100644
--- a/src/modules/module-position-event-sounds.c
+++ b/src/modules/module-position-event-sounds.c
@@ -54,7 +54,6 @@ static const char* const valid_modargs[] = {
};
struct userdata {
- pa_core *core;
pa_hook_slot *sink_input_fixate_hook_slot;
};
@@ -62,6 +61,7 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
const char *hpos;
double f;
char t[PA_CVOLUME_SNPRINT_MAX];
+ pa_cvolume v;
pa_assert(data);
@@ -80,16 +80,12 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
pa_log_debug("Positioning event sound '%s' at %0.2f.", pa_strnull(pa_proplist_gets(data->proplist, PA_PROP_EVENT_ID)), f);
- if (!data->volume_is_set) {
- pa_cvolume_reset(&data->volume, data->sample_spec.channels);
- data->volume_is_set = TRUE;
- data->volume_is_absolute = FALSE;
- }
+ pa_cvolume_reset(&v, data->sample_spec.channels);
+ pa_cvolume_set_balance(&v, &data->channel_map, f*2.0-1.0);
- pa_cvolume_set_balance(&data->volume, &data->channel_map, f*2.0-1.0);
- data->save_volume = FALSE;
+ pa_log_debug("Final volume factor %s.", pa_cvolume_snprint(t, sizeof(t), &v));
- pa_log_debug("Final volume %s.", pa_cvolume_snprint(t, sizeof(t), &data->volume));
+ pa_sink_input_new_data_apply_volume_factor(data, &v);
return PA_HOOK_OK;
}
@@ -106,7 +102,6 @@ int pa__init(pa_module*m) {
}
m->userdata = u = pa_xnew(struct userdata, 1);
- u->core = m->core;
u->sink_input_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) sink_input_fixate_hook_callback, u);
pa_modargs_free(ma);