~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to kmidi/instrum.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
        $Id: instrum.h,v 1.28 2000/12/01 21:59:02 malte Exp $
3
 
 
4
 
    TiMidity -- Experimental MIDI to WAVE converter
5
 
    Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
6
 
 
7
 
    This program is free software; you can redistribute it and/or modify
8
 
    it under the terms of the GNU General Public License as published by
9
 
    the Free Software Foundation; either version 2 of the License, or
10
 
    (at your option) any later version.
11
 
 
12
 
    This program is distributed in the hope that it will be useful,
13
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
    GNU General Public License for more details.
16
 
 
17
 
    You should have received a copy of the GNU General Public License
18
 
    along with this program; if not, write to the Free Software
19
 
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
 
 
21
 
   instrum.h
22
 
 
23
 
   */
24
 
 
25
 
#ifndef INSTRUM_H
26
 
#define INSTRUM_H
27
 
 
28
 
typedef struct {
29
 
  uint32
30
 
    loop_start, loop_end, data_length,
31
 
    sample_rate, low_freq, high_freq, root_freq;
32
 
 
33
 
  uint8
34
 
    root_tune, fine_tune;
35
 
 
36
 
  uint32
37
 
    envelope_rate[7], envelope_offset[7],
38
 
    modulation_rate[7], modulation_offset[7];
39
 
  FLOAT_T
40
 
    volume, resonance,
41
 
    modEnvToFilterFc, modEnvToPitch, modLfoToFilterFc;
42
 
  sample_t *data;
43
 
  int32 
44
 
    tremolo_sweep_increment, tremolo_phase_increment, 
45
 
    lfo_sweep_increment, lfo_phase_increment, 
46
 
    vibrato_sweep_increment;
47
 
  uint32
48
 
    vibrato_control_ratio,
49
 
    cutoff_freq;
50
 
  uint8
51
 
    reverberation, chorusdepth,
52
 
    tremolo_depth, vibrato_depth,
53
 
    modes;
54
 
  uint8
55
 
    panning, note_to_use, exclusiveClass;
56
 
  int16
57
 
    scale_tuning, keyToModEnvHold, keyToModEnvDecay,
58
 
    keyToVolEnvHold, keyToVolEnvDecay;
59
 
  uint8
60
 
    attenuation, freq_center;
61
 
  int32
62
 
    freq_scale, vibrato_delay;
63
 
} Sample;
64
 
 
65
 
/* Bits in modes: */
66
 
#define MODES_16BIT     (1<<0)
67
 
#define MODES_UNSIGNED  (1<<1)
68
 
#define MODES_LOOPING   (1<<2)
69
 
#define MODES_PINGPONG  (1<<3)
70
 
#define MODES_REVERSE   (1<<4)
71
 
#define MODES_SUSTAIN   (1<<5)
72
 
#define MODES_ENVELOPE  (1<<6)
73
 
#define MODES_FAST_RELEASE      (1<<7)
74
 
 
75
 
#define INST_GUS        0
76
 
#define INST_SF2        1
77
 
 
78
 
typedef struct {
79
 
  int type;
80
 
  int samples;
81
 
  Sample *sample;
82
 
  int left_samples;
83
 
  Sample *left_sample;
84
 
  int right_samples;
85
 
  Sample *right_sample;
86
 
  unsigned char *contents;
87
 
} Instrument;
88
 
 
89
 
typedef struct _InstrumentLayer {
90
 
  uint8 lo, hi;
91
 
  int size;
92
 
  Instrument *instrument;
93
 
  struct _InstrumentLayer *next;
94
 
} InstrumentLayer;
95
 
 
96
 
#define FONT_NORMAL 0
97
 
#define FONT_FFF    1
98
 
#define FONT_SBK    2
99
 
 
100
 
typedef struct {
101
 
  const char *name;
102
 
  InstrumentLayer *layer;
103
 
  int font_type, sf_ix, last_used, tuning;
104
 
#ifndef ADAGIO
105
 
  int note, amp, pan, strip_loop, strip_envelope, strip_tail;
106
 
#else /* ADAGIO */
107
 
  int note, amp, pan, strip_loop, strip_envelope, strip_tail,
108
 
         gm_num, tpgm, reverb, main_volume;
109
 
#endif /* ADAGIO */
110
 
} ToneBankElement;
111
 
 
112
 
/* A hack to delay instrument loading until after reading the
113
 
   entire MIDI file. */
114
 
#define MAGIC_LOAD_INSTRUMENT ((InstrumentLayer *)(-1))
115
 
#define MAXPROG 128
116
 
#define MAXBANK 130
117
 
#define SFXBANK (MAXBANK-1)
118
 
#define SFXDRUM1 (MAXBANK-2)
119
 
#define SFXDRUM2 (MAXBANK-1)
120
 
 
121
 
typedef struct {
122
 
  const char *name;
123
 
#ifndef ADAGIO
124
 
  ToneBankElement tone[MAXPROG];
125
 
#else /* ADAGIO */
126
 
  ToneBankElement tone[MAX_TONE_VOICES];
127
 
#endif /* ADAGIO */
128
 
} ToneBank;
129
 
 
130
 
extern char *sf_file;
131
 
#ifndef ADAGIO
132
 
extern ToneBank *tonebank[], *drumset[];
133
 
#else /* ADAGIO */
134
 
extern ToneBank *tonebank[];
135
 
#endif /* ADAGIO */
136
 
 
137
 
extern InstrumentLayer *default_instrument;
138
 
extern int default_program;
139
 
extern int antialiasing_allowed;
140
 
extern int fast_decay;
141
 
extern int free_instruments_afterwards;
142
 
extern int cutoff_allowed;
143
 
 
144
 
#define SPECIAL_PROGRAM -1
145
 
 
146
 
extern int load_missing_instruments(void);
147
 
extern void free_instruments(void);
148
 
extern void end_soundfont(void);
149
 
extern int set_default_instrument(char *name);
150
 
 
151
 
extern int32 convert_tremolo_sweep(uint8 sweep);
152
 
extern int32 convert_vibrato_sweep(uint8 sweep, int32 vib_control_ratio);
153
 
extern int32 convert_tremolo_rate(uint8 rate);
154
 
extern int32 convert_vibrato_rate(uint8 rate);
155
 
 
156
 
extern void init_soundfont(char *fname, int oldbank, int newbank, int level);
157
 
#ifdef FFF_HAS_BEEN_FIXED
158
 
extern InstrumentLayer *load_fff_patch(const char *name, int gm_num, int bank, int percussion,
159
 
 int panning, int amp, int note_to_use, int strip_loop, int strip_envelope, int strip_tail);
160
 
#endif
161
 
extern InstrumentLayer *load_sbk_patch(const char *name, int gm_num, int bank, int percussion,
162
 
 int panning, int amp, int note_to_use, int sf_ix);
163
 
extern int current_tune_number;
164
 
extern int max_patch_memory;
165
 
extern int current_patch_memory;
166
 
 
167
 
#endif
168