Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.   native_midi:  Hardware Midi support for the SDL_mixer library
  3.   Copyright (C) 2000,2001  Florian 'Proff' Schulze <florian.proff.schulze@gmx.net>
  4.  
  5.   This software is provided 'as-is', without any express or implied
  6.   warranty.  In no event will the authors be held liable for any damages
  7.   arising from the use of this software.
  8.  
  9.   Permission is granted to anyone to use this software for any purpose,
  10.   including commercial applications, and to alter it and redistribute it
  11.   freely, subject to the following restrictions:
  12.  
  13.   1. The origin of this software must not be misrepresented; you must not
  14.      claim that you wrote the original software. If you use this software
  15.      in a product, an acknowledgment in the product documentation would be
  16.      appreciated but is not required.
  17.   2. Altered source versions must be plainly marked as such, and must not be
  18.      misrepresented as being the original software.
  19.   3. This notice may not be removed or altered from any source distribution.
  20. */
  21.  
  22. #ifndef _NATIVE_MIDI_COMMON_H_
  23. #define _NATIVE_MIDI_COMMON_H_
  24.  
  25. #include "SDL.h"
  26.  
  27. /* Midi Status Bytes */
  28. #define MIDI_STATUS_NOTE_OFF    0x8
  29. #define MIDI_STATUS_NOTE_ON     0x9
  30. #define MIDI_STATUS_AFTERTOUCH  0xA
  31. #define MIDI_STATUS_CONTROLLER  0xB
  32. #define MIDI_STATUS_PROG_CHANGE 0xC
  33. #define MIDI_STATUS_PRESSURE    0xD
  34. #define MIDI_STATUS_PITCH_WHEEL 0xE
  35. #define MIDI_STATUS_SYSEX       0xF
  36.  
  37. /* We store the midi events in a linked list; this way it is
  38.    easy to shuffle the tracks together later on; and we are
  39.    flexible in the size of each elemnt.
  40.  */
  41. typedef struct MIDIEvent
  42. {
  43.         Uint32  time;           /* Time at which this midi events occurs */
  44.         Uint8   status;         /* Status byte */
  45.         Uint8   data[2];        /* 1 or 2 bytes additional data for most events */
  46.  
  47.         Uint32  extraLen;       /* For some SysEx events, we need additional storage */
  48.         Uint8   *extraData;
  49.        
  50.         struct MIDIEvent *next;
  51. } MIDIEvent;
  52.  
  53.  
  54. /* Load a midifile to memory, converting it to a list of MIDIEvents.
  55.    This function returns a linked lists of MIDIEvents, 0 if an error occured.
  56.  */
  57. MIDIEvent *CreateMIDIEventList(SDL_RWops *rw, Uint16 *division);
  58.  
  59. /* Release a MIDIEvent list after usage. */
  60. void FreeMIDIEventList(MIDIEvent *head);
  61.  
  62.  
  63. #endif /* _NATIVE_MIDI_COMMON_H_ */
  64.