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