199
|
1 /*
|
|
2 TiMidity -- Experimental MIDI to WAVE converter
|
|
3 Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
|
|
4
|
|
5 This program is free software; you can redistribute it and/or modify
|
|
6 it under the terms of the GNU General Public License as published by
|
|
7 the Free Software Foundation; either version 2 of the License, or
|
|
8 (at your option) any later version.
|
|
9
|
|
10 This program is distributed in the hope that it will be useful,
|
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 GNU General Public License for more details.
|
|
14
|
|
15 You should have received a copy of the GNU General Public License
|
|
16 along with this program; if not, write to the Free Software
|
|
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
18 */
|
|
19
|
|
20 /* When a patch file can't be opened, one of these extensions is
|
|
21 appended to the filename and the open is tried again.
|
|
22 */
|
|
23 #define PATCH_EXT_LIST { ".pat", 0 }
|
|
24
|
|
25 /* Acoustic Grand Piano seems to be the usual default instrument. */
|
|
26 #define DEFAULT_PROGRAM 0
|
|
27
|
|
28 /* 9 here is MIDI channel 10, which is the standard percussion channel.
|
|
29 Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too.
|
|
30 On the other hand, some files know that 16 is not a drum channel and
|
|
31 try to play music on it. This is now a runtime option, so this isn't
|
|
32 a critical choice anymore. */
|
|
33 #define DEFAULT_DRUMCHANNELS ((1<<9) | (1<<15))
|
|
34
|
|
35 /* In percent. */
|
|
36 #define DEFAULT_AMPLIFICATION 70
|
|
37
|
|
38 /* Default polyphony */
|
|
39 #define DEFAULT_VOICES 32
|
|
40
|
|
41 /* 1000 here will give a control ratio of 22:1 with 22 kHz output.
|
|
42 Higher CONTROLS_PER_SECOND values allow more accurate rendering
|
|
43 of envelopes and tremolo. The cost is CPU time. */
|
|
44 #define CONTROLS_PER_SECOND 1000
|
|
45
|
|
46 /* Make envelopes twice as fast. Saves ~20% CPU time (notes decay
|
|
47 faster) and sounds more like a GUS. There is now a command line
|
|
48 option to toggle this as well. */
|
|
49 #define FAST_DECAY
|
|
50
|
|
51 /* How many bits to use for the fractional part of sample positions.
|
|
52 This affects tonal accuracy. The entire position counter must fit
|
|
53 in 32 bits, so with FRACTION_BITS equal to 12, the maximum size of
|
|
54 a sample is 1048576 samples (2 megabytes in memory). The GUS gets
|
|
55 by with just 9 bits and a little help from its friends...
|
|
56 "The GUS does not SUCK!!!" -- a happy user :) */
|
|
57 #define FRACTION_BITS 12
|
|
58
|
|
59 /* For some reason the sample volume is always set to maximum in all
|
|
60 patch files. Define this for a crude adjustment that may help
|
|
61 equalize instrument volumes. */
|
|
62 #define ADJUST_SAMPLE_VOLUMES
|
|
63
|
|
64 /* The number of samples to use for ramping out a dying note. Affects
|
|
65 click removal. */
|
|
66 #define MAX_DIE_TIME 20
|
|
67
|
|
68 /**************************************************************************/
|
|
69 /* Anything below this shouldn't need to be changed unless you're porting
|
|
70 to a new machine with other than 32-bit, big-endian words. */
|
|
71 /**************************************************************************/
|
|
72
|
|
73 /* change FRACTION_BITS above, not these */
|
|
74 #define INTEGER_MASK (0xFFFFFFFF << FRACTION_BITS)
|
|
75 #define FRACTION_MASK (~ INTEGER_MASK)
|
|
76
|
|
77 /* This is enforced by some computations that must fit in an int */
|
|
78 #define MAX_CONTROL_RATIO 255
|
|
79
|
|
80 #define MAX_AMPLIFICATION 800
|
|
81
|
|
82 /* The TiMidity configuration file */
|
|
83 #define CONFIG_FILE "timidity.cfg"
|
|
84
|
|
85 /* These affect general volume */
|
|
86 #define GUARD_BITS 3
|
|
87 #define AMP_BITS (15-GUARD_BITS)
|
|
88
|
|
89 #define MAX_AMP_VALUE ((1<<(AMP_BITS+1))-1)
|
|
90
|
|
91 #define FSCALE(a,b) (float)((a) * (double)(1<<(b)))
|
|
92 #define FSCALENEG(a,b) (float)((a) * (1.0L / (double)(1<<(b))))
|
|
93
|
|
94 /* Vibrato and tremolo Choices of the Day */
|
|
95 #define SWEEP_TUNING 38
|
|
96 #define VIBRATO_AMPLITUDE_TUNING 1.0L
|
|
97 #define VIBRATO_RATE_TUNING 38
|
|
98 #define TREMOLO_AMPLITUDE_TUNING 1.0L
|
|
99 #define TREMOLO_RATE_TUNING 38
|
|
100
|
|
101 #define SWEEP_SHIFT 16
|
|
102 #define RATE_SHIFT 5
|
|
103
|
|
104 #ifndef PI
|
|
105 #define PI 3.14159265358979323846
|
|
106 #endif
|
|
107
|
|
108 /* The path separator (D.M.) */
|
|
109 #ifdef WIN32
|
|
110 # define PATH_SEP '\\'
|
|
111 #else
|
|
112 # define PATH_SEP '/'
|
|
113 #endif
|