From c00e25b4bae92af3b4d3c36e10e6b58233cab748 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Tue, 13 Jan 2009 12:16:07 -0500 Subject: [PATCH] Clean adjust volume method in alsalayer --- src/audio/alsalayer.cpp | 15 +++++++-------- src/audio/pulselayer.cpp | 13 +------------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp index 33a14637b4..acd933c9d0 100644 --- a/src/audio/alsalayer.cpp +++ b/src/audio/alsalayer.cpp @@ -752,17 +752,16 @@ AlsaLayer::soundCardGetIndex( std::string description ) void* AlsaLayer::adjustVolume( void* buffer , int len, int stream ) { - int vol; - if( stream == SFL_PCM_PLAYBACK ) - vol = _manager->getSpkrVolume(); - else - vol = _manager->getMicVolume(); + int vol, i, size; + SFLDataFormat *src = NULL; + + (stream == SFL_PCM_PLAYBACK)? vol = _manager->getSpkrVolume() : vol = _manager->getMicVolume(); + + src = (SFLDataFormat*) buffer; - SFLDataFormat* src = (SFLDataFormat*) buffer; if( vol != 100 ) { - int size = len / sizeof(SFLDataFormat); - int i; + size = len / sizeof(SFLDataFormat); for( i = 0 ; i < size ; i++ ){ src[i] = src[i] * vol / 100 ; } diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp index 9f7c5a78a6..ce58efddbb 100644 --- a/src/audio/pulselayer.cpp +++ b/src/audio/pulselayer.cpp @@ -348,7 +348,7 @@ void PulseLayer::readFromMic( void ) } if( data != 0 ){ - _micRingBuffer.Put( (void*)data , r, 100); + _micRingBuffer.Put( (void*)data ,r, 100); } if( pa_stream_drop( record->pulseStream() ) < 0 ) { @@ -373,17 +373,6 @@ static void retrieve_server_info(pa_context *c UNUSED, const pa_server_info *i, _debug("\t\tDefault source name : %s\n" , i->default_source_name); } -/* -static void retrieve_client_list(pa_context *c, const pa_client_info *i, int eol, void *userdata) -{ - _debug("end of list = %i\n", eol); - _debug("Clients Info: index : %i\n" , i->index); - _debug("\t\tClient name : %s\n" , i->name); - _debug("\t\tOwner module : %i\n" , i->owner_module); - _debug("\t\tDriver : %s\n" , i->driver); -} -*/ - static void reduce_sink_list_cb(pa_context *c UNUSED, const pa_sink_input_info *i, int eol, void *userdata) { PulseLayer* pulse = (PulseLayer*) userdata; -- GitLab