midi.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Line6 Linux USB driver - 0.9.1beta
  3. *
  4. * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation, version 2.
  9. *
  10. */
  11. #ifndef MIDI_H
  12. #define MIDI_H
  13. #include <sound/rawmidi.h>
  14. #include "midibuf.h"
  15. #define MIDI_BUFFER_SIZE 1024
  16. struct snd_line6_midi {
  17. /**
  18. Pointer back to the Line6 driver data structure.
  19. */
  20. struct usb_line6 *line6;
  21. /**
  22. MIDI substream for receiving (or NULL if not active).
  23. */
  24. struct snd_rawmidi_substream *substream_receive;
  25. /**
  26. MIDI substream for transmitting (or NULL if not active).
  27. */
  28. struct snd_rawmidi_substream *substream_transmit;
  29. /**
  30. Number of currently active MIDI send URBs.
  31. */
  32. int num_active_send_urbs;
  33. /**
  34. Spin lock to protect updates of send_urb.
  35. */
  36. spinlock_t send_urb_lock;
  37. /**
  38. Spin lock to protect MIDI buffer handling.
  39. */
  40. spinlock_t midi_transmit_lock;
  41. /**
  42. Wait queue for MIDI transmission.
  43. */
  44. wait_queue_head_t send_wait;
  45. /**
  46. Buffer for incoming MIDI stream.
  47. */
  48. struct midi_buffer midibuf_in;
  49. /**
  50. Buffer for outgoing MIDI stream.
  51. */
  52. struct midi_buffer midibuf_out;
  53. };
  54. extern int line6_init_midi(struct usb_line6 *line6);
  55. extern void line6_midi_receive(struct usb_line6 *line6, unsigned char *data,
  56. int length);
  57. #endif