--- src/modules/module-device-restore.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c index b9bd498..c9ffbb1 100644 --- a/src/modules/module-device-restore.c +++ b/src/modules/module-device-restore.c @@ -779,12 +779,13 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data * if (!new_data->volume_is_set) { pa_cvolume v; + char buf[PA_CVOLUME_SNPRINT_MAX]; pa_log_info("Restoring volume for sink %s.", new_data->name); - v = e->volume; pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map); pa_sink_new_data_set_volume(new_data, &v); + pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume)); new_data->save_volume = TRUE; } else @@ -823,14 +824,15 @@ static pa_hook_result_t sink_port_hook_callback(pa_core *c, pa_sink *sink, struc if ((e = perportentry_read(u, name, (sink->active_port ? sink->active_port->name : NULL)))) { if (u->restore_volume && e->volume_valid) { - + char buf[PA_CVOLUME_SNPRINT_MAX]; pa_cvolume v; pa_log_info("Restoring volume for sink %s.", sink->name); - v = e->volume; pa_cvolume_remap(&v, &e->channel_map, &sink->channel_map); pa_sink_set_volume(sink, &v, TRUE, FALSE); + pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &sink->reference_volume)); + sink->save_volume = TRUE; } @@ -919,13 +921,14 @@ static pa_hook_result_t source_fixate_hook_callback(pa_core *c, pa_source_new_da if (u->restore_volume && e->volume_valid) { if (!new_data->volume_is_set) { + char buf[PA_CVOLUME_SNPRINT_MAX]; pa_cvolume v; pa_log_info("Restoring volume for source %s.", new_data->name); - v = e->volume; pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map); pa_source_new_data_set_volume(new_data, &v); + pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume)); new_data->save_volume = TRUE; } else @@ -964,14 +967,15 @@ static pa_hook_result_t source_port_hook_callback(pa_core *c, pa_source *source, if ((e = perportentry_read(u, name, (source->active_port ? source->active_port->name : NULL)))) { if (u->restore_volume && e->volume_valid) { - + char buf[PA_CVOLUME_SNPRINT_MAX]; pa_cvolume v; pa_log_info("Restoring volume for source %s.", source->name); - v = e->volume; pa_cvolume_remap(&v, &e->channel_map, &source->channel_map); pa_source_set_volume(source, &v, TRUE, FALSE); + pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &source->reference_volume)); + source->save_volume = TRUE; } -- 1.7.10.4