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.

senders.c 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * some functions for sending various data over the wire
  3. */
  4. #include <stdio.h>
  5. #include <lo/lo.h>
  6. #include "senders.h"
  7. extern int verbosity; /* not so ugly hack */
  8. /* ----------------------------------------------------------------- */
  9. int send_data_xy(lo_address dst, int x, int y)
  10. {
  11. int foo;
  12. if (verbosity) fprintf(stderr, "sending x y %7d %7d\n", x, y);
  13. foo = lo_send(dst, "/joystick/xy", "ii", x, y);
  14. if (verbosity > 2) {
  15. fprintf(stderr, "lo_send -> %d\n", foo);
  16. }
  17. return foo;
  18. }
  19. /* ----------------------------------------------------------------- */
  20. int send_data_button(lo_address dst, int n, int v)
  21. {
  22. int foo;
  23. if (verbosity) fprintf(stderr, "sending button %d %d\n", n, v);
  24. foo = lo_send(dst, "/joystick/b", "ii", n, v);
  25. if (verbosity > 2) {
  26. fprintf(stderr, "lo_send -> %d\n", foo);
  27. }
  28. return foo;
  29. }
  30. /* ----------------------------------------------------------------- */
  31. int send_data_id(lo_address dst, char *s)
  32. {
  33. int foo;
  34. if (verbosity) fprintf(stderr, "sending my id '%s'\n", s);
  35. foo = lo_send(dst, "/joystick/id", "s", s);
  36. if (verbosity > 2) {
  37. fprintf(stderr, "lo_send -> %d\n", foo);
  38. }
  39. return foo;
  40. }
  41. /* ----------------------------------------------------------------- */