native_midi_common.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. native_midi: Hardware Midi support for the SDL_mixer library
  3. Copyright (C) 2000,2001 Florian 'Proff' Schulze & Max Horn
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this library; if not, write to the Free
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. Florian 'Proff' Schulze
  16. florian.proff.schulze@gmx.net
  17. Max Horn
  18. max@quendi.de
  19. */
  20. #ifndef _NATIVE_MIDI_COMMON_H_
  21. #define _NATIVE_MIDI_COMMON_H_
  22. #include "SDL.h"
  23. /* Midi Status Bytes */
  24. #define MIDI_STATUS_NOTE_OFF 0x8
  25. #define MIDI_STATUS_NOTE_ON 0x9
  26. #define MIDI_STATUS_AFTERTOUCH 0xA
  27. #define MIDI_STATUS_CONTROLLER 0xB
  28. #define MIDI_STATUS_PROG_CHANGE 0xC
  29. #define MIDI_STATUS_PRESSURE 0xD
  30. #define MIDI_STATUS_PITCH_WHEEL 0xE
  31. #define MIDI_STATUS_SYSEX 0xF
  32. /* We store the midi events in a linked list; this way it is
  33. easy to shuffle the tracks together later on; and we are
  34. flexible in the size of each elemnt.
  35. */
  36. typedef struct MIDIEvent
  37. {
  38. Uint32 time; /* Time at which this midi events occurs */
  39. Uint8 status; /* Status byte */
  40. Uint8 data[2]; /* 1 or 2 bytes additional data for most events */
  41. Uint32 extraLen; /* For some SysEx events, we need additional storage */
  42. Uint8 *extraData;
  43. struct MIDIEvent *next;
  44. } MIDIEvent;
  45. #ifdef __cplusplus
  46. extern "C"
  47. {
  48. #endif
  49. /* Load a midifile to memory, converting it to a list of MIDIEvents.
  50. This function returns a linked lists of MIDIEvents, 0 if an error occured.
  51. */
  52. MIDIEvent *CreateMIDIEventList(SDL_RWops *rw, Uint16 *division);
  53. /* Release a MIDIEvent list after usage. */
  54. void FreeMIDIEventList(MIDIEvent *head);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif /* _NATIVE_MIDI_COMMON_H_ */