From: Jan "Yenya" Kasprzak Date: Fri, 6 Dec 2013 23:38:44 +0000 (+0100) Subject: Sound: muted by default X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=slotcarman.git;a=commitdiff_plain;h=1ae1ef53e1bc6383b599782616b656a25094a7e6 Sound: muted by default --- 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 {