2 date = 09-feb-2001 [Markus Fick]
\r
4 where: spline creation, spline macros
\r
5 what: added unity gain clamp code, added Quantizer_Bits(shift) preprocessor constants
\r
6 where: fir creation, fir macros
\r
7 what: - removed x<pi/2 condition in coef creation
\r
8 - added quantizer_bits(shift) preprocessor constants
\r
9 - set default quantizer bits to 15 instead 14 (scale now 32768 instead 16384)
\r
10 there should not occure any overflows during fir response calculation because
\r
11 of the symmetric form of filter and the position of the negative fir coefs
\r
12 - changed final volume calculation for 16bit samples (quality enhancement)
\r
14 date = 08-feb-2001 [Markus Fick]
\r
16 where: function ReadNote()
\r
17 what: modified behaviour of modplug so that interpolation is only deactivated if
\r
18 a) the user selects "no interpolation"
\r
19 b) linear interpolation is set and speed incr. > 0xff00
\r
20 => if spline or fir is active then we use always interpolation
\r
22 -> file: fastmix.cpp
\r
23 where: spline macros
\r
24 what: changed spline macros to use precalculated tables (way faster)
\r
26 what: - implemented spline table precalculator
\r
27 - changed fir precalculator + macros (for higher quality and clearer source)
\r
28 - added some comments and documentation
\r
30 - preprocessor constant: SPLINE_FRACBITS
\r
31 ) controls quality/memory usage
\r
32 range is [4..14] inclusive
\r
33 4 = low quality, low memory usage
\r
34 14 = highest quality, highest memory usage (1L<<14)*4*2 bytes
\r
35 - preprocessor constant: WFIR_FRACBITS
\r
36 ) controls quality/memory usage
\r
37 range is [4..12] inclusive
\r
38 4 = low quality, low mu
\r
39 12 = highest quality, highest memory usage ((1L<<(12+1))+1)*8*2 bytes
\r
41 date = 07-feb-2001 [Markus Fick]
\r
42 -> file: fastmix.cpp
\r
43 where: spline macros
\r
44 what: fixed error in coef calculation
\r
46 date = 07-feb-2001 [Markus Fick]
\r
48 where: class definition of soundfile
\r
49 what: removed InitFIR + DoneFIR function prototypes
\r
50 -> file: sndfile.cpp
\r
51 function:CSoundFile::CSoundFile()
\r
52 what: [modify] removed call to CSoundFile::InitFIRMixer( )
\r
54 function:CSoundFile::~CSoundFile()
\r
55 what: [modify] removed call to CSoundFile::DoneFIRMixer( )
\r
56 -> file: fastmix.cpp
\r
57 where: spline macros
\r
58 what: changed formula + added some guard bits to calculation
\r
60 where: fir macros + implementation
\r
61 what: - moved CSoundfile::FIR funtions to CzFIR (single instance sfir)
\r
62 - changed fir macros to support CzFIR class
\r
64 date = 06-feb-2001 [Markus Fick]
\r
65 -> file: fastmix.cpp
\r
67 what: - removed fir filter with coef interpolation
\r
68 - add spline interpolation
\r
69 RM: now modplug->select( SPLINE ) selects spline and
\r
70 modplug->select( POLYPHASE ) selects 8tap fir filter
\r
72 date = 05-feb-2001 [Markus Fick]
\r
73 -> file: fastmix.cpp
\r
74 where: macros + filter order
\r
75 what: [modify] changed filter order to 8 instead of 10
\r
77 -> file: fastmix.cpp
\r
78 what: new macros+switch for fir-interpolator with coef interpolation
\r
80 date = 04-feb-2001 [Markus Fick]
\r
83 where: class CSoundFile (bottom)
\r
84 what: [add] methods for FIR mixer support
\r
85 1. int InitFIRInterpolator( );
\r
86 2. int DoneFIRInterpolator( );
\r
88 -> file: sndfile.cpp
\r
89 function:CSoundFile::CSoundFile()
\r
90 what: [modify] add call to CSoundFile::InitFIRMixer( )
\r
92 function:CSoundFile::~CSoundFile()
\r
93 what: [modify] add call to CSoundFile::DoneFIRMixer( )
\r
95 -> file: fastmix.cpp
\r
96 new include: <math.h>
\r
97 why: need it for fir-coef calculation
\r
98 new function: CSoundFile::InitFIRMixer( ) // initializes fir filter lookup (if necessary)
\r
99 new function: CSoundFile::DoneFIRMixer( ) // decrements ReferenceCounter (for static vars) and deinitializes fir struct (if possible).
\r
101 #define FIRCPWBN 10 // log2 of number of precalculated wings (-(1L<<FIRCPWBN)..(1L<<FIRCPWBN))
\r
102 #define FIRLOPOSSHIFT (16-(FIRCPWBN+1)) // shift for lopos of sampleposition -> (16 - FIRCPWBN - 1)
\r
103 #define FIRLEN 9 // number(-1) of multiplications per sample
\r
104 #define FIRCUT 0.90f // cutoff of filter
\r
105 #define MIXNDX_FIRMIXERSRC 0x20 // src-type for firfilter
\r
107 static signed short *cFirLut; // lulines
\r
108 static int bFirInitialized = 0; // initialized?
\r
109 static int nFirOrder = FIRLEN; // order (modplug has 4smps pre/post extension, so limit this to 9)
\r
110 static float nFirFC = FIRCUT; // cutoff (normalized to pi/2)
\r
111 static int nFirCpw = (1L<<FIRCPWBN); // number of precalculted filter lines
\r
112 static int nFirUsers = 0; // reference counter
\r
114 #define SNDMIX_GETMONOVOL8FIRFILTER
\r
115 #define SNDMIX_GETMONOVOL16FIRFILTER
\r
116 #define SNDMIX_GETSTEREOVOL8FIRFILTER
\r
117 #define SNDMIX_GETSTEREOVOL16FIRFILTER
\r
118 new mixer interface macros:
\r
119 BEGIN_MIX_INTERFACE(Mono8BitFirFilterMix)
\r
120 BEGIN_MIX_INTERFACE(Mono16BitFirFilterMix)
\r
121 BEGIN_RAMPMIX_INTERFACE(Mono8BitFirFilterRampMix)
\r
122 BEGIN_RAMPMIX_INTERFACE(Mono16BitFirFilterRampMix)
\r
123 BEGIN_MIX_INTERFACE(FastMono8BitFirFilterMix)
\r
124 BEGIN_MIX_INTERFACE(FastMono16BitFirFilterMix)
\r
125 BEGIN_FASTRAMPMIX_INTERFACE(FastMono8BitFirFilterRampMix)
\r
126 BEGIN_FASTRAMPMIX_INTERFACE(FastMono16BitFirFilterRampMix)
\r
127 BEGIN_MIX_INTERFACE(Stereo8BitFirFilterMix)
\r
128 BEGIN_MIX_INTERFACE(Stereo16BitFirFilterMix)
\r
129 BEGIN_RAMPMIX_INTERFACE(Stereo8BitFirFilterRampMix)
\r
130 BEGIN_RAMPMIX_INTERFACE(Stereo16BitFirFilterRampMix)
\r
131 BEGIN_MIX_FLT_INTERFACE(FilterMono8BitFirFilterMix)
\r
132 BEGIN_MIX_FLT_INTERFACE(FilterMono16BitFirFilterMix)
\r
133 BEGIN_RAMPMIX_FLT_INTERFACE(FilterMono8BitFirFilterRampMix)
\r
134 BEGIN_RAMPMIX_FLT_INTERFACE(FilterMono16BitFirFilterRampMix)
\r
135 BEGIN_MIX_STFLT_INTERFACE(FilterStereo8BitFirFilterMix)
\r
136 BEGIN_MIX_STFLT_INTERFACE(FilterStereo16BitFirFilterMix)
\r
137 BEGIN_RAMPMIX_STFLT_INTERFACE(FilterStereo8BitFirFilterRampMix)
\r
138 BEGIN_RAMPMIX_STFLT_INTERFACE(FilterStereo16BitFirFilterRampMix)
\r
140 const LPMIXINTERFACE gpMixFunctionTable[2*2*16] // to hold new fir mixer interface
\r
141 const LPMIXINTERFACE gpFastMixFunctionTable[2*2*16] // to hold new fir mixer interface
\r
142 functioN: UINT CSoundFile::CreateStereoMix(int count)
\r
144 if (!(pChannel->dwFlags & CHN_NOIDO))
\r
146 // use hq-fir mixer?
\r
147 if( ((gdwSoundSetup & (SNDMIX_HQRESAMPLER|SNDMIX_ULTRAHQSRCMODE)) == (SNDMIX_HQRESAMPLER|SNDMIX_ULTRAHQSRCMODE)) ||
\r
148 ((gdwSoundSetup & (SNDMIX_HQRESAMPLER)) == (SNDMIX_HQRESAMPLER)) )
\r
149 nFlags += MIXNDX_FIRMIXERSRC;
\r
151 nFlags += MIXNDX_LINEARSRC; // use
\r
154 if (!(pChannel->dwFlags & CHN_NOIDO))
\r
156 nFlags += MIXNDX_LINEARSRC; // use
\r