From 6c2f639c921e860f1c357f9966c3b3ca89838166 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 14 Apr 2009 15:26:27 +0000 Subject: (is_pulseaudio_glitchfree_enabled,set_pulseaudio_glitchfree) enable to enable/disable glitch-free feature of PA --- perl-install/NEWS | 2 ++ perl-install/harddrake/sound.pm | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index be916897a..9ede81460 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -2,6 +2,8 @@ o Only write raid config into $::prefix if we are in install mode, this fixes draklive-install which should write to /etc directly as $::prefix does not yet exist (#49632) +- draksound: + o enable to enable/disable glitch-free feature of PA - harddrake: o do not open branches by default o fix listing some ATA (eg: pata_marvell) devices as unknown diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index f237c8eab..d0ecbc24d 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -241,6 +241,27 @@ sub set_pulseaudio_routing { } +my $pa_defaultsconfig_file = "$::prefix/etc/pulse/default.pa"; + +sub is_pulseaudio_glitchfree_enabled() { + return -f $pa_defaultsconfig_file && + cat_($pa_defaultsconfig_file) !~ /^load-module\s+module-hal-detect\s+tsched=0/m; +} + +sub set_pulseaudio_glitchfree { + my ($val) = @_; + my $string = "load-module module-hal-detect tsched=0\n"; + substInFile { + if (/^load-module\s*module-hal-detect/) { + if ($val) { + s/\s*tsched=0//; + } else { + $_ = $string; + } + } + } $pa_defaultsconfig_file; +} + my $pa_client_conffile = "$::prefix/etc/pulse/client.conf"; sub set_PA_autospan { @@ -335,6 +356,7 @@ sub switch { my $is_pulseaudio_enabled = is_pulseaudio_enabled(); my $is_pulseaudio_routing_enabled = is_pulseaudio_routing_enabled(); + my $is_pulseaudio_glitchfree_enabled = is_pulseaudio_glitchfree_enabled(); my $is_5_1_in_pulseaudio_enabled = is_5_1_in_pulseaudio_enabled(); my $is_user_switching = is_user_switching_enabled(); @@ -343,6 +365,7 @@ sub switch { my $write_config = sub { set_pulseaudio($is_pulseaudio_enabled); set_pulseaudio_routing($is_pulseaudio_enabled && $is_pulseaudio_routing_enabled); + set_pulseaudio_glitchfree($is_pulseaudio_glitchfree_enabled); set_PA_autospan($is_pulseaudio_enabled); set_5_1_in_pulseaudio($is_5_1_in_pulseaudio_enabled); set_user_switching($is_user_switching); @@ -377,6 +400,11 @@ sub switch { text => N("Enable user switching for audio applications"), type => 'bool', val => \$is_user_switching, }, + { + text => N("Use Glitch-Free mode"), + type => 'bool', val => \$is_pulseaudio_glitchfree_enabled, + disabled => sub { !$is_pulseaudio_enabled }, + }, { advanced => 1, val => N("Reset sound mixer to default values"), -- cgit v1.2.1