annotate pygar-benchmarks/setup/sim-benchmark-setup.pl @ 72:34fc182a1daa pygar svn.73

[svn r73] fixed bad code
author punk
date Wed, 12 May 2010 00:40:01 -0400
parents 0ede0715dbd6
children 8bd0e4d37ad2
rev   line source
rlm@67 1 #!/usr/bin/env perl
rlm@67 2
rlm@67 3
rlm@67 4 use File::Basename;
rlm@67 5 use Getopt::Long;
rlm@67 6 use File::Copy;
rlm@67 7
rlm@67 8 sub Usage();
rlm@67 9
rlm@67 10 my $music = undef;
rlm@67 11 my $network = undef;
rlm@67 12 my $from = undef;
rlm@67 13 my $to = undef;
rlm@67 14 my $command = undef;
rlm@67 15
rlm@67 16
rlm@67 17 #
rlm@67 18 # Parse the command line switches
rlm@67 19 #
rlm@67 20 if (! GetOptions('music=s' => \$music,
rlm@67 21 'network=s' => \$network,
rlm@67 22 )) {
rlm@67 23 Usage();
rlm@67 24 }
rlm@67 25
rlm@67 26 print "\n\n*********************\n\nRLM:\n";
rlm@67 27 print "music is: $music\nnetwork is: $network\n";
rlm@67 28
rlm@67 29
rlm@67 30 my $bmark = $ARGV[0];
rlm@67 31 my $destination = $ARGV[1];
rlm@67 32 my $origin = "$bmark/..";
rlm@67 33
rlm@67 34
rlm@67 35
rlm@67 36 print "Origin: $origin\n";
rlm@67 37 print "Destination: $destination\n";
rlm@67 38
rlm@67 39 print "\nCopying Files:\n";
rlm@67 40
rlm@67 41
rlm@67 42
rlm@67 43 $from = $bmark."/run-sim.bmark";
rlm@67 44 $to = $destination."/run";
rlm@67 45 print "Copying $from to $to\n";
rlm@67 46 copy($from,$to) or die "Copy failed: $!";
rlm@67 47 $command = "chmod 777 $to";
rlm@67 48 `$command`;
rlm@67 49
rlm@67 50
rlm@67 51
rlm@67 52 print "\nGenerating Placeholder Voices:\n";
rlm@67 53
rlm@67 54 for my $num(0..11)
rlm@67 55 {
rlm@67 56 $command = "cp $origin/music/null/null0.wav $destination/input$num.wav\n";
rlm@67 57 print $command;
rlm@67 58 `$command`;
rlm@67 59 }
rlm@67 60
rlm@67 61 print "\nCopying Voices\n";
rlm@67 62 $command = "cp $origin/music/$music/*.wav $destination";
rlm@67 63 print "$command\n";
rlm@67 64
rlm@67 65
rlm@67 66 print "\nGenerating Placeholder Programs:\n";
rlm@67 67 $command = "mkdir $destination/programs\n";
rlm@67 68 print $command;
rlm@67 69 `$command`;
rlm@67 70
rlm@67 71 for my $num(0..11)
rlm@67 72 {
rlm@67 73 $command = "cp $origin/programs/identity.vmh $destination/programs/program$num.vmh\n";
rlm@67 74 print $command;
rlm@67 75 `$command`;
rlm@67 76 }
rlm@67 77
rlm@67 78 print "\nCreating Network:\n\n";
rlm@67 79 print "Open $origin/networks/$network :\n";
rlm@67 80 open (NET, "<$origin/networks/$network") or die $!;
rlm@67 81
rlm@67 82 for (<NET>)
rlm@67 83 {
rlm@67 84 @link = eval($_);
rlm@67 85
rlm@67 86 print "Voice $link[0] will be run through $link[1]\n";
rlm@67 87
rlm@67 88 $command = "cp $origin/programs/$link[1] $destination/programs/program$link[0].vmh\n";
rlm@67 89 print $command;
rlm@67 90 `$command`;
rlm@67 91
rlm@67 92
rlm@67 93 }
rlm@67 94
rlm@67 95
rlm@67 96
rlm@67 97
rlm@67 98 print "\n***********************\n";
rlm@67 99
rlm@67 100