From 75f8b2249cad94708ddb5bfff7361ea996d0c82b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 16 Feb 2006 13:00:42 +0000 Subject: Update to the new polypaudio API. git-svn-id: file:///home/lennart/svn/public/paman/trunk@47 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/ServerInfoManager.cc | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/ServerInfoManager.cc') diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index 44e668f..5f285b9 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -5,6 +5,7 @@ #include "paman.hh" SinkInfo::SinkInfo(const struct pa_sink_info &i) : + driver(i.driver), name(i.name), index(i.index), sample_spec(i.sample_spec), @@ -13,7 +14,6 @@ SinkInfo::SinkInfo(const struct pa_sink_info &i) : volume(i.volume), latency(i.latency), monitor_source_name(i.monitor_source_name), - _typeid(i._typeid), window(NULL) { if (i.description) @@ -26,6 +26,7 @@ SinkInfo::~SinkInfo() { } void SinkInfo::update(const struct pa_sink_info &i) { + driver = Glib::ustring(i.driver); name = Glib::ustring(i.name); index = i.index; sample_spec = i.sample_spec; @@ -34,7 +35,6 @@ void SinkInfo::update(const struct pa_sink_info &i) { volume = i.volume; latency = i.latency; monitor_source_name = i.monitor_source_name; - _typeid = i._typeid; description = i.description ? i.description : ""; @@ -55,13 +55,13 @@ void SinkInfo::showWindow() { } SourceInfo::SourceInfo(const struct pa_source_info &i) : + driver(i.driver), name(i.name), index(i.index), sample_spec(i.sample_spec), owner_module(i.owner_module), monitor_of_sink(i.monitor_of_sink), latency(i.latency), - _typeid(i._typeid), window(NULL) { if (i.description) @@ -74,13 +74,13 @@ SourceInfo::~SourceInfo() { } void SourceInfo::update(const struct pa_source_info &i) { + driver = i.driver; name = i.name; index = i.index; sample_spec = i.sample_spec; owner_module = i.owner_module; monitor_of_sink = i.monitor_of_sink; latency = i.latency; - _typeid = i._typeid; description = i.description ? i.description : ""; @@ -102,9 +102,9 @@ void SourceInfo::showWindow() { ClientInfo::ClientInfo(const struct pa_client_info &i) : index(i.index), + driver(i.driver), name(i.name), owner_module(i.owner_module), - _typeid(i._typeid), window(NULL) { } @@ -114,10 +114,10 @@ ClientInfo::~ClientInfo() { } void ClientInfo::update(const struct pa_client_info &i) { + driver = i.driver; name = i.name; index = i.index; owner_module = i.owner_module; - _typeid = i._typeid; if (window) window->updateInfo(*this); @@ -177,6 +177,7 @@ void ModuleInfo::showWindow() { } SinkInputInfo::SinkInputInfo(const struct pa_sink_input_info &i) : + driver(i.driver), name(i.name), index(i.index), sample_spec(i.sample_spec), @@ -187,7 +188,6 @@ SinkInputInfo::SinkInputInfo(const struct pa_sink_input_info &i) : buffer_usec(i.buffer_usec), sink_usec(i.sink_usec), resample_method(i.resample_method ? i.resample_method : "n/a"), - _typeid(i._typeid), window(NULL) { } @@ -197,6 +197,7 @@ SinkInputInfo::~SinkInputInfo() { } void SinkInputInfo::update(const struct pa_sink_input_info &i) { + driver = i.driver; name = i.name; index = i.index; sample_spec = i.sample_spec; @@ -206,7 +207,6 @@ void SinkInputInfo::update(const struct pa_sink_input_info &i) { volume = i.volume; buffer_usec = i.buffer_usec; sink_usec = i.sink_usec; - _typeid = i._typeid; resample_method = i.resample_method ? i.resample_method : "n/a"; if (window) @@ -226,6 +226,7 @@ void SinkInputInfo::showWindow() { } SourceOutputInfo::SourceOutputInfo(const struct pa_source_output_info &i) : + driver(i.driver), name(i.name), index(i.index), sample_spec(i.sample_spec), @@ -235,7 +236,6 @@ SourceOutputInfo::SourceOutputInfo(const struct pa_source_output_info &i) : buffer_usec(i.buffer_usec), source_usec(i.source_usec), resample_method(i.resample_method ? i.resample_method : "n/a"), - _typeid(i._typeid), window(NULL) { } @@ -245,6 +245,7 @@ SourceOutputInfo::~SourceOutputInfo() { } void SourceOutputInfo::update(const struct pa_source_output_info &i) { + driver = i.driver; name = i.name; index = i.index; sample_spec = i.sample_spec; @@ -253,7 +254,6 @@ void SourceOutputInfo::update(const struct pa_source_output_info &i) { owner_module = i.owner_module; buffer_usec = i.buffer_usec; source_usec = i.source_usec; - _typeid = i._typeid; resample_method = i.resample_method ? i.resample_method : "n/a"; if (window) @@ -276,9 +276,9 @@ SampleInfo::SampleInfo(const struct pa_sample_info &i) : index(i.index), name(i.name), sample_spec(i.sample_spec), - volume(i.volume), duration(i.duration), bytes(i.bytes), + volume(i.volume), lazy(!!i.lazy), filename_valid(false), window(NULL) { @@ -298,9 +298,9 @@ void SampleInfo::update(const struct pa_sample_info &i) { index = i.index; name = i.name; sample_spec = i.sample_spec; - volume = i.volume; duration = i.duration; bytes = i.bytes; + volume = i.volume; lazy = !!i.lazy; filename_valid = !!i.filename; @@ -704,12 +704,18 @@ void ServerInfoManager::removeSampleInfo(uint32_t index) { } } -void ServerInfoManager::setSinkVolume(uint32_t index, uint32_t volume) { - pa_operation_unref(pa_context_set_sink_volume_by_index(&context, index, volume, NULL, NULL)); +/* FIXME: Handle all channels separately. */ +void ServerInfoManager::setSinkVolume(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_sink_volume_by_index(&context, index, &cvol, NULL, NULL)); } -void ServerInfoManager::setSinkInputVolume(uint32_t index, uint32_t volume) { - pa_operation_unref(pa_context_set_sink_input_volume(&context, index, volume, NULL, NULL)); +/* FIXME: Handle all channels separately. */ +void ServerInfoManager::setSinkInputVolume(uint32_t index, pa_volume_t volume) { + pa_cvolume cvol; + pa_cvolume_set(&cvol, sinkInputs[index]->volume.channels, volume); + pa_operation_unref(pa_context_set_sink_input_volume(&context, index, &cvol, NULL, NULL)); } void ServerInfoManager::showStatWindow() { -- cgit