Update of /cvsroot/audacity/audacity-src/scripts
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv1544/scripts

Modified Files:
        pipe-test.pl 
Log Message:
Modifying the way command responses are delimited. Now a blank line is sent at
the end of each set of response lines. This makes things simpler for
script-writers. Also fixes compiler warnings. The new code should also work for
lines longer than the buffer size - I think the previous method didn't handle
this.



Index: pipe-test.pl
===================================================================
RCS file: /cvsroot/audacity/audacity-src/scripts/pipe-test.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pipe-test.pl        7 Jun 2009 15:32:22 -0000       1.3
+++ pipe-test.pl        28 Jun 2009 12:28:18 -0000      1.4
@@ -32,7 +32,8 @@
 sub finish{
    close TO_SRV;
    close FROM_SRV;
-   print "Done\n";
+   print "Done: press return to end.";
+   <>
 }
 
 sub doCommand{
@@ -45,35 +46,12 @@
    }
    print "Sent: $command\n";
 
-#   while(my $ttt = <FROM_SRV>) {
-#      $ttt = chomp($ttt)
-#      print "Recd:$ttt\n";
-#      last if ($ttt =~ /^$/);
-#   }
-
-   my $ttt = <FROM_SRV>;
-   chomp($ttt);
-#   if( $ttt =~ /^Lines:(\d+)$/ )
-   if( $ttt =~ /Lines:(\d+)/ )
-   {
-#      This block of code deals with multi-line responses.
-#      When there is more than one line of repsonse,
-#      Audacity starts out by stating how many lines there
-#      will be.
-      $nLines = $1;
-      print "Number of lines is $nLines\n";
-      print "Recd: $ttt\n";
-      for($i=0;$i<$nLines;$i++)
-      {
-         $ttt = <FROM_SRV>;
-         chomp($ttt);
-         print "Recd: $i:$ttt\n";
-      }
-   }
-   else
-   {
-      print "Recd: $ttt\n";
+   while(my $ttt = <FROM_SRV>) {
+      chomp($ttt);
+      last if ($ttt eq '');
+      print "Recd:'$ttt'\n";
    }
+
    return $ttt;
 }
 
@@ -81,16 +59,16 @@
 # supported by the Batch system, and with the same syntax.
 # (Delay between sends so it's clearer what's going on)
 startUp();
-sleep(1);
+sleep(1.0);
 doCommand( 'Amplify: Ratio=0.1' );
-sleep(0.2);
+sleep(1.0);
 doCommand( 'Echo: Delay=1.0 Decay=0.5' );
-sleep(0.2);
+sleep(1.0);
 doCommand( 'Amplify: Ratio=2.0' );
-sleep(0.2);
+sleep(1.0);
 doCommand( 'Echo: Delay=1.0 Decay=0.5' );
-sleep(0.2);
+sleep(1.0);
 doCommand( 'ExportMp3' );
-sleep(0.2);
+sleep(1.0);
 doCommand( '<Not a valid command>');
 finish();


------------------------------------------------------------------------------
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to