summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-11 15:44:48 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-11 15:44:48 +0000
commitd565c7aff96085173d463e208b661b7d77492ea5 (patch)
treef7cfdeadd8725e2fd67bc3ba05b58fe6782e7848
parent1ce19eaa760f337878e7e681cfcf7ddcf2621d9c (diff)
downloaddrakx-d565c7aff96085173d463e208b661b7d77492ea5.tar
drakx-d565c7aff96085173d463e208b661b7d77492ea5.tar.gz
drakx-d565c7aff96085173d463e208b661b7d77492ea5.tar.bz2
drakx-d565c7aff96085173d463e208b661b7d77492ea5.tar.xz
drakx-d565c7aff96085173d463e208b661b7d77492ea5.zip
(is_pulseaudio_routing_enabled,set_pulseaudio_routing,switch) add
support to enable/disable ALSA to PA routing (#37826)
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/harddrake/sound.pm28
2 files changed, 29 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index bcdd7ab5c..87b894d7a 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,6 +1,7 @@
- diskdrake:
o really fix partition device name for some dmraid (missing "p", cf #38363)
- draksound (#37826):
+ o add support to enable/disable ALSA to PA routing (#37826)
o add support to enable/disable PulseAudio
o add support to enable/disable user switching
o display trouble shooting when there's no driver too
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index 7bc45c132..3f78815c5 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -220,6 +220,27 @@ sub set_pulseaudio {
append_to_file($config_file, $val) if !$done;
}
+
+my $alsa_routing_config_file = '/etc/alsa/pulse-default.conf';
+my $disabling_routing = '#-DRAKSOUND- ';
+
+sub is_pulseaudio_routing_enabled() {
+ return -f $alsa_routing_config_file &&
+ cat_($alsa_routing_config_file) !~ /$disabling_routing/;
+}
+
+sub set_pulseaudio_routing {
+ my ($val) = @_;
+ substInFile {
+ if ($val) {
+ s/^$disabling_routing//;
+ } else {
+ s/^/$disabling_routing/;
+ }
+ } $alsa_routing_config_file;
+}
+
+
sub rooted { run_program::rooted($::prefix, @_) }
sub unload { modules::unload(@_) if $::isStandalone || $blacklisted }
@@ -275,6 +296,7 @@ sub switch {
my %des = modules::category2modules_and_description('multimedia/sound');
my $is_pulseaudio_enabled = is_pulseaudio_enabled();
+ my $is_pulseaudio_routing_enabled = is_pulseaudio_routing_enabled();
my $is_user_switching = is_user_switching_enabled();
my @common = (
@@ -284,6 +306,10 @@ sub switch {
type => 'bool', val => \$is_pulseaudio_enabled,
},
{
+ text => N("Automatic routing from ALSA to PulseAudio"),
+ type => 'bool', val => \$is_pulseaudio_routing_enabled,
+ },
+ {
text => N("Enable user switching for audio applications"),
type => 'bool', val => \$is_user_switching,
},
@@ -303,6 +329,7 @@ sub switch {
\@common,
)) {
set_pulseaudio($is_pulseaudio_enabled);
+ set_pulseaudio_routing($is_pulseaudio_routing_enabled);
set_user_switching($is_user_switching);
}
} elsif ($in->ask_from_({ title => N("Sound configuration"),
@@ -340,6 +367,7 @@ To use alsa, one can either use:
]))
{
set_pulseaudio($is_pulseaudio_enabled);
+ set_pulseaudio_routing($is_pulseaudio_routing_enabled);
set_user_switching($is_user_switching);
return if $new_driver eq $device->{current_driver};
log::explanations("switching audio driver from '" . $device->{current_driver} . "' to '$new_driver'\n");