X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=SCX%2FSound.pm;h=9a7180abb4a107489e1d1855fc95177eb5a0e0b0;hb=1ae1ef53e1bc6383b599782616b656a25094a7e6;hp=5c501c36785c91cbae731c88c65e7fad08e5ede3;hpb=1f216af4258c635bda3ebc3b3b4af65b392aa37d;p=slotcarman.git 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'); }