Skip to content

Latest commit

 

History

History
175 lines (146 loc) · 4.61 KB

playmidi.h

File metadata and controls

175 lines (146 loc) · 4.61 KB
 
Oct 21, 1999
Oct 21, 1999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
TiMidity -- Experimental MIDI to WAVE converter
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
playmidi.h
*/
typedef struct {
int32 time;
uint8 channel, type, a, b;
} MidiEvent;
/* Midi events */
#define ME_NONE 0
#define ME_NOTEON 1
#define ME_NOTEOFF 2
#define ME_KEYPRESSURE 3
#define ME_MAINVOLUME 4
#define ME_PAN 5
#define ME_SUSTAIN 6
#define ME_EXPRESSION 7
#define ME_PITCHWHEEL 8
#define ME_PROGRAM 9
#define ME_TEMPO 10
#define ME_PITCH_SENS 11
#define ME_ALL_SOUNDS_OFF 12
#define ME_RESET_CONTROLLERS 13
#define ME_ALL_NOTES_OFF 14
#define ME_TONE_BANK 15
#define ME_LYRIC 16
Aug 21, 2004
Aug 21, 2004
49
50
51
52
53
54
55
56
57
58
59
#define ME_TONE_KIT 17
#define ME_MASTERVOLUME 18
#define ME_CHANNEL_PRESSURE 19
#define ME_HARMONICCONTENT 71
#define ME_RELEASETIME 72
#define ME_ATTACKTIME 73
#define ME_BRIGHTNESS 74
#define ME_REVERBERATION 91
#define ME_CHORUSDEPTH 93
Oct 21, 1999
Oct 21, 1999
60
61
62
#define ME_EOT 99
Aug 21, 2004
Aug 21, 2004
63
64
65
#define SFX_BANKTYPE 64
Oct 21, 1999
Oct 21, 1999
66
67
68
69
typedef struct {
int
bank, program, volume, sustain, panning, pitchbend, expression,
mono, /* one note only on this channel -- not implemented yet */
Aug 21, 2004
Aug 21, 2004
70
71
72
73
/* new stuff */
variationbank, reverberation, chorusdepth, harmoniccontent,
releasetime, attacktime, brightness, kit, sfx,
/* end new */
Oct 21, 1999
Oct 21, 1999
74
pitchsens;
Aug 21, 2004
Aug 21, 2004
75
FLOAT_T
Oct 21, 1999
Oct 21, 1999
76
pitchfactor; /* precomputed pitch bend factor to save some fdiv's */
Aug 21, 2004
Aug 21, 2004
77
78
char transpose;
char *name;
Oct 21, 1999
Oct 21, 1999
79
80
81
82
} Channel;
/* Causes the instrument's default panning to be used. */
#define NO_PANNING -1
Aug 21, 2004
Aug 21, 2004
83
84
/* envelope points */
#define MAXPOINT 7
Oct 21, 1999
Oct 21, 1999
85
86
87
typedef struct {
uint8
Aug 21, 2004
Aug 21, 2004
88
status, channel, note, velocity, clone_type;
Oct 21, 1999
Oct 21, 1999
89
Sample *sample;
Aug 21, 2004
Aug 21, 2004
90
91
92
Sample *left_sample;
Sample *right_sample;
int32 clone_voice;
Oct 21, 1999
Oct 21, 1999
93
94
int32
orig_frequency, frequency,
Aug 21, 2004
Aug 21, 2004
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
sample_offset, loop_start, loop_end;
int32
envelope_volume, modulation_volume;
int32
envelope_target, modulation_target;
int32
tremolo_sweep, tremolo_sweep_position, tremolo_phase,
lfo_sweep, lfo_sweep_position, lfo_phase,
vibrato_sweep, vibrato_sweep_position, vibrato_depth, vibrato_delay,
starttime, echo_delay_count;
int32
echo_delay,
sample_increment,
envelope_increment,
modulation_increment,
tremolo_phase_increment,
lfo_phase_increment;
Oct 21, 1999
Oct 21, 1999
112
Aug 21, 2004
Aug 21, 2004
113
final_volume_t left_mix, right_mix, lr_mix, rr_mix, ce_mix, lfe_mix;
Oct 21, 1999
Oct 21, 1999
114
Aug 21, 2004
Aug 21, 2004
115
116
117
FLOAT_T
left_amp, right_amp, lr_amp, rr_amp, ce_amp, lfe_amp,
volume, tremolo_volume, lfo_volume;
Oct 21, 1999
Oct 21, 1999
118
119
int32
vibrato_sample_increment[VIBRATO_SAMPLE_INCREMENTS];
Aug 21, 2004
Aug 21, 2004
120
121
122
int32
envelope_rate[MAXPOINT], envelope_offset[MAXPOINT];
int32
Oct 21, 1999
Oct 21, 1999
123
vibrato_phase, vibrato_control_ratio, vibrato_control_counter,
Aug 21, 2004
Aug 21, 2004
124
125
envelope_stage, modulation_stage, control_counter,
modulation_delay, modulation_counter, panning, panned;
Oct 21, 1999
Oct 21, 1999
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
} Voice;
/* Voice status options: */
#define VOICE_FREE 0
#define VOICE_ON 1
#define VOICE_SUSTAINED 2
#define VOICE_OFF 3
#define VOICE_DIE 4
/* Voice panned options: */
#define PANNED_MYSTERY 0
#define PANNED_LEFT 1
#define PANNED_RIGHT 2
#define PANNED_CENTER 3
/* Anything but PANNED_MYSTERY only uses the left volume */
Aug 21, 2004
Aug 21, 2004
142
143
144
145
146
147
148
149
150
/* Envelope stages: */
#define ATTACK 0
#define HOLD 1
#define DECAY 2
#define RELEASE 3
#define RELEASEB 4
#define RELEASEC 5
#define DELAY 6
Oct 21, 1999
Oct 21, 1999
151
152
extern Channel channel[16];
extern Voice voice[MAX_VOICES];
Aug 21, 2004
Aug 21, 2004
153
154
155
156
extern signed char drumvolume[MAXCHAN][MAXNOTE];
extern signed char drumpanpot[MAXCHAN][MAXNOTE];
extern signed char drumreverberation[MAXCHAN][MAXNOTE];
extern signed char drumchorusdepth[MAXCHAN][MAXNOTE];
Oct 21, 1999
Oct 21, 1999
157
158
159
160
161
162
163
164
extern int32 control_ratio, amp_with_poly, amplification;
extern int32 drumchannels;
extern int adjust_panning_immediately;
extern int voices;
#define ISDRUMCHANNEL(c) ((drumchannels & (1<<(c))))
Aug 21, 2004
Aug 21, 2004
165
166
167
168
169
170
171
172
extern int GM_System_On;
extern int XG_System_On;
extern int GS_System_On;
extern int XG_System_reverb_type;
extern int XG_System_chorus_type;
extern int XG_System_variation_type;
Oct 21, 1999
Oct 21, 1999
173
extern int play_midi(MidiEvent *el, int32 events, int32 samples);
Oct 10, 2009
Oct 10, 2009
174
extern int play_midi_file(const char *fn);
Oct 21, 1999
Oct 21, 1999
175
extern void dumb_pass_playing_list(int number_of_files, char *list_of_files[]);