1.3 proposals (was: Re: [SDL] LoadLibrary analogous function?)

David Olofson david.olofson at reologica.se
Thu Aug 30 06:50:01 PDT 2001

On Thursday 30 August 2001 09:25, winterlion wrote:
> > > (well not full MIDI - I just want to be able to get SDL events from
> > > my MIDI keyboard :)
> >
> > This might be nice as well.
> So whoever commented on this before - WHERE IS IT???

MIDI? Well, I'm into audio, so I usually comment on that sort of stuff. 

We discussed some MIDI related project of yours, but I can't remember any 
detailed MIDI API design discussions, nor any official statements on SDL 
1.2 or 1.3 and MIDI.

I remember some idea about receiving MIDI messages as SDL events, 
though... (And adding timestamps to SDL the events for better accuracy.)

Normal messages are usually 1..4 bytes, so they could easilly be passed 
around inside SDL events;

	typedef struct
		Uint8 type;
		Uint8 size;
		Uint8 data[4];
	} SDL_MIDIEvent;

No parameters to set for a basic MIDI interface, so "open input/output" 
flags should do;

	int SDL_OpenMIDI(int open_input, int open_output);
	void SDL_CloseMIDI(void);	/* Actually "SDL_OpenMIDI(0,0);" */

Sending MIDI messages of any size is trivial;

	int SDL_SendMIDI(Uint8 *data, int size);

The messy part would be receiving "long messages" (SysEx...). One 
could use an internal circular buffer (which skips to avoid wrapping) to 
store the data blocks, and pass direct buffer pointers inside the 
"SDL_LongMIDIEvent" events.

A special "SDL_FreeMIDIBuffer(SDL_MIDIEvent *midievent)" call would be 
required, or the MIDI code would require some hack to make sure you've 
removed the event *after* the long MIDI event from the SDL event queue 
before freeing buffer space. *heh*

//David Olofson --- Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david at linuxdj.com -'

More information about the SDL mailing list