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