]> www.fi.muni.cz Git - slotcarman.git/blobdiff - SCX/Sound.pm
Sound: muted by default
[slotcarman.git] / SCX / Sound.pm
index 5c501c36785c91cbae731c88c65e7fad08e5ede3..9a7180abb4a107489e1d1855fc95177eb5a0e0b0 100644 (file)
@@ -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'); }