Skip to content

Latest commit

 

History

History
225 lines (183 loc) · 7.24 KB

config.h

File metadata and controls

225 lines (183 loc) · 7.24 KB
 
Oct 21, 1999
Oct 21, 1999
1
2
3
4
5
/*
TiMidity -- Experimental MIDI to WAVE converter
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
This program is free software; you can redistribute it and/or modify
Dec 31, 2011
Dec 31, 2011
6
7
it under the terms of the Perl Artistic License, available in COPYING.
*/
Oct 21, 1999
Oct 21, 1999
8
9
10
/* This is for use with the SDL library */
#define SDL
Apr 30, 2006
Apr 30, 2006
11
12
#include "SDL_config.h"
#include "SDL_endian.h"
Oct 21, 1999
Oct 21, 1999
13
Oct 12, 2009
Oct 12, 2009
14
15
#define TIMIDITY_ERROR_SIZE 1024
Oct 21, 1999
Oct 21, 1999
16
17
18
19
20
21
22
23
24
25
26
27
28
/* When a patch file can't be opened, one of these extensions is
appended to the filename and the open is tried again.
*/
#define PATCH_EXT_LIST { ".pat", 0 }
/* Acoustic Grand Piano seems to be the usual default instrument. */
#define DEFAULT_PROGRAM 0
/* 9 here is MIDI channel 10, which is the standard percussion channel.
Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too.
On the other hand, some files know that 16 is not a drum channel and
try to play music on it. This is now a runtime option, so this isn't
a critical choice anymore. */
Dec 31, 2011
Dec 31, 2011
29
#define DEFAULT_DRUMCHANNELS (1<<9)
Oct 21, 1999
Oct 21, 1999
30
31
32
33
34
35
36
37
/* A somewhat arbitrary frequency range. The low end of this will
sound terrible as no lowpass filtering is performed on most
instruments before resampling. */
#define MIN_OUTPUT_RATE 4000
#define MAX_OUTPUT_RATE 65000
/* In percent. */
Aug 21, 2004
Aug 21, 2004
38
39
40
/* #define DEFAULT_AMPLIFICATION 70 */
/* #define DEFAULT_AMPLIFICATION 50 */
#define DEFAULT_AMPLIFICATION 30
Oct 21, 1999
Oct 21, 1999
41
42
43
44
/* Default sampling rate, default polyphony, and maximum polyphony.
All but the last can be overridden from the command line. */
#define DEFAULT_RATE 32000
Aug 21, 2004
Aug 21, 2004
45
46
47
48
49
50
51
/* #define DEFAULT_VOICES 32 */
/* #define MAX_VOICES 48 */
#define DEFAULT_VOICES 256
#define MAX_VOICES 256
#define MAXCHAN 16
/* #define MAXCHAN 64 */
#define MAXNOTE 128
Oct 21, 1999
Oct 21, 1999
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* 1000 here will give a control ratio of 22:1 with 22 kHz output.
Higher CONTROLS_PER_SECOND values allow more accurate rendering
of envelopes and tremolo. The cost is CPU time. */
#define CONTROLS_PER_SECOND 1000
/* Strongly recommended. This option increases CPU usage by half, but
without it sound quality is very poor. */
#define LINEAR_INTERPOLATION
/* This is an experimental kludge that needs to be done right, but if
you've got an 8-bit sound card, or cheap multimedia speakers hooked
to your 16-bit output device, you should definitely give it a try.
Defining LOOKUP_HACK causes table lookups to be used in mixing
instead of multiplication. We convert the sample data to 8 bits at
load time and volumes to logarithmic 7-bit values before looking up
the product, which degrades sound quality noticeably.
Defining LOOKUP_HACK should save ~20% of CPU on an Intel machine.
LOOKUP_INTERPOLATION might give another ~5% */
/* #define LOOKUP_HACK
#define LOOKUP_INTERPOLATION */
/* Make envelopes twice as fast. Saves ~20% CPU time (notes decay
faster) and sounds more like a GUS. There is now a command line
option to toggle this as well. */
Aug 21, 2004
Aug 21, 2004
79
/* #define FAST_DECAY */
Oct 21, 1999
Oct 21, 1999
80
81
82
83
84
85
86
87
88
/* How many bits to use for the fractional part of sample positions.
This affects tonal accuracy. The entire position counter must fit
in 32 bits, so with FRACTION_BITS equal to 12, the maximum size of
a sample is 1048576 samples (2 megabytes in memory). The GUS gets
by with just 9 bits and a little help from its friends...
"The GUS does not SUCK!!!" -- a happy user :) */
#define FRACTION_BITS 12
Aug 21, 2004
Aug 21, 2004
89
90
91
92
#define MAX_SAMPLE_SIZE (1 << (32-FRACTION_BITS))
typedef double FLOAT_T;
Oct 21, 1999
Oct 21, 1999
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* For some reason the sample volume is always set to maximum in all
patch files. Define this for a crude adjustment that may help
equalize instrument volumes. */
#define ADJUST_SAMPLE_VOLUMES
/* The number of samples to use for ramping out a dying note. Affects
click removal. */
#define MAX_DIE_TIME 20
/* On some machines (especially PCs without math coprocessors),
looking up sine values in a table will be significantly faster than
computing them on the fly. Uncomment this to use lookups. */
/* #define LOOKUP_SINE */
/* Shawn McHorse's resampling optimizations. These may not in fact be
faster on your particular machine and compiler. You'll have to run
a benchmark to find out. */
#define PRECALC_LOOPS
/* If calling ldexp() is faster than a floating point multiplication
on your machine/compiler/libm, uncomment this. It doesn't make much
difference either way, but hey -- it was on the TODO list, so it
got done. */
/* #define USE_LDEXP */
/**************************************************************************/
/* Anything below this shouldn't need to be changed unless you're porting
to a new machine with other than 32-bit, big-endian words. */
/**************************************************************************/
/* change FRACTION_BITS above, not these */
#define INTEGER_BITS (32 - FRACTION_BITS)
#define INTEGER_MASK (0xFFFFFFFF << FRACTION_BITS)
#define FRACTION_MASK (~ INTEGER_MASK)
/* This is enforced by some computations that must fit in an int */
#define MAX_CONTROL_RATIO 255
typedef unsigned int uint32;
typedef int int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
typedef char int8;
/* Instrument files are little-endian, MIDI files big-endian, so we
need to do some conversions. */
#define XCHG_SHORT(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
# define XCHG_LONG(x) ((((x)&0xFF)<<24) | \
(((x)&0xFF00)<<8) | \
(((x)&0xFF0000)>>8) | \
(((x)>>24)&0xFF))
Apr 30, 2006
Apr 30, 2006
147
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
Oct 21, 1999
Oct 21, 1999
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#define LE_SHORT(x) x
#define LE_LONG(x) x
#define BE_SHORT(x) XCHG_SHORT(x)
#define BE_LONG(x) XCHG_LONG(x)
#else
#define BE_SHORT(x) x
#define BE_LONG(x) x
#define LE_SHORT(x) XCHG_SHORT(x)
#define LE_LONG(x) XCHG_LONG(x)
#endif
#define MAX_AMPLIFICATION 800
/* You could specify a complete path, e.g. "/etc/timidity.cfg", and
then specify the library directory in the configuration file. */
#define CONFIG_FILE "timidity.cfg"
Jul 4, 2005
Jul 4, 2005
164
165
#define CONFIG_FILE_ETC "/etc/timidity.cfg"
Nov 23, 2005
Nov 23, 2005
166
#if defined(__WIN32__) || defined(__OS2__)
Oct 3, 2009
Oct 3, 2009
167
#define DEFAULT_PATH "C:\\TIMIDITY"
Oct 21, 1999
Oct 21, 1999
168
#else
Oct 10, 2009
Oct 10, 2009
169
170
#define DEFAULT_PATH "/etc/timidity"
#define DEFAULT_PATH1 "/usr/share/timidity"
Jan 1, 2012
Jan 1, 2012
171
172
#define DEFAULT_PATH2 "/usr/local/share/timidity"
#define DEFAULT_PATH3 "/usr/local/lib/timidity"
Oct 21, 1999
Oct 21, 1999
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#endif
/* These affect general volume */
#define GUARD_BITS 3
#define AMP_BITS (15-GUARD_BITS)
#ifdef LOOKUP_HACK
typedef int8 sample_t;
typedef uint8 final_volume_t;
# define FINAL_VOLUME(v) (~_l2u[v])
# define MIXUP_SHIFT 5
# define MAX_AMP_VALUE 4095
#else
typedef int16 sample_t;
typedef int32 final_volume_t;
# define FINAL_VOLUME(v) (v)
# define MAX_AMP_VALUE ((1<<(AMP_BITS+1))-1)
#endif
Aug 21, 2004
Aug 21, 2004
192
193
typedef int16 resample_t;
Oct 21, 1999
Oct 21, 1999
194
195
196
197
#ifdef USE_LDEXP
# define FSCALE(a,b) ldexp((a),(b))
# define FSCALENEG(a,b) ldexp((a),-(b))
#else
Feb 1, 2000
Feb 1, 2000
198
199
# define FSCALE(a,b) (float)((a) * (double)(1<<(b)))
# define FSCALENEG(a,b) (float)((a) * (1.0L / (double)(1<<(b))))
Oct 21, 1999
Oct 21, 1999
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#endif
/* Vibrato and tremolo Choices of the Day */
#define SWEEP_TUNING 38
#define VIBRATO_AMPLITUDE_TUNING 1.0L
#define VIBRATO_RATE_TUNING 38
#define TREMOLO_AMPLITUDE_TUNING 1.0L
#define TREMOLO_RATE_TUNING 38
#define SWEEP_SHIFT 16
#define RATE_SHIFT 5
#define VIBRATO_SAMPLE_INCREMENTS 32
#ifndef PI
#define PI 3.14159265358979323846
#endif
/* The path separator (D.M.) */
Nov 23, 2005
Nov 23, 2005
219
#if defined(__WIN32__) || defined(__OS2__)
Oct 21, 1999
Oct 21, 1999
220
221
222
223
224
225
# define PATH_SEP '\\'
# define PATH_STRING "\\"
#else
# define PATH_SEP '/'
# define PATH_STRING "/"
#endif