From 9f205ae53d29127c54d416b5ca024fb625b1b950 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 10 Apr 2006 17:14:45 +0000 Subject: * add volume control for sources * add channel map information to sinks/source/sink inputs/source outputs git-svn-id: file:///home/lennart/svn/public/paman/trunk@54 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/ServerInfoManager.cc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/ServerInfoManager.cc') diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index a809de6..e1c978b 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -26,14 +26,16 @@ #include "ServerInfoManager.hh" #include "paman.hh" -SinkInfo::SinkInfo(const struct pa_sink_info &i) : +SinkInfo::SinkInfo(const pa_sink_info &i) : driver(i.driver), name(i.name), index(i.index), sample_spec(i.sample_spec), + channel_map(i.channel_map), monitor_source(i.monitor_source), owner_module(i.owner_module), volume(i.volume), + hw_volume_supported(!!(i.flags & PA_SINK_HW_VOLUME_CTRL)), latency(i.latency), monitor_source_name(i.monitor_source_name), window(NULL) { @@ -47,14 +49,16 @@ SinkInfo::~SinkInfo() { delete window; } -void SinkInfo::update(const struct pa_sink_info &i) { +void SinkInfo::update(const pa_sink_info &i) { driver = Glib::ustring(i.driver); name = Glib::ustring(i.name); index = i.index; sample_spec = i.sample_spec; + channel_map = i.channel_map; monitor_source = i.monitor_source; owner_module = i.owner_module; volume = i.volume; + hw_volume_supported = !!(i.flags & PA_SINK_HW_VOLUME_CTRL), latency = i.latency; monitor_source_name = i.monitor_source_name; @@ -76,13 +80,16 @@ void SinkInfo::showWindow() { } } -SourceInfo::SourceInfo(const struct pa_source_info &i) : +SourceInfo::SourceInfo(const pa_source_info &i) : driver(i.driver), name(i.name), index(i.index), sample_spec(i.sample_spec), + channel_map(i.channel_map), owner_module(i.owner_module), monitor_of_sink(i.monitor_of_sink), + volume(i.volume), + hw_volume_supported(!!(i.flags & PA_SINK_HW_VOLUME_CTRL)), latency(i.latency), window(NULL) { @@ -100,8 +107,11 @@ void SourceInfo::update(const struct pa_source_info &i) { name = i.name; index = i.index; sample_spec = i.sample_spec; + channel_map = i.channel_map; owner_module = i.owner_module; monitor_of_sink = i.monitor_of_sink; + volume = i.volume; + hw_volume_supported = !!(i.flags & PA_SOURCE_HW_VOLUME_CTRL), latency = i.latency; description = i.description ? i.description : ""; @@ -203,6 +213,7 @@ SinkInputInfo::SinkInputInfo(const struct pa_sink_input_info &i) : name(i.name), index(i.index), sample_spec(i.sample_spec), + channel_map(i.channel_map), sink(i.sink), client(i.client), owner_module(i.owner_module), @@ -223,6 +234,7 @@ void SinkInputInfo::update(const struct pa_sink_input_info &i) { name = i.name; index = i.index; sample_spec = i.sample_spec; + channel_map = i.channel_map; sink = i.sink; client = i.client; owner_module = i.owner_module; @@ -252,6 +264,7 @@ SourceOutputInfo::SourceOutputInfo(const struct pa_source_output_info &i) : name(i.name), index(i.index), sample_spec(i.sample_spec), + channel_map(i.channel_map), source(i.source), client(i.client), owner_module(i.owner_module), @@ -271,6 +284,7 @@ void SourceOutputInfo::update(const struct pa_source_output_info &i) { name = i.name; index = i.index; sample_spec = i.sample_spec; + channel_map = i.channel_map; source = i.source; client = i.client; owner_module = i.owner_module; @@ -733,6 +747,13 @@ void ServerInfoManager::setSinkVolume(uint32_t index, pa_volume_t volume) { pa_operation_unref(pa_context_set_sink_volume_by_index(&context, index, &cvol, NULL, NULL)); } +/* FIXME: Handle all channels separately. */ +void ServerInfoManager::setSourceVolume(uint32_t index, pa_volume_t volume) { + pa_cvolume cvol; + pa_cvolume_set(&cvol, sinks[index]->volume.channels, volume); + pa_operation_unref(pa_context_set_source_volume_by_index(&context, index, &cvol, NULL, NULL)); +} + /* FIXME: Handle all channels separately. */ void ServerInfoManager::setSinkInputVolume(uint32_t index, pa_volume_t volume) { pa_cvolume cvol; -- cgit