PageRenderTime 27ms CodeModel.GetById 13ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/project/jni/sdl_mixer/timidity/playmidi.h

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