seq_midi_event.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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@suse.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 "asequencer.h"
  24. #define MAX_MIDI_EVENT_BUF 256
  25. typedef struct snd_midi_event_t snd_midi_event_t;
  26. /* midi status */
  27. struct snd_midi_event_t {
  28. int qlen; /* queue length */
  29. int read; /* chars read */
  30. int type; /* current event type */
  31. unsigned char lastcmd; /* last command (for MIDI state handling) */
  32. unsigned char nostat; /* no state flag */
  33. int bufsize; /* allocated buffer size */
  34. unsigned char *buf; /* input buffer */
  35. spinlock_t lock;
  36. };
  37. int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev);
  38. int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize);
  39. void snd_midi_event_free(snd_midi_event_t *dev);
  40. void snd_midi_event_init(snd_midi_event_t *dev);
  41. void snd_midi_event_reset_encode(snd_midi_event_t *dev);
  42. void snd_midi_event_reset_decode(snd_midi_event_t *dev);
  43. void snd_midi_event_no_status(snd_midi_event_t *dev, int on);
  44. /* encode from byte stream - return number of written bytes if success */
  45. long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev);
  46. int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev);
  47. /* decode from event to bytes - return number of written bytes if success */
  48. long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev);
  49. #endif /* __SOUND_SEQ_MIDI_EVENT_H */