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