Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
J
jami-daemon
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
124
Issues
124
List
Boards
Labels
Milestones
Security & Compliance
Security & Compliance
Dependency List
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
savoirfairelinux
jami-daemon
Commits
73a54bf0
Commit
73a54bf0
authored
Sep 02, 2011
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* #6852: audiolayer creation depends only on preference.audioApi
parent
c1b8adde
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
95 additions
and
135 deletions
+95
-135
daemon/src/audio/alsa/alsalayer.cpp
daemon/src/audio/alsa/alsalayer.cpp
+1
-2
daemon/src/audio/audiolayer.cpp
daemon/src/audio/audiolayer.cpp
+1
-2
daemon/src/audio/audiolayer.h
daemon/src/audio/audiolayer.h
+1
-13
daemon/src/audio/pulseaudio/pulselayer.cpp
daemon/src/audio/pulseaudio/pulselayer.cpp
+1
-2
daemon/src/dbus/configurationmanager-introspec.xml
daemon/src/dbus/configurationmanager-introspec.xml
+2
-2
daemon/src/dbus/configurationmanager.cpp
daemon/src/dbus/configurationmanager.cpp
+2
-2
daemon/src/dbus/configurationmanager.h
daemon/src/dbus/configurationmanager.h
+2
-2
daemon/src/global.h
daemon/src/global.h
+2
-3
daemon/src/managerimpl.cpp
daemon/src/managerimpl.cpp
+14
-17
daemon/src/managerimpl.h
daemon/src/managerimpl.h
+4
-4
daemon/src/preferences.cpp
daemon/src/preferences.cpp
+3
-6
daemon/src/preferences.h
daemon/src/preferences.h
+3
-3
daemon/test/audiolayertest.cpp
daemon/test/audiolayertest.cpp
+10
-12
daemon/test/configurationtest.cpp
daemon/test/configurationtest.cpp
+6
-4
gnome/src/config/accountconfigdialog.c
gnome/src/config/accountconfigdialog.c
+2
-10
gnome/src/config/audioconf.c
gnome/src/config/audioconf.c
+22
-32
gnome/src/config/audioconf.h
gnome/src/config/audioconf.h
+1
-0
gnome/src/dbus/configurationmanager-introspec.xml
gnome/src/dbus/configurationmanager-introspec.xml
+2
-2
gnome/src/dbus/dbus.c
gnome/src/dbus/dbus.c
+3
-3
gnome/src/dbus/dbus.h
gnome/src/dbus/dbus.h
+6
-6
gnome/src/mainwindow.c
gnome/src/mainwindow.c
+1
-0
gnome/src/sflphone_const.h
gnome/src/sflphone_const.h
+4
-7
gnome/src/uimanager.c
gnome/src/uimanager.c
+2
-1
No files found.
daemon/src/audio/alsa/alsalayer.cpp
View file @
73a54bf0
...
...
@@ -73,8 +73,7 @@ void AlsaThread::run (void)
// Constructor
AlsaLayer
::
AlsaLayer
()
:
AudioLayer
(
ALSA
)
,
indexIn_
(
audioPref
.
getCardin
())
:
indexIn_
(
audioPref
.
getCardin
())
,
indexOut_
(
audioPref
.
getCardout
())
,
indexRing_
(
audioPref
.
getCardring
())
,
playbackHandle_
(
NULL
)
...
...
daemon/src/audio/audiolayer.cpp
View file @
73a54bf0
...
...
@@ -34,14 +34,13 @@
#include "audio/dcblocker.h"
#include "manager.h"
AudioLayer
::
AudioLayer
(
int
type
)
AudioLayer
::
AudioLayer
()
:
isStarted_
(
false
)
,
urgentRingBuffer_
(
SIZEBUF
,
Call
::
DEFAULT_ID
)
,
audioSampleRate_
(
Manager
::
instance
().
getMainBuffer
()
->
getInternalSamplingRate
())
,
mutex_
()
,
audioPref
(
Manager
::
instance
().
audioPreference
)
,
converter_
(
new
SamplerateConverter
(
audioSampleRate_
))
,
layerType_
(
type
)
,
lastNotificationTime_
(
0
)
{
urgentRingBuffer_
.
createReadPointer
();
...
...
daemon/src/audio/audiolayer.h
View file @
73a54bf0
...
...
@@ -66,7 +66,7 @@ class AudioLayer
/**
* Constructor
*/
AudioLayer
(
int
type
);
AudioLayer
();
/**
* Destructor
...
...
@@ -111,15 +111,6 @@ class AudioLayer
return
audioSampleRate_
;
}
/**
* Get the layer type for this instance (either Alsa or PulseAudio)
* @return unsigned int The layer type
*
*/
int
getLayerType
(
void
)
const
{
return
layerType_
;
}
/**
* Get a pointer to the application MainBuffer class.
*
...
...
@@ -172,9 +163,6 @@ class AudioLayer
private:
const
int
layerType_
;
/**
* Time of the last incoming call notification
*/
...
...
daemon/src/audio/pulseaudio/pulselayer.cpp
View file @
73a54bf0
...
...
@@ -193,8 +193,7 @@ void context_changed_callback (pa_context* c, pa_subscription_event_type_t t, ui
PulseLayer
::
PulseLayer
()
:
AudioLayer
(
PULSEAUDIO
)
,
playback_
(
0
)
:
playback_
(
0
)
,
record_
(
0
)
,
ringtone_
(
0
)
,
mic_buffer_
(
NULL
)
...
...
daemon/src/dbus/configurationmanager-introspec.xml
View file @
73a54bf0
...
...
@@ -226,7 +226,7 @@
<method
name=
"getAudioManager"
tp:name-for-bindings=
"getAudioManager"
>
<tp:docstring>
</tp:docstring>
<arg
type=
"
i
"
name=
"api"
direction=
"out"
>
<arg
type=
"
s
"
name=
"api"
direction=
"out"
>
<tp:docstring>
</tp:docstring>
</arg>
...
...
@@ -235,7 +235,7 @@
<method
name=
"setAudioManager"
tp:name-for-bindings=
"setAudioManager"
>
<tp:docstring>
</tp:docstring>
<arg
type=
"
i
"
name=
"api"
direction=
"in"
>
<arg
type=
"
s
"
name=
"api"
direction=
"in"
>
<tp:docstring>
</tp:docstring>
</arg>
...
...
daemon/src/dbus/configurationmanager.cpp
View file @
73a54bf0
...
...
@@ -361,12 +361,12 @@ void ConfigurationManager::setHistoryLimit (const int32_t& days)
Manager
::
instance
().
setHistoryLimit
(
days
);
}
void
ConfigurationManager
::
setAudioManager
(
const
int32_t
&
api
)
void
ConfigurationManager
::
setAudioManager
(
const
std
::
string
&
api
)
{
Manager
::
instance
().
setAudioManager
(
api
);
}
int32_t
ConfigurationManager
::
getAudioManager
(
void
)
std
::
string
ConfigurationManager
::
getAudioManager
(
void
)
{
return
Manager
::
instance
().
getAudioManager
();
}
...
...
daemon/src/dbus/configurationmanager.h
View file @
73a54bf0
...
...
@@ -94,8 +94,8 @@ class ConfigurationManager
void
setEchoCancelDelay
(
const
int32_t
&
length
);
int
getEchoCancelDelay
(
void
);
int32_t
getAudioManager
(
void
);
void
setAudioManager
(
const
int32_t
&
api
);
std
::
string
getAudioManager
(
void
);
void
setAudioManager
(
const
std
::
string
&
api
);
int32_t
isIax2Enabled
(
void
);
std
::
string
getRecordPath
(
void
);
...
...
daemon/src/global.h
View file @
73a54bf0
...
...
@@ -119,9 +119,8 @@ static const SOUND_FORMAT INT32 = 0x8;
#define PULSEAUDIO_NOT_RUNNING 0x0100
/** Pulseaudio is not running */
#define CODECS_NOT_LOADED 0x1000
/** Codecs not found */
#define ALSA 0
#define PULSEAUDIO 1
#define PULSEAUDIO_API_STR "pulseaudio"
#define ALSA_API_STR "alsa"
#define UNUSED __attribute__((__unused__))
#define DEFAULT_SIP_PORT 5060
...
...
daemon/src/managerimpl.cpp
View file @
73a54bf0
...
...
@@ -2262,7 +2262,7 @@ void ManagerImpl::setMailNotify (void)
saveConfig
();
}
void
ManagerImpl
::
setAudioManager
(
int32_t
api
)
void
ManagerImpl
::
setAudioManager
(
const
std
::
string
&
api
)
{
audioLayerMutexLock
();
...
...
@@ -2271,9 +2271,7 @@ void ManagerImpl::setAudioManager (int32_t api)
return
;
}
int
layerType
=
_audiodriver
->
getLayerType
();
if
(
layerType
==
api
)
{
if
(
api
==
preferences
.
getAudioApi
())
{
_debug
(
"Manager: Audio manager chosen already in use. No changes made. "
);
audioLayerMutexUnlock
();
return
;
...
...
@@ -2281,14 +2279,12 @@ void ManagerImpl::setAudioManager (int32_t api)
audioLayerMutexUnlock
();
preferences
.
setAudioApi
(
api
);
switchAudioManager
();
saveConfig
();
}
int32_t
ManagerImpl
::
getAudioManager
(
void
)
const
std
::
string
ManagerImpl
::
getAudioManager
(
void
)
const
{
return
preferences
.
getAudioApi
();
}
...
...
@@ -2392,10 +2388,10 @@ void ManagerImpl::initAudioDriver (void)
audioPreference
.
setCardring
(
ALSA_DFT_CARD_ID
);
}
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO
&&
system
(
"ps -C pulseaudio"
)
==
0
)
{
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO
_API_STR
and
system
(
"ps -C pulseaudio"
)
==
0
)
_audiodriver
=
new
PulseLayer
;
}
else
{
preferences
.
setAudioApi
(
ALSA
);
else
{
preferences
.
setAudioApi
(
ALSA_API_STR
);
_audiodriver
=
new
AlsaLayer
;
}
...
...
@@ -2407,14 +2403,16 @@ void ManagerImpl::switchAudioManager (void)
audioLayerMutexLock
();
bool
wasStarted
=
_audiodriver
->
isStarted
();
int
newType
=
(
_audiodriver
->
getLayerType
()
==
PULSEAUDIO
)
?
ALSA
:
PULSEAUDIO
;
delete
_audiodriver
;
if
(
newType
==
ALSA
)
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO_API_STR
)
{
_audiodriver
=
new
AlsaLayer
;
else
_audiodriver
=
new
PulseLayer
();
preferences
.
setAudioApi
(
ALSA_API_STR
);
}
else
{
_audiodriver
=
new
PulseLayer
;
preferences
.
setAudioApi
(
PULSEAUDIO_API_STR
);
}
if
(
wasStarted
)
_audiodriver
->
startStream
();
...
...
@@ -2442,13 +2440,12 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate)
else
_debug
(
"Manager: Audio sampling rate changed: %d -> %d"
,
currentSamplerate
,
samplerate
);
int
type
=
_audiodriver
->
getLayerType
();
bool
wasActive
=
_audiodriver
->
isStarted
();
_mainBuffer
.
setInternalSamplingRate
(
samplerate
);
delete
_audiodriver
;
if
(
type
==
PULSEAUDIO
)
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO_API_STR
)
_audiodriver
=
new
PulseLayer
;
else
_audiodriver
=
new
AlsaLayer
;
...
...
daemon/src/managerimpl.h
View file @
73a54bf0
...
...
@@ -726,15 +726,15 @@ class ManagerImpl
/**
* Get the audio manager
* @return int The audio manager
*
0 ALSA
*
1 PULSEAUDIO
*
"alsa"
*
"pulseaudio"
*/
int32_t
getAudioManager
(
void
)
const
;
std
::
string
getAudioManager
(
void
)
const
;
/**
* Set the audio manager
*/
void
setAudioManager
(
int32_t
api
);
void
setAudioManager
(
const
std
::
string
&
api
);
void
switchAudioManager
(
void
);
...
...
daemon/src/preferences.cpp
View file @
73a54bf0
...
...
@@ -44,7 +44,7 @@ namespace {
}
// end anonymous namespace
Preferences
::
Preferences
()
:
_accountOrder
(
""
)
,
_audioApi
(
1
)
// 1 is pulseaudio, 0 alsa
,
_audioApi
(
PULSEAUDIO_API_STR
)
,
_historyLimit
(
30
)
,
_historyMaxCalls
(
20
)
,
_notifyMails
(
false
)
...
...
@@ -66,8 +66,7 @@ void Preferences::serialize (Conf::YamlEmitter *emiter)
Conf
::
MappingNode
preferencemap
(
NULL
);
Conf
::
ScalarNode
order
(
_accountOrder
);
std
::
string
audioapistr
=
(
_audioApi
==
1
)
?
"pulseaudio"
:
"alsa"
;
Conf
::
ScalarNode
audioapi
(
audioapistr
);
Conf
::
ScalarNode
audioapi
(
_audioApi
);
std
::
stringstream
histlimitstr
;
histlimitstr
<<
_historyLimit
;
Conf
::
ScalarNode
historyLimit
(
histlimitstr
.
str
());
...
...
@@ -109,10 +108,8 @@ void Preferences::unserialize (Conf::MappingNode *map)
}
map
->
getValue
(
orderKey
,
&
_accountOrder
);
std
::
string
audioApi
;
map
->
getValue
(
audioApiKey
,
&
audioApi
);
map
->
getValue
(
audioApiKey
,
&
_audioApi
);
// 1 is pulseaudio, 0 is alsa
_audioApi
=
(
audioApi
==
"pulseaudio"
)
?
1
:
0
;
map
->
getValue
(
historyLimitKey
,
&
_historyLimit
);
map
->
getValue
(
historyMaxCallsKey
,
&
_historyMaxCalls
);
map
->
getValue
(
notifyMailsKey
,
&
_notifyMails
);
...
...
daemon/src/preferences.h
View file @
73a54bf0
...
...
@@ -121,10 +121,10 @@ class Preferences : public Serializable
_accountOrder
=
ord
;
}
int
getAudioApi
(
void
)
const
{
std
::
string
getAudioApi
(
void
)
const
{
return
_audioApi
;
}
void
setAudioApi
(
int
api
)
{
void
setAudioApi
(
const
std
::
string
&
api
)
{
_audioApi
=
api
;
}
...
...
@@ -196,7 +196,7 @@ class Preferences : public Serializable
// account order
std
::
string
_accountOrder
;
int
_audioApi
;
std
::
string
_audioApi
;
int
_historyLimit
;
int
_historyMaxCalls
;
bool
_notifyMails
;
...
...
daemon/test/audiolayertest.cpp
View file @
73a54bf0
...
...
@@ -67,20 +67,18 @@ void AudioLayerTest::testAudioLayerSwitch()
{
_debug
(
"-------------------- AudioLayerTest::testAudioLayerSwitch --------------------
\n
"
);
int
previous_layer
=
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
()
;
bool
wasAlsa
=
dynamic_cast
<
AlsaLayer
*>
(
Manager
::
instance
().
getAudioDriver
())
!=
0
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
_debug
(
"iter - %i"
,
i
);
_debug
(
"iter - %i"
,
i
);
Manager
::
instance
().
switchAudioManager
();
if
(
previous_layer
==
ALSA
)
{
CPPUNIT_ASSERT
(
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
()
==
PULSEAUDIO
);
}
else
{
CPPUNIT_ASSERT
(
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
()
==
ALSA
);
}
previous_layer
=
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
();
if
(
wasAlsa
)
CPPUNIT_ASSERT
(
dynamic_cast
<
PulseLayer
*>
(
Manager
::
instance
().
getAudioDriver
()));
else
CPPUNIT_ASSERT
(
dynamic_cast
<
AlsaLayer
*>
(
Manager
::
instance
().
getAudioDriver
()));
wasAlsa
=
dynamic_cast
<
AlsaLayer
*>
(
Manager
::
instance
().
getAudioDriver
())
!=
0
;
usleep
(
100000
);
}
}
...
...
@@ -89,7 +87,7 @@ void AudioLayerTest::testPulseConnect()
{
_debug
(
"-------------------- AudioLayerTest::testPulseConnect --------------------
\n
"
);
if
(
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
()
==
ALSA
)
{
if
(
dynamic_cast
<
AlsaLayer
*>
(
Manager
::
instance
().
getAudioDriver
())
)
{
Manager
::
instance
().
switchAudioManager
();
usleep
(
100000
);
}
...
...
@@ -97,7 +95,7 @@ void AudioLayerTest::testPulseConnect()
ManagerImpl
*
manager
;
manager
=
&
Manager
::
instance
();
_pulselayer
=
(
PulseLayer
*
)
Manager
::
instance
().
getAudioDriver
(
);
_pulselayer
=
dynamic_cast
<
PulseLayer
*>
(
Manager
::
instance
().
getAudioDriver
()
);
CPPUNIT_ASSERT
(
_pulselayer
->
getLayerType
()
==
PULSEAUDIO
);
CPPUNIT_ASSERT
(
_pulselayer
);
}
daemon/test/configurationtest.cpp
View file @
73a54bf0
...
...
@@ -33,6 +33,8 @@
#include "configurationtest.h"
#include "constants.h"
#include "audio/alsa/alsalayer.h"
#include "audio/pulseaudio/pulselayer.h"
using
std
::
cout
;
using
std
::
endl
;
...
...
@@ -79,10 +81,10 @@ void ConfigurationTest::testInitAudioDriver()
CPPUNIT_FAIL
(
"Error while loading audio layer"
);
// Check if it has been created with the right type
if
(
Manager
::
instance
().
preferences
.
getAudioApi
()
==
ALSA
)
CPPUNIT_ASSERT
_EQUAL
(
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
(),
ALSA
);
else
if
(
Manager
::
instance
().
preferences
.
getAudioApi
()
==
PULSEAUDIO
)
CPPUNIT_ASSERT
_EQUAL
(
Manager
::
instance
().
getAudioDriver
()
->
getLayerType
(),
PULSEAUDIO
);
if
(
Manager
::
instance
().
preferences
.
getAudioApi
()
==
"alsa"
)
CPPUNIT_ASSERT
(
!
dynamic_cast
<
PulseLayer
*>
(
Manager
::
instance
().
getAudioDriver
())
);
else
if
(
Manager
::
instance
().
preferences
.
getAudioApi
()
==
"pulseaudio"
)
CPPUNIT_ASSERT
(
!
dynamic_cast
<
AlsaLayer
*>
(
Manager
::
instance
().
getAudioDriver
())
);
else
CPPUNIT_FAIL
(
"Wrong audio layer type"
);
}
...
...
gnome/src/config/accountconfigdialog.c
View file @
73a54bf0
...
...
@@ -177,18 +177,10 @@ is_iax_enabled (void)
void
select_dtmf_type
(
void
)
{
DEBUG
(
"DTMF selection changed
\n
"
);
if
(
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
overrtp
)))
{
// dbus_set_audio_manager( ALSA );
if
(
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
overrtp
)))
DEBUG
(
"Selected DTMF over RTP"
);
}
else
{
// dbus_set_audio_manager( PULSEAUDIO );
else
DEBUG
(
"Selected DTMF over SIP"
);
}
}
static
GPtrArray
*
getNewCredential
(
void
)
...
...
gnome/src/config/audioconf.c
View file @
73a54bf0
...
...
@@ -194,7 +194,7 @@ preferences_dialog_fill_ringtone_audio_device_list()
void
select_active_output_audio_device
()
{
if
(
SHOW_ALSA_CONF
)
{
if
(
must_show_alsa_conf
()
)
{
GtkTreeModel
*
model
;
GtkTreeIter
iter
;
...
...
@@ -234,7 +234,7 @@ select_active_output_audio_device()
void
select_active_ringtone_audio_device
()
{
if
(
SHOW_ALSA_CONF
)
{
if
(
must_show_alsa_conf
()
)
{
GtkTreeModel
*
model
;
GtkTreeIter
iter
;
...
...
@@ -299,7 +299,7 @@ preferences_dialog_fill_input_audio_device_list()
void
select_active_input_audio_device
()
{
if
(
SHOW_ALSA_CONF
)
{
if
(
must_show_alsa_conf
()
)
{
GtkTreeModel
*
model
;
GtkTreeIter
iter
;
...
...
@@ -718,15 +718,15 @@ GtkWidget* audiocodecs_box (account_t *a)
void
select_audio_manager
(
void
)
{
if
(
!
SHOW_ALSA_CONF
&&
!
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
pulse
)))
{
dbus_set_audio_manager
(
ALSA
);
if
(
!
must_show_alsa_conf
()
&&
!
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
pulse
)))
{
dbus_set_audio_manager
(
ALSA
_API_STR
);
alsabox
=
alsa_box
();
gtk_container_add
(
GTK_CONTAINER
(
alsa_conf
)
,
alsabox
);
gtk_widget_show
(
alsa_conf
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
alsa_conf
),
TRUE
);
gtk_action_set_sensitive
(
GTK_ACTION
(
volumeToggle
),
TRUE
);
}
else
if
(
SHOW_ALSA_CONF
&&
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
pulse
)))
{
dbus_set_audio_manager
(
PULSEAUDIO
);
}
else
if
(
must_show_alsa_conf
()
&&
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
pulse
)))
{
dbus_set_audio_manager
(
PULSEAUDIO
_API_STR
);
gtk_container_remove
(
GTK_CONTAINER
(
alsa_conf
)
,
alsabox
);
gtk_widget_hide
(
alsa_conf
);
if
(
gtk_toggle_action_get_active
(
GTK_TOGGLE_ACTION
(
volumeToggle
)))
{
...
...
@@ -954,12 +954,12 @@ GtkWidget* create_audio_configuration()
gnome_main_section_new_with_table
(
_
(
"Sound Manager"
),
&
frame
,
&
table
,
1
,
4
);
gtk_box_pack_start
(
GTK_BOX
(
ret
),
frame
,
FALSE
,
FALSE
,
0
);
int
audio_manager
=
dbus_get_audio_manager
();
gchar
*
audio_manager
=
dbus_get_audio_manager
();
gboolean
pulse_audio
=
FALSE
;
if
(
audio_manager
==
PULSEAUDIO
)
{
if
(
g_strcmp0
(
audio_manager
,
PULSEAUDIO_API_STR
)
==
0
)
pulse_audio
=
TRUE
;
}
g_free
(
audio_manager
);
pulse
=
gtk_radio_button_new_with_mnemonic
(
NULL
,
_
(
"_Pulseaudio"
));
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
pulse
),
pulse_audio
);
...
...
@@ -975,7 +975,7 @@ GtkWidget* create_audio_configuration()
gtk_box_pack_start
(
GTK_BOX
(
ret
),
alsa_conf
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
alsa_conf
);
if
(
SHOW_ALSA_CONF
)
{
if
(
must_show_alsa_conf
()
)
{
// Box for the ALSA configuration
alsabox
=
alsa_box
();
gtk_container_add
(
GTK_CONTAINER
(
alsa_conf
)
,
alsabox
);
...
...
@@ -1033,37 +1033,27 @@ GtkWidget* create_audio_configuration()
enableEchoCancel
=
gtk_check_button_new_with_mnemonic
(
_
(
"_Echo Cancellation"
));
state
=
dbus_get_echo_cancel_state
();
echoCancelActive
=
FALSE
;
if
(
g_strcmp0
(
state
,
"enabled"
)
==
0
)
{
if
(
g_strcmp0
(
state
,
"enabled"
)
==
0
)
echoCancelActive
=
TRUE
;
}
else
{
else
echoCancelActive
=
FALSE
;
}
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
enableEchoCancel
),
echoCancelActive
);
g_signal_connect
(
G_OBJECT
(
enableEchoCancel
),
"clicked"
,
active_echo_cancel
,
NULL
);
gtk_table_attach
(
GTK_TABLE
(
table
),
enableEchoCancel
,
0
,
1
,
2
,
3
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
/*
gint value = dbus_get_echo_cancel_tail_length();
echoTailLength = gtk_hscale_new_with_range(100, 500, 5);
gtk_range_set_value(GTK_RANGE(echoTailLength), (gdouble)value);
gtk_table_attach(GTK_TABLE(table), echoTailLength, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(echoTailLength), "value-changed", G_CALLBACK(echo_tail_length_changed), NULL);
value = dbus_get_echo_cancel_delay();
echoDelay = gtk_hscale_new_with_range(0, 500, 5);
gtk_range_set_value(GTK_RANGE(echoDelay), (gdouble)value);
gtk_table_attach(GTK_TABLE(table), echoDelay, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(echoDelay), "value-changed", G_CALLBACK(echo_delay_changed), NULL);
*/
gtk_widget_show_all
(
ret
);
if
(
!
pulse_audio
)
{
if
(
!
pulse_audio
)
gtk_widget_show
(
alsa_conf
);
}
else
{
else
gtk_widget_hide
(
alsa_conf
);
}
return
ret
;
}
/** Show/Hide the alsa configuration panel */
gboolean
must_show_alsa_conf
()
{
return
g_strcmp0
(
dbus_get_audio_manager
(),
ALSA_API_STR
)
==
0
;
}
gnome/src/config/audioconf.h
View file @
73a54bf0
...
...
@@ -42,5 +42,6 @@ GtkWidget* audiocodecs_box();
GtkWidget
*
ringtone_box
();
gboolean
get_api
();
gboolean
must_show_alsa_conf
();
#endif // __AUDIO_CONF_H
gnome/src/dbus/configurationmanager-introspec.xml
View file @
73a54bf0
...
...
@@ -226,7 +226,7 @@
<method
name=
"getAudioManager"
tp:name-for-bindings=
"getAudioManager"
>
<tp:docstring>
</tp:docstring>
<arg
type=
"
i
"
name=
"api"
direction=
"out"
>
<arg
type=
"
s
"
name=
"api"
direction=
"out"
>
<tp:docstring>
</tp:docstring>
</arg>
...
...
@@ -235,7 +235,7 @@
<method
name=
"setAudioManager"
tp:name-for-bindings=
"setAudioManager"
>
<tp:docstring>
</tp:docstring>
<arg
type=
"
i
"
name=
"api"
direction=
"in"
>
<arg
type=
"
s
"
name=
"api"
direction=
"in"
>
<tp:docstring>
</tp:docstring>
</arg>
...
...
gnome/src/dbus/dbus.c
View file @
73a54bf0
...
...
@@ -1734,7 +1734,7 @@ dbus_get_history_limit (void)
}
void
dbus_set_audio_manager
(
int
api
)
dbus_set_audio_manager
(
const
gchar
*
api
)
{
GError
*
error
=
NULL
;
org_sflphone_SFLphone_ConfigurationManager_set_audio_manager
(
...
...
@@ -1744,10 +1744,10 @@ dbus_set_audio_manager (int api)
g_error_free
(
error
);
}
int
gchar
*
dbus_get_audio_manager
(
void
)
{
int
api
;
gchar
*
api
;
GError
*
error
=
NULL
;
org_sflphone_SFLphone_ConfigurationManager_get_audio_manager
(
configurationManagerProxy
,
&
api
,
&
error
);
...
...
gnome/src/dbus/dbus.h
View file @
73a54bf0
...
...
@@ -338,17 +338,17 @@ void dbus_set_history_limit (const guint days);
/**
* ConfigurationManager - Returns the selected audio manager
* @return
int 0 ALSA
*
1 PULSEAUDIO
* @return
"alsa"
*
or "pulseaudio"
*/
int
dbus_get_audio_manager
(
void
);
gchar
*
dbus_get_audio_manager
(
void
);
/**
* ConfigurationManager - Set the audio manager
* @param api
0 ALSA
*
1 PULSEAUDIO
* @param api
"alsa"
*
"pulseaudio"
*/
void
dbus_set_audio_manager
(
int
api
);
void
dbus_set_audio_manager
(
const
gchar
*
api
);
/**
* ConfigurationManager - Start a tone when a new call is open and no numbers have been dialed
...
...
gnome/src/mainwindow.c
View file @
73a54bf0
...
...
@@ -43,6 +43,7 @@
#include <widget/gtkscrollbook.h>
#include <widget/minidialog.h>
#include "uimanager.h"
#include "config/audioconf.h"
#include <sys/stat.h>
#include <gtk/gtk.h>
...
...
gnome/src/sflphone_const.h
View file @
73a54bf0
...
...
@@ -135,6 +135,9 @@
/** Error codecs not loaded */
#define CODECS_NOT_LOADED 0x1000
#define PULSEAUDIO_API_STR "pulseaudio"
#define ALSA_API_STR "alsa"
/** Tone to play when no voice mails */
#define TONE_WITHOUT_MESSAGE 0
/** Tone to play when voice mails */
...
...
@@ -143,14 +146,8 @@
#define MINIMIZED TRUE
/** Behaviour of the main window on incoming calls */
#define __POPUP_WINDOW (eel_gconf_get_integer (POPUP_ON_CALL))
/** Show/Hide the alsa configuration panel */
#define SHOW_ALSA_CONF ( dbus_get_audio_manager() == ALSA )
/** Show/Hide the volume controls */
#define SHOW_VOLUME (eel_gconf_get_integer (SHOW_VOLUME_CONTROLS) && SHOW_ALSA_CONF)
/** Audio Managers */
#define ALSA 0
#define PULSEAUDIO 1
#define SHOW_VOLUME (eel_gconf_get_integer (SHOW_VOLUME_CONTROLS) && must_show_alsa_conf())
/** DTMF type */
#define OVERRTP "overrtp"
...
...
gnome/src/uimanager.c
View file @
73a54bf0
...
...
@@ -44,6 +44,7 @@
#include <eel-gconf-extensions.h>
#include "config/audioconf.h"
#include "uimanager.h"
#include "statusicon.h"
...
...
@@ -1767,7 +1768,7 @@ create_menus (GtkUIManager *ui_manager)
// Set the toggle buttons
gtk_toggle_action_set_active
(
GTK_TOGGLE_ACTION
(
gtk_ui_manager_get_action
(
ui_manager
,
"/MenuBar/ViewMenu/Dialpad"
)),
eel_gconf_get_boolean
(
CONF_SHOW_DIALPAD
));
gtk_toggle_action_set_active
(
GTK_TOGGLE_ACTION
(
volumeToggle
),
(
gboolean
)
SHOW_VOLUME
);
gtk_action_set_sensitive
(
GTK_ACTION
(
volumeToggle
),
SHOW_ALSA_CONF
);
gtk_action_set_sensitive
(
GTK_ACTION
(
volumeToggle
),
must_show_alsa_conf
()
);
gtk_action_set_sensitive
(
GTK_ACTION
(
gtk_ui_manager_get_action
(
ui_manager
,
"/MenuBar/ViewMenu/Toolbar"
)),
FALSE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment