| 166 | } |
| 167 | |
| 168 | void MakeFilters(int32 rate) |
| 169 | { |
| 170 | const int32 *tabs[6]={C44100NTSC,C44100PAL,C48000NTSC,C48000PAL,C96000NTSC, |
| 171 | C96000PAL}; |
| 172 | const int32 *sq2tabs[6]={SQ2C44100NTSC,SQ2C44100PAL,SQ2C48000NTSC,SQ2C48000PAL, |
| 173 | SQ2C96000NTSC,SQ2C96000PAL}; |
| 174 | |
| 175 | const int32 *tmp; |
| 176 | int32 x; |
| 177 | uint32 nco; |
| 178 | |
| 179 | if(FSettings.soundq==2) |
| 180 | nco=SQ2NCOEFFS; |
| 181 | else |
| 182 | nco=NCOEFFS; |
| 183 | |
| 184 | mrindex=(nco+1)<<16; |
| 185 | mrratio=(PAL?(int64)(PAL_CPU*65536):(int64)(NTSC_CPU*65536))/rate; |
| 186 | |
| 187 | if(FSettings.soundq==2) |
| 188 | tmp=sq2tabs[(PAL?1:0)|(rate==48000?2:0)|(rate==96000?4:0)]; |
| 189 | else |
| 190 | tmp=tabs[(PAL?1:0)|(rate==48000?2:0)|(rate==96000?4:0)]; |
| 191 | |
| 192 | if(FSettings.soundq==2) |
| 193 | for(x=0;x<SQ2NCOEFFS>>1;x++) |
| 194 | sq2coeffs[x]=sq2coeffs[SQ2NCOEFFS-1-x]=tmp[x]; |
| 195 | else |
| 196 | for(x=0;x<NCOEFFS>>1;x++) |
| 197 | coeffs[x]=coeffs[NCOEFFS-1-x]=tmp[x]; |
| 198 | |
| 199 | #ifdef MOO |
| 200 | /* Some tests involving precision and error. */ |
| 201 | { |
| 202 | static int64 acc=0; |
| 203 | int x; |
| 204 | for(x=0;x<SQ2NCOEFFS;x++) |
| 205 | acc+=(int64)32767*sq2coeffs[x]; |
| 206 | printf("Foo: %lld\n",acc); |
| 207 | } |
| 208 | #endif |
| 209 | } |