00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef USE_TIMIDITY_MIDI
00025
00026 #ifndef TIMIDITY_PLAYMIDI_H_INCLUDED
00027 #define TIMIDITY_PLAYMIDI_H_INCLUDED
00028
00029 #include "timidity.h"
00030
00031 #ifdef NS_TIMIDITY
00032 namespace NS_TIMIDITY {
00033 #endif
00034
00035 struct MidiEvent {
00036 sint32 time;
00037 uint8 channel, type, a, b;
00038 };
00039
00040
00041 #define ME_NONE 0
00042 #define ME_NOTEON 1
00043 #define ME_NOTEOFF 2
00044 #define ME_KEYPRESSURE 3
00045 #define ME_MAINVOLUME 4
00046 #define ME_PAN 5
00047 #define ME_SUSTAIN 6
00048 #define ME_EXPRESSION 7
00049 #define ME_PITCHWHEEL 8
00050 #define ME_PROGRAM 9
00051 #define ME_TEMPO 10
00052 #define ME_PITCH_SENS 11
00053
00054 #define ME_ALL_SOUNDS_OFF 12
00055 #define ME_RESET_CONTROLLERS 13
00056 #define ME_ALL_NOTES_OFF 14
00057 #define ME_TONE_BANK 15
00058
00059 #define ME_LYRIC 16
00060
00061 #define ME_EOT 99
00062
00063 struct Channel {
00064 int
00065 bank, program, volume, sustain, panning, pitchbend, expression,
00066 mono,
00067 pitchsens;
00068
00069
00070 float
00071 pitchfactor;
00072 };
00073
00074
00075 #define NO_PANNING -1
00076
00077 struct Voice {
00078 uint8
00079 status, channel, note, velocity;
00080 Sample *sample;
00081 sint32
00082 orig_frequency, frequency,
00083 sample_offset, sample_increment,
00084 envelope_volume, envelope_target, envelope_increment,
00085 tremolo_sweep, tremolo_sweep_position,
00086 tremolo_phase, tremolo_phase_increment,
00087 vibrato_sweep, vibrato_sweep_position;
00088
00089 final_volume_t left_mix, right_mix;
00090
00091 float
00092 left_amp, right_amp, tremolo_volume;
00093 sint32
00094 vibrato_sample_increment[VIBRATO_SAMPLE_INCREMENTS];
00095 int
00096 vibrato_phase, vibrato_control_ratio, vibrato_control_counter,
00097 envelope_stage, control_counter, panning, panned;
00098
00099 };
00100
00101
00102 #define VOICE_FREE 0
00103 #define VOICE_ON 1
00104 #define VOICE_SUSTAINED 2
00105 #define VOICE_OFF 3
00106 #define VOICE_DIE 4
00107
00108
00109 #define PANNED_MYSTERY 0
00110 #define PANNED_LEFT 1
00111 #define PANNED_RIGHT 2
00112 #define PANNED_CENTER 3
00113
00114
00115 extern Channel channel[16];
00116 extern Voice voice[MAX_VOICES];
00117
00118 extern sint32 control_ratio, amp_with_poly, amplification;
00119 extern sint32 drumchannels;
00120 extern int adjust_panning_immediately;
00121 extern int voices;
00122
00123 #define ISDRUMCHANNEL(c) ((drumchannels & (1<<(c))))
00124
00125 extern int play_midi(MidiEvent *el, sint32 events, sint32 samples);
00126 extern int play_midi_file(char *fn);
00127 extern void dumb_pass_playing_list(int number_of_files, char *list_of_files[]);
00128
00129 #ifdef NS_TIMIDITY
00130 };
00131 #endif
00132
00133 #endif
00134
00135 #endif //USE_TIMIDITY_MIDI