summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake/sound.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-11 16:15:55 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-11 16:15:55 +0000
commit7a2431213ad7bd3debb662dfac567eecc58b0ed6 (patch)
tree9049741c2ccc71069c0fbb5c0022d2d3b2d6d5f6 /perl-install/harddrake/sound.pm
parent296916504bb744ae2ced3e8f51a4baea0b58d4c4 (diff)
downloaddrakx-7a2431213ad7bd3debb662dfac567eecc58b0ed6.tar
drakx-7a2431213ad7bd3debb662dfac567eecc58b0ed6.tar.gz
drakx-7a2431213ad7bd3debb662dfac567eecc58b0ed6.tar.bz2
drakx-7a2431213ad7bd3debb662dfac567eecc58b0ed6.tar.xz
drakx-7a2431213ad7bd3debb662dfac567eecc58b0ed6.zip
(is_5_1_in_pulseaudio_enabled,set_5_1_in_pulseaudio,switch) enable to
set 5.1 channels (#38796)
Diffstat (limited to 'perl-install/harddrake/sound.pm')
-rw-r--r--perl-install/harddrake/sound.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index 5e706c486..71bcb1e61 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -241,6 +241,29 @@ sub set_pulseaudio_routing {
}
+
+my $pulse_config_file = '/etc/pulse/daemon.conf';
+
+sub is_5_1_in_pulseaudio_enabled() {
+ my ($val) = (cat_($pulse_config_file) =~ /^default-sample-channels\s*=\s*(\d+)/m); #^
+ $val ||= 2;
+ $val == 6;
+}
+
+sub set_5_1_in_pulseaudio {
+ my ($val) = @_;
+ $val = 'default-sample-channels = ' . ($val ? 6 : 2) . "\n";
+ my $done;
+ substInFile {
+ if (/^default-sample-channels\s*=/) {
+ $_ = $val;
+ $done = 1;
+ }
+ } $pulse_config_file;
+ append_to_file($pulse_config_file, $val) if !$done;
+}
+
+
sub rooted { run_program::rooted($::prefix, @_) }
sub unload { modules::unload(@_) if $::isStandalone || $blacklisted }
@@ -297,6 +320,7 @@ sub switch {
my $is_pulseaudio_enabled = is_pulseaudio_enabled();
my $is_pulseaudio_routing_enabled = is_pulseaudio_routing_enabled();
+ my $is_5_1_in_pulseaudio_enabled = is_5_1_in_pulseaudio_enabled();
my $is_user_switching = is_user_switching_enabled();
my @common = (
@@ -310,6 +334,10 @@ sub switch {
type => 'bool', val => \$is_pulseaudio_routing_enabled,
},
{
+ text => N("Enable 5.1 sound with Pulse Audio"),
+ type => 'bool', val => \$is_5_1_in_pulseaudio_enabled,
+ },
+ {
text => N("Enable user switching for audio applications"),
type => 'bool', val => \$is_user_switching,
},
@@ -335,6 +363,7 @@ sub switch {
)) {
set_pulseaudio($is_pulseaudio_enabled);
set_pulseaudio_routing($is_pulseaudio_routing_enabled);
+ set_5_1_in_pulseaudio($is_5_1_in_pulseaudio_enabled);
set_user_switching($is_user_switching);
}
} elsif ($in->ask_from_({ title => N("Sound configuration"),
@@ -373,6 +402,7 @@ To use alsa, one can either use:
{
set_pulseaudio($is_pulseaudio_enabled);
set_pulseaudio_routing($is_pulseaudio_routing_enabled);
+ set_5_1_in_pulseaudio($is_5_1_in_pulseaudio_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");