seq_midi_event.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __SOUND_SEQ_MIDI_EVENT_H
  2. #define __SOUND_SEQ_MIDI_EVENT_H
  3. /*
  4. * MIDI byte <-> sequencer event coder
  5. *
  6. * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>,
  7. * Jaroslav Kysela <perex@perex.cz>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #include <sound/asequencer.h>
  24. #define MAX_MIDI_EVENT_BUF 256
  25. /* midi status */
  26. struct snd_midi_event {
  27. int qlen; /* queue length */
  28. int read; /* chars read */
  29. int type; /* current event type */
  30. unsigned char lastcmd; /* last command (for MIDI state handling) */
  31. unsigned char nostat; /* no state flag */
  32. int bufsize; /* allocated buffer size */
  33. unsigned char *buf; /* input buffer */
  34. spinlock_t lock;
  35. };
  36. int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
  37. void snd_midi_event_free(struct snd_midi_event *dev);
  38. void snd_midi_event_reset_encode(struct snd_midi_event *dev);
  39. void snd_midi_event_reset_decode(struct snd_midi_event *dev);
  40. void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
  41. /* encode from byte stream - return number of written bytes if success */
  42. long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
  43. struct snd_seq_event *ev);
  44. int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
  45. /* decode from event to bytes - return number of written bytes if success */
  46. long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
  47. struct snd_seq_event *ev);
  48. #endif /* __SOUND_SEQ_MIDI_EVENT_H */