Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
ce774cc5
Commit
ce774cc5
authored
Sep 07, 2011
by
Tristan Matthews
Browse files
* #6852: Preferences now solely responsible for audiolayer creation.
parent
166dac9e
Changes
3
Show whitespace changes
Inline
Side-by-side
daemon/src/managerimpl.cpp
View file @
ce774cc5
...
...
@@ -1993,8 +1993,7 @@ void ManagerImpl::setAudioPlugin (const std::string& audioPlugin)
// Recreate audio driver with new settings
delete
_audiodriver
;
_audiodriver
=
new
AlsaLayer
;
assert
(
preferences
.
getAudioApi
()
==
ALSA_API_STR
);
_audiodriver
=
preferences
.
createAudioLayer
();
if
(
wasStarted
)
_audiodriver
->
startStream
();
...
...
@@ -2033,8 +2032,7 @@ void ManagerImpl::setAudioDevice (const int index, int streamType)
// Recreate audio driver with new settings
delete
_audiodriver
;
_audiodriver
=
new
AlsaLayer
;
assert
(
preferences
.
getAudioApi
()
==
ALSA_API_STR
);
_audiodriver
=
preferences
.
createAudioLayer
();
if
(
wasStarted
)
_audiodriver
->
startStream
();
...
...
@@ -2390,12 +2388,7 @@ void ManagerImpl::initAudioDriver (void)
audioPreference
.
setCardring
(
ALSA_DFT_CARD_ID
);
}
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO_API_STR
and
system
(
"ps -C pulseaudio"
)
==
0
)
_audiodriver
=
new
PulseLayer
;
else
{
preferences
.
setAudioApi
(
ALSA_API_STR
);
_audiodriver
=
new
AlsaLayer
;
}
_audiodriver
=
preferences
.
createAudioLayer
();
audioLayerMutexUnlock
();
}
...
...
@@ -2407,14 +2400,7 @@ void ManagerImpl::switchAudioManager (void)
bool
wasStarted
=
_audiodriver
->
isStarted
();
delete
_audiodriver
;
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO_API_STR
)
{
_audiodriver
=
new
AlsaLayer
;
preferences
.
setAudioApi
(
ALSA_API_STR
);
}
else
{
_audiodriver
=
new
PulseLayer
;
preferences
.
setAudioApi
(
PULSEAUDIO_API_STR
);
}
_audiodriver
=
preferences
.
switchAndCreateAudioLayer
();
if
(
wasStarted
)
_audiodriver
->
startStream
();
...
...
@@ -2447,10 +2433,7 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate)
_mainBuffer
.
setInternalSamplingRate
(
samplerate
);
delete
_audiodriver
;
if
(
preferences
.
getAudioApi
()
==
PULSEAUDIO_API_STR
)
_audiodriver
=
new
PulseLayer
;
else
_audiodriver
=
new
AlsaLayer
;
_audiodriver
=
preferences
.
createAudioLayer
();
unsigned
int
sampleRate
=
_audiodriver
->
getSampleRate
();
...
...
daemon/src/preferences.cpp
View file @
ce774cc5
...
...
@@ -29,6 +29,8 @@
*/
#include
"preferences.h"
#include
"audio/alsa/alsalayer.h"
#include
"audio/pulseaudio/pulselayer.h"
#include
<sstream>
#include
"global.h"
#include
<cassert>
...
...
@@ -58,8 +60,24 @@ Preferences::Preferences() : _accountOrder ("")
}
Preferences
::~
Preferences
()
{}
AudioLayer
*
Preferences
::
createAudioLayer
()
{
if
(
_audioApi
==
PULSEAUDIO_API_STR
and
system
(
"ps -C pulseaudio"
)
==
0
)
return
new
PulseLayer
;
else
{
_audioApi
=
ALSA_API_STR
;
return
new
AlsaLayer
;
}
}
AudioLayer
*
Preferences
::
switchAndCreateAudioLayer
()
{
if
(
_audioApi
==
PULSEAUDIO_API_STR
)
_audioApi
=
ALSA_API_STR
;
else
_audioApi
=
PULSEAUDIO_API_STR
;
return
createAudioLayer
();
}
void
Preferences
::
serialize
(
Conf
::
YamlEmitter
*
emiter
)
{
...
...
daemon/src/preferences.h
View file @
ce774cc5
...
...
@@ -97,6 +97,7 @@ const std::string popupShortKey ("popupWindow");
const
std
::
string
toggleHoldShortKey
(
"toggleHold"
);
const
std
::
string
togglePickupHangupShortKey
(
"togglePickupHangup"
);
class
AudioLayer
;
class
Preferences
:
public
Serializable
{
...
...
@@ -107,7 +108,8 @@ class Preferences : public Serializable
Preferences
();
~
Preferences
();
AudioLayer
*
createAudioLayer
();
AudioLayer
*
switchAndCreateAudioLayer
();
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
);
...
...
Write
Preview
Supports
Markdown
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