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 instrum.h 21 22 */ 23 24 #ifdef USE_TIMIDITY_MIDI 25 26 #ifndef TIMIDITY_INSTNUM_H_INCLUDED 27 #define TIMIDITY_INSTNUM_H_INCLUDED 28 29 #include "timidity.h" 30 31 #ifdef NS_TIMIDITY 32 namespace NS_TIMIDITY { 33 #endif 34 35 struct Sample { 36 sint32 37 loop_start, loop_end, data_length, 38 sample_rate, low_freq, high_freq, root_freq; 39 sint32 40 envelope_rate[6], envelope_offset[6]; 41 float 42 volume; 43 sample_t *data; 44 sint32 45 tremolo_sweep_increment, tremolo_phase_increment, 46 vibrato_sweep_increment, vibrato_control_ratio; 47 uint8 48 tremolo_depth, vibrato_depth, 49 modes; 50 sint8 51 panning, note_to_use; 52 }; 53 54 /* Bits in modes: */ 55 #define MODES_16BIT (1<<0) 56 #define MODES_UNSIGNED (1<<1) 57 #define MODES_LOOPING (1<<2) 58 #define MODES_PINGPONG (1<<3) 59 #define MODES_REVERSE (1<<4) 60 #define MODES_SUSTAIN (1<<5) 61 #define MODES_ENVELOPE (1<<6) 62 63 struct Instrument { 64 int samples; 65 Sample *sample; 66 }; 67 68 struct ToneBankElement { 69 char *name; 70 Instrument *instrument; 71 int note, amp, pan, strip_loop, strip_envelope, strip_tail; 72 }; 73 74 /* A hack to delay instrument loading until after reading the 75 entire MIDI file. */ 76 #define MAGIC_LOAD_INSTRUMENT (reinterpret_cast<Instrument *>(-1)) 77 78 struct ToneBank { 79 ToneBankElement tone[128]; 80 }; 81 82 extern ToneBank *tonebank[], *drumset[]; 83 84 extern Instrument *default_instrument; 85 extern int default_program; 86 extern int antialiasing_allowed; 87 extern int fast_decay; 88 extern int free_instruments_afterwards; 89 90 #define SPECIAL_PROGRAM -1 91 92 extern int load_missing_instruments(); 93 extern void free_instruments(); 94 extern int set_default_instrument(char *name); 95 96 #ifdef NS_TIMIDITY 97 } 98 #endif 99 100 #endif 101 102 #endif //USE_TIMIDITY_MIDI 103