native_midi_gpl/playmidi.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 13 Feb 2002 19:07:39 +0000
changeset 160 c62666b42573
permissions -rw-r--r--
Peter Kutak - Wed Feb 13 10:26:57 PST 2002
* Added native midi support on Linux, using GPL code
--enable-music-native-midi-gpl
slouken@160
     1
#define RELEASE "Playmidi 2.4"
slouken@160
     2
/************************************************************************
slouken@160
     3
   playmidi.h  --  defines and structures for use by playmidi package
slouken@160
     4
slouken@160
     5
   Copyright (C) 1994-1996 Nathan I. Laredo
slouken@160
     6
slouken@160
     7
   This program is modifiable/redistributable under the terms
slouken@160
     8
   of the GNU General Public Licence.
slouken@160
     9
slouken@160
    10
   You should have received a copy of the GNU General Public License
slouken@160
    11
   along with this program; if not, write to the Free Software
slouken@160
    12
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
slouken@160
    13
   Send your comments and all your spare pocket change to
slouken@160
    14
   laredo@gnu.ai.mit.edu (Nathan Laredo) or to PSC 1, BOX 709, 2401
slouken@160
    15
   Kelly Drive, Lackland AFB, TX 78236-5128, USA.
slouken@160
    16
 *************************************************************************
slouken@160
    17
/*    edited by Peter Kutak          */
slouken@160
    18
/*    email : kutak@stonline.sk      */
slouken@160
    19
slouken@160
    20
slouken@160
    21
/* Default mask for percussion instruments.  Channels 16 and 10 = 0x8200 */
slouken@160
    22
#define PERCUSSION	0x0200
slouken@160
    23
/* change the following if you have lots of synth devices */
slouken@160
    24
#define MAX_CARDS	5
slouken@160
    25
/* the following definition is set by Configure */
slouken@160
    26
#define FM_DEFAULT_MODE	0
slouken@160
    27
/* the following definition is set by Configure */
slouken@160
    28
#define PATCH_PATH1	"/dos/ultrasnd/midi"
slouken@160
    29
/* the following definition is set by Configure */
slouken@160
    30
#define PATCH_PATH2	"/usr/local/lib/Plib"
slouken@160
    31
/* change this if you notice performance problems,  128 bytes by default */
slouken@160
    32
#define SEQUENCERBLOCKSIZE 128
slouken@160
    33
/* change this if you have really outrageous midi files > 128 tracks */
slouken@160
    34
/* 128 tracks is approximately a 4K structure */
slouken@160
    35
#define MAXTRKS		128
slouken@160
    36
/* where to find fm patch libraries */
slouken@160
    37
#define SEQUENCER_DEV	"/dev/sequencer"
slouken@160
    38
#define O3MELODIC	"/etc/std.o3"
slouken@160
    39
#define O3DRUMS		"/etc/drums.o3"
slouken@160
    40
#define SBMELODIC	"/etc/std.sb"
slouken@160
    41
#define SBDRUMS		"/etc/drums.sb"
slouken@160
    42
#define ISPERC(x)	(perc & (1 << x))
slouken@160
    43
#define ISGUS(x)	(play_gus & (1 << x))
slouken@160
    44
#define ISFM(x)		(play_fm & (1 << x))
slouken@160
    45
#define ISMIDI(x)	(play_ext & (1 << x))
slouken@160
    46
#define ISAWE(x)	(play_awe & (1 << x))
slouken@160
    47
#define ISPLAYING(x)	(chanmask & (1 << x))
slouken@160
    48
#define NO_EXIT		100
slouken@160
    49
slouken@160
    50
#include <stdio.h>
slouken@160
    51
#include <string.h>
slouken@160
    52
#include <stdlib.h>
slouken@160
    53
#include <sys/soundcard.h>
slouken@160
    54
#include <sys/ioctl.h>
slouken@160
    55
#ifdef linux
slouken@160
    56
#include <linux/awe_voice.h>
slouken@160
    57
#else
slouken@160
    58
#include <awe_voice.h>
slouken@160
    59
#endif
slouken@160
    60
slouken@160
    61
struct chanstate {
slouken@160
    62
    int program;
slouken@160
    63
    int bender;
slouken@160
    64
    int oldbend;	/* used for graphics */
slouken@160
    65
    int bender_range;
slouken@160
    66
    int oldrange;	/* used for graphics */
slouken@160
    67
    int controller[255];
slouken@160
    68
    int pressure;
slouken@160
    69
};
slouken@160
    70
slouken@160
    71
struct voicestate {
slouken@160
    72
    int note;
slouken@160
    73
    int channel;
slouken@160
    74
    int timestamp;
slouken@160
    75
    int dead;
slouken@160
    76
};
slouken@160
    77
/* Non-standard MIDI file formats */
slouken@160
    78
#define RIFF			0x52494646
slouken@160
    79
#define CTMF			0x43544d46
slouken@160
    80
/* Standard MIDI file format definitions */
slouken@160
    81
#define MThd			0x4d546864
slouken@160
    82
#define MTrk			0x4d54726b
slouken@160
    83
#define	meta_event		0xff
slouken@160
    84
#define	sequence_number 	0x00
slouken@160
    85
#define	text_event		0x01
slouken@160
    86
#define copyright_notice 	0x02
slouken@160
    87
#define sequence_name    	0x03
slouken@160
    88
#define instrument_name 	0x04
slouken@160
    89
#define lyric	        	0x05
slouken@160
    90
#define marker			0x06
slouken@160
    91
#define	cue_point		0x07
slouken@160
    92
#define channel_prefix		0x20
slouken@160
    93
#define	end_of_track		0x2f
slouken@160
    94
#define	set_tempo		0x51
slouken@160
    95
#define	smpte_offset		0x54
slouken@160
    96
#define	time_signature		0x58
slouken@160
    97
#define	key_signature		0x59
slouken@160
    98
#define	sequencer_specific	0x74
slouken@160
    99
slouken@160
   100
struct miditrack {
slouken@160
   101
   unsigned char *data;		/* data of midi track */
slouken@160
   102
   unsigned long int length;	/* length of track data */
slouken@160
   103
   unsigned long int index;	/* current byte in track */
slouken@160
   104
   unsigned long int ticks;	/* current midi tick count */
slouken@160
   105
   unsigned char running_st;	/* running status byte */
slouken@160
   106
};
slouken@160
   107