added dart sounds
[svn42.git] / dart-sounds / sound.pl
diff --git a/dart-sounds/sound.pl b/dart-sounds/sound.pl
new file mode 100755 (executable)
index 0000000..d0ee71a
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -T -w
+use strict;
+$ENV{PATH}='';
+&main();
+exit 0;
+
+sub play
+{
+  my ($file)=@_;
+       print "$file\n";
+  my $cmd = "/usr/bin/gst-launch-0.10 filesrc location=${file}.ogg ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink";
+       print "$cmd\n";
+  print `$cmd`;
+}
+
+sub main
+{
+  while (my $schuss = <STDIN>)
+  {
+               print $schuss;
+    chomp $schuss;
+               
+    my ($mult,$zahl)=split /\s+/,$schuss;
+               if ($mult==2)
+               {
+                 play("double")
+               } elsif ($mult==3) {
+                 play("triple")
+    }
+               ($zahl) = $zahl =~ m/(\d+)/;
+               if ($zahl >0 && $zahl < 21)
+    {
+                       play($zahl)
+               } else {
+                       play("bull")
+               }
+  } 
+}
+