From 1ae1ef53e1bc6383b599782616b656a25094a7e6 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Sat, 7 Dec 2013 00:38:44 +0100 Subject: [PATCH] Sound: muted by default --- SCX/Sound.pm | 6 ++++++ slotcarman | 1 + 2 files changed, 7 insertions(+) diff --git a/SCX/Sound.pm b/SCX/Sound.pm index 5c501c3..9a7180a 100644 --- a/SCX/Sound.pm +++ b/SCX/Sound.pm @@ -9,6 +9,7 @@ sub new { my $self = { data_dir => $args->{data_dir} || './sounds/', + muted => 1, }; bless $self, $class; @@ -19,10 +20,15 @@ sub new { sub _play { my ($self, @names) = @_; + return if $self->{muted}; + @names = map { $self->{data_dir} . '/' . $_ . '.wav' } @names; system (join(' ', 'aplay', @names). ' &'); } +sub mute { shift->{muted} = 1; } +sub unmute { shift->{muted} = 0; } + sub start { shift->_play('start'); } sub filled { shift->_play('filled'); } diff --git a/slotcarman b/slotcarman index 8aa6cbe..939ada8 100755 --- a/slotcarman +++ b/slotcarman @@ -76,6 +76,7 @@ $track->car(2)->set_driver('Xsara'); if ($tty_reader) { Glib::IO->add_watch(fileno($tty_reader->fh), 'in', \&scx_read, $tty_reader); + $track->{sound}->unmute(); } elsif ($log_reader) { Glib::Idle->add(\&log_read_start, [ $log_reader, $parser, $opt{f} ]); } else { -- 2.43.0