Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

native_midi.h

Go to the documentation of this file.
00001 /*
00002     native_midi:  Hardware Midi support for the SDL_mixer library
00003     Copyright (C) 2000  Florian 'Proff' Schulze
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019     Florian 'Proff' Schulze
00020     florian.proff.schulze@gmx.net
00021 
00022     $Id: native_midi.h,v 1.2 2002/01/08 20:47:05 tksuoran Exp $
00023 */
00024 
00025 
00026 #ifndef _NATIVE_MIDI_H_
00027 #define _NATIVE_MIDI_H_
00028 
00029 
00030 #if defined(_MSC_VER)
00031 #define WIN32_LEAN_AND_MEAN
00032 #include <windows.h>
00033 #include <windowsx.h>
00034 #include <mmsystem.h>
00035 
00036 #pragma comment (lib, "winmm.lib")     /* link with Windows MultiMedia lib */
00037 
00038 #define MIDI_TRACKS 32
00039 
00040 typedef unsigned char byte;
00041 typedef struct MIDI                    /* a midi file */
00042 {
00043    int divisions;                      /* number of ticks per quarter note */
00044    struct {
00045       unsigned char *data;             /* MIDI message stream */
00046       int len;                         /* length of the track data */
00047    } track[MIDI_TRACKS];
00048    int loaded;
00049 } MIDI;
00050 
00051 struct _NativeMidiSong {
00052   MIDI mididata;
00053   int MusicLoaded;
00054   int MusicPlaying;
00055   MIDIEVENT *MidiEvents[MIDI_TRACKS];
00056   MIDIHDR MidiStreamHdr;
00057   MIDIEVENT *NewEvents;
00058   int NewSize;
00059   int NewPos;
00060   int BytesRecorded[MIDI_TRACKS];
00061   int BufferSize[MIDI_TRACKS];
00062   int CurrentTrack;
00063   int CurrentPos;
00064 };
00065 #endif
00066 
00067 typedef struct _NativeMidiSong NativeMidiSong;
00068 
00069 int             native_midi_init     ();
00070 NativeMidiSong *native_midi_loadsong ( char *midifile );
00071 void            native_midi_freesong ( NativeMidiSong *song );
00072 void            native_midi_start    ( NativeMidiSong *song );
00073 void            native_midi_stop     ();
00074 int             native_midi_active   ();
00075 void            native_midi_setvolume( int volume);
00076 char           *native_midi_error    ();
00077 
00078 #endif /* _NATIVE_MIDI_H_ */