Logiciels divers autour du protocole « Open Sound Control » aka OSC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1013 B

  1. #!/usr/bin/perl -w
  2. my $port = 9001;
  3. my $target = "localhost";
  4. # ----------------------------------------------------------
  5. use Net::OpenSoundControl::Client;
  6. use Data::Dumper qw(Dumper);
  7. use Getopt::Std;
  8. my $client;
  9. my $verbose = 0;
  10. # ----------------------------------------------------------
  11. #
  12. # MAIN
  13. #
  14. getopts('d:v', \%options);
  15. if (defined $options{"d"}) {
  16. # print Dumper $options{"d"};
  17. ($target, $port) = split /:/, $options{"d"};
  18. }
  19. $verbose = 1 if (defined $options{"v"});
  20. print "trashing ", $target, " on port ", $port, "\n";
  21. $client = Net::OpenSoundControl::Client->new(
  22. Name => "testkontrol",
  23. Host => $target, Port => $port)
  24. or die "Could not start client: $@\n";
  25. print Dumper $client if $verbose;
  26. my ($foo, $knum, $kval);
  27. for ($foo=0; $foo<128; $foo++) {
  28. $kval = int(128*rand());
  29. $knum = int(128*rand());
  30. print "$knum -> $kval\n" if $verbose;
  31. $client->send(['/kontrol/v', 'i', $knum, 'i', $kval]);
  32. sleep(1);
  33. }
  34. # ----------------------------------------------------------