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 Perl Artistic License, available in COPYING. 7 */ 8 9 /* When a patch file can't be opened, one of these extensions is 10 appended to the filename and the open is tried again. 11 */ 12 #define PATCH_EXT_LIST { ".pat", 0 } 13 14 /* Acoustic Grand Piano seems to be the usual default instrument. */ 15 #define DEFAULT_PROGRAM 0 16 17 /* 9 here is MIDI channel 10, which is the standard percussion channel. 18 Some files (notably C:\WINDOWS\CANYON.MID) think that 16 is one too. 19 On the other hand, some files know that 16 is not a drum channel and 20 try to play music on it. This is now a runtime option, so this isn't 21 a critical choice anymore. */ 22 #define DEFAULT_DRUMCHANNELS (1<<9) 23 24 /* In percent. */ 25 #define DEFAULT_AMPLIFICATION 70 26 27 /* Default polyphony */ 28 /* #define DEFAULT_VOICES 32 */ 29 #define DEFAULT_VOICES 256 30 31 /* 1000 here will give a control ratio of 22:1 with 22 kHz output. 32 Higher CONTROLS_PER_SECOND values allow more accurate rendering 33 of envelopes and tremolo. The cost is CPU time. */ 34 #define CONTROLS_PER_SECOND 1000 35 36 /* Make envelopes twice as fast. Saves ~20% CPU time (notes decay 37 faster) and sounds more like a GUS. There is now a command line 38 option to toggle this as well. */ 39 #define FAST_DECAY 40 41 /* How many bits to use for the fractional part of sample positions. 42 This affects tonal accuracy. The entire position counter must fit 43 in 32 bits, so with FRACTION_BITS equal to 12, the maximum size of 44 a sample is 1048576 samples (2 megabytes in memory). The GUS gets 45 by with just 9 bits and a little help from its friends... 46 "The GUS does not SUCK!!!" -- a happy user :) */ 47 #define FRACTION_BITS 12 48 49 /* For some reason the sample volume is always set to maximum in all 50 patch files. Define this for a crude adjustment that may help 51 equalize instrument volumes. */ 52 #define ADJUST_SAMPLE_VOLUMES 53 54 /* The number of samples to use for ramping out a dying note. Affects 55 click removal. */ 56 #define MAX_DIE_TIME 20 57 58 /**************************************************************************/ 59 /* Anything below this shouldn't need to be changed unless you're porting 60 to a new machine with other than 32-bit, big-endian words. */ 61 /**************************************************************************/ 62 63 /* change FRACTION_BITS above, not these */ 64 #define INTEGER_MASK (0xFFFFFFFF << FRACTION_BITS) 65 #define FRACTION_MASK (~ INTEGER_MASK) 66 67 /* This is enforced by some computations that must fit in an int */ 68 #define MAX_CONTROL_RATIO 255 69 70 #define MAX_AMPLIFICATION 800 71 72 /* You could specify a complete path, e.g. "/etc/timidity.cfg", and 73 then specify the library directory in the configuration file. */ 74 #define CONFIG_FILE "timidity.cfg" 75 #define CONFIG_FILE_ETC "/etc/timidity.cfg" 76 #define CONFIG_FILE_ETC_TIMIDITY_FREEPATS "/etc/timidity/freepats.cfg" 77 78 #if defined(__WIN32__) || defined(__OS2__) 79 #define DEFAULT_PATH "C:\\TIMIDITY" 80 #else 81 #define DEFAULT_PATH "/etc/timidity" 82 #define DEFAULT_PATH1 "/usr/share/timidity" 83 #define DEFAULT_PATH2 "/usr/local/share/timidity" 84 #define DEFAULT_PATH3 "/usr/local/lib/timidity" 85 #endif 86 87 /* These affect general volume */ 88 #define GUARD_BITS 3 89 #define AMP_BITS (15-GUARD_BITS) 90 91 #define MAX_AMP_VALUE ((1<<(AMP_BITS+1))-1) 92 93 #define FSCALE(a,b) (float)((a) * (double)(1<<(b))) 94 #define FSCALENEG(a,b) (float)((a) * (1.0L / (double)(1<<(b)))) 95 96 /* Vibrato and tremolo Choices of the Day */ 97 #define SWEEP_TUNING 38 98 #define VIBRATO_AMPLITUDE_TUNING 1.0L 99 #define VIBRATO_RATE_TUNING 38 100 #define TREMOLO_AMPLITUDE_TUNING 1.0L 101 #define TREMOLO_RATE_TUNING 38 102 103 #define SWEEP_SHIFT 16 104 #define RATE_SHIFT 5 105 106 #ifndef PI 107 #define PI 3.14159265358979323846 108 #endif 109 110 /* The path separator (D.M.) */ 111 #if defined(__WIN32__) || defined(__OS2__) 112 # define PATH_SEP '\\' 113 #else 114 # define PATH_SEP '/' 115 #endif 116 117 #define SNDDBG(X) 118