From a1e6b396707644e279ef9a60781c7417325a02ee Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Thu, 5 Jun 2008 17:40:58 -0400 Subject: [PATCH] Doesn't lower sflphone volume on incoming call Problem with getStreamName() --- src/audio/audiostream.h | 6 ++++++ src/audio/pulselayer.cpp | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/audio/audiostream.h b/src/audio/audiostream.h index 8327805e98..7645f2bd51 100644 --- a/src/audio/audiostream.h +++ b/src/audio/audiostream.h @@ -85,6 +85,12 @@ class AudioStream { */ std::string getStreamName( void ) { return _streamDescription; } + /** + * Accessor + * @param name The stream name + */ + void setStreamName( std::string name ) { _streamDescription = name; } + void setVolume( double pc ) { _volume.values[0] *= pc/100; } pa_cvolume getVolume( void ) { return _volume; } diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp index 5515a350ae..f02215e69d 100644 --- a/src/audio/pulselayer.cpp +++ b/src/audio/pulselayer.cpp @@ -68,7 +68,7 @@ PulseLayer::connectPulseAudioServer( void ) } pa_threaded_mainloop_unlock( m ); - //serverinfo(); + serverinfo(); //muteAudioApps(99); _debug("Context creation done\n"); } @@ -405,14 +405,13 @@ static void reduce_sink_list(pa_context *c, const pa_sink_input_info *i, int eol { PulseLayer* pulse = (PulseLayer*) userdata; AudioStream* s = pulse->getPlaybackStream(); - //_debug("my app index = %d\n",pa_stream_get_index(pulse->getPlaybackStream()->pulseStream())); if( !eol ){ _debug("Sink Info: index : %i\n" , i->index); - _debug("\t\tSink name : -%s-\n" , i->name); + _debug("\t\tSink name : -%s-%s-\n" , i->name, s->getStreamName().c_str()); _debug("\t\tClient : %i\n" , i->client); _debug("\t\tVolume : %i\n" , i->volume.values[0]); _debug("\t\tChannels : %i\n" , i->volume.channels); - if( strcmp( i->name , s->getStreamName().c_str()) != 0) + if( strcmp( i->name , "SFLphone out") != 0) pulse->reduceAppVolume( i->index , i->volume.channels); } } @@ -421,14 +420,13 @@ static void restore_sink_list(pa_context *c, const pa_sink_input_info *i, int eo { PulseLayer* pulse = (PulseLayer*) userdata; AudioStream* s = pulse->getPlaybackStream(); - //_debug("my app index = %d\n",pa_stream_get_index(pulse->getPlaybackStream()->pulseStream())); if( !eol ){ _debug("Sink Info: index : %i\n" , i->index); _debug("\t\tSink name : -%s-\n" , i->name); _debug("\t\tClient : %i\n" , i->client); _debug("\t\tVolume : %i\n" , i->volume.values[0]); _debug("\t\tChannels : %i\n" , i->volume.channels); - if( strcmp( i->name , s->getStreamName().c_str()) != 0) + if( strcmp( i->name , "SFLphone out") != 0) pulse->restoreAppVolume( i->index , i->volume.channels); } } -- GitLab