instrum.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. instrum.h
  16. */
  17. typedef struct {
  18. int32_t
  19. loop_start, loop_end, data_length,
  20. sample_rate, low_freq, high_freq, root_freq;
  21. int32_t
  22. envelope_rate[6], envelope_offset[6];
  23. float
  24. volume;
  25. sample_t *data;
  26. int32_t
  27. tremolo_sweep_increment, tremolo_phase_increment,
  28. vibrato_sweep_increment, vibrato_control_ratio;
  29. uint8_t
  30. tremolo_depth, vibrato_depth,
  31. modes;
  32. int8_t
  33. panning, note_to_use;
  34. } Sample;
  35. /* Bits in modes: */
  36. #define MODES_16BIT (1<<0)
  37. #define MODES_UNSIGNED (1<<1)
  38. #define MODES_LOOPING (1<<2)
  39. #define MODES_PINGPONG (1<<3)
  40. #define MODES_REVERSE (1<<4)
  41. #define MODES_SUSTAIN (1<<5)
  42. #define MODES_ENVELOPE (1<<6)
  43. typedef struct {
  44. int samples;
  45. Sample *sample;
  46. } Instrument;
  47. typedef struct {
  48. char *name;
  49. Instrument *instrument;
  50. int note, amp, pan, strip_loop, strip_envelope, strip_tail;
  51. } ToneBankElement;
  52. /* A hack to delay instrument loading until after reading the
  53. entire MIDI file. */
  54. #define MAGIC_LOAD_INSTRUMENT ((Instrument *)(-1))
  55. typedef struct {
  56. ToneBankElement tone[128];
  57. } ToneBank;
  58. extern ToneBank *tonebank[], *drumset[];
  59. extern Instrument *default_instrument;
  60. extern int default_program;
  61. extern int antialiasing_allowed;
  62. extern int fast_decay;
  63. extern int free_instruments_afterwards;
  64. #define SPECIAL_PROGRAM -1
  65. extern int load_missing_instruments(void);
  66. extern void free_instruments(void);
  67. extern int set_default_instrument(char *name);