1 /*---------------------------------------------------------------------------* 2 Project: SP objects and LPF coefficients for axfilter demo 3 File: lpfdemo.h 4 5 Copyright (C)1998-2006 Nintendo All Rights Reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: lpfdemo.h,v $ 14 Revision 1.2 02/02/2006 02:36:39 aka 15 Added copyright. 16 17 $NoKeywords: $ 18 19 *---------------------------------------------------------------------------*/ 20 21 // ----------------------------------------------------------------- 22 // SP table entry indices for lpfdemo.spd 23 // ----------------------------------------------------------------- 24 25 #define MSX_GS_LEFT 0 26 #define MSX_GS_RIGHT 1 27 #define MSX_SPL_LEFT 2 28 #define MSX_SPL_RIGHT 3 29 #define MSX_CAR_LEFT 4 30 #define MSX_CAR_RIGHT 5 31 #define SFX_GUNSHOT 6 32 #define SFX_PINK 7 33 #define SFX_WHITE 8 34 #define SFX_MACHINE_GUN 9 35 #define SFX_EXPLOSION 10 36 #define SFX_FOOTSTEPS 11 37 #define SFX_NGC_MAN 12 38 39 // ----------------------------------------------------------------- 40 // Coefficient table for LPF 41 // ----------------------------------------------------------------- 42 // The filter is a simple one-pole function: 43 // 44 // y(n) = a0*x(n) - b0*y(n-1) 45 // 46 // Where x(n) is the current input sample, and y(n-1) is the previous 47 // output sample. The coefficients a0 and b0 can be calculated thusly: 48 // 49 // c = 2.0 - cos(2*pi * freq) 50 // b0 = sqrt(c^2 - 1) - c 51 // a0 = 1 + b0 52 // 53 // Where freq is in HZ and must be within the range: 54 // 55 // 0 > freq < 16,000 56 // 57 // The coefficients must be unsigned, 16-bit words in fixed-point 58 // format, having 1 bit of integer and 15 bits of fraction. 59 // Furthermore, the b0 term must be (arithmetically) negated before 60 // being sent to the DSP. This is because of an optimization in the 61 // DSP filter calculation that is afforded by the absence of a sign 62 // bit in the coefficients. 63 // 64 65 #define NUM_FREQ_CUTOFF 24 // we're using 24 steps in the freq range 66 67 typedef struct 68 { 69 u16 a0; 70 u16 b0; 71 char *text; 72 73 } __LPF_COEF; 74 75 static __LPF_COEF __coefs[] = 76 { 77 { 0x6a09, 0x15f6, "16000 Hz" }, 78 { 0x6871, 0x178e, "12800 Hz" }, 79 { 0x6463, 0x1b9c, "10240 Hz" }, 80 { 0x5db3, 0x224c, "8000 Hz " }, 81 { 0x5618, 0x29e7, "6400 Hz " }, 82 { 0x4d7a, 0x3285, "5120 Hz " }, 83 { 0x4367, 0x3c98, "4000 Hz " }, 84 { 0x3a5a, 0x45a5, "3200 Hz " }, 85 { 0x31c5, 0x4e3a, "2560 Hz " }, 86 { 0x2924, 0x56db, "2000 Hz " }, 87 { 0x2244, 0x5dbb, "1600 Hz " }, 88 { 0x1c50, 0x63af, "1280 Hz " }, 89 { 0x16c0, 0x693f, "1000 Hz " }, 90 { 0x1292, 0x6d6d, "800 Hz " }, 91 { 0x0f18, 0x70e7, "640 Hz " }, 92 { 0x0bf5, 0x740a, "500 Hz " }, 93 { 0x09a9, 0x7656, "400 Hz " }, 94 { 0x07ca, 0x7835, "320 Hz " }, 95 { 0x0646, 0x79b9, "256 Hz " }, 96 { 0x04ed, 0x7b12, "200 Hz " }, 97 { 0x03f5, 0x7c0a, "160 Hz " }, 98 { 0x032d, 0x7cd2, "128 Hz " }, 99 { 0x027d, 0x7d82, "100 Hz " }, 100 { 0x01fe, 0x7e01, "80 Hz " } 101 }; 102