1 /*---------------------------------------------------------------------------- 2 * 3 * File: 4 * eas_fmtables.c 5 * 6 * Contents and purpose: 7 * Contains lookup tables for the FM synthesizer 8 * 9 * 10 * Copyright Sonic Network Inc. 2005 11 12 * Licensed under the Apache License, Version 2.0 (the "License"); 13 * you may not use this file except in compliance with the License. 14 * You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 * 24 *---------------------------------------------------------------------------- 25 * Revision Control: 26 * $Revision: 82 $ 27 * $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $ 28 * 29 *---------------------------------------------------------------------------- 30 */ 31 32 33 #include "eas_types.h" 34 35 /* this table is needed by the DSP and the main processor */ 36 const EAS_U8 fmScaleTable[16] = 37 { 38 0,8,16,24,32,40,48,56,64,72,80,96,128,160,192,255 39 }; 40 41 /* these tables are needed on the main processor */ 42 #ifndef _DSP_CODE 43 const EAS_I16 fmControlTable[128] = 44 { 45 -32768,-14313,-12265,-11067,-10217,-9558,-9019,-8563, 46 -8169,-7821,-7510,-7228,-6971,-6734,-6515,-6312, 47 -6121,-5942,-5773,-5613,-5462,-5317,-5180,-5049, 48 -4923,-4802,-4686,-4575,-4467,-4364,-4264,-4167, 49 -4073,-3982,-3894,-3808,-3725,-3644,-3565,-3488, 50 -3414,-3341,-3269,-3200,-3132,-3066,-3001,-2937, 51 -2875,-2814,-2754,-2696,-2638,-2582,-2527,-2473, 52 -2419,-2367,-2316,-2265,-2216,-2167,-2119,-2071, 53 -2025,-1979,-1934,-1889,-1846,-1803,-1760,-1718, 54 -1677,-1636,-1596,-1556,-1517,-1478,-1440,-1403, 55 -1366,-1329,-1293,-1257,-1221,-1186,-1152,-1118, 56 -1084,-1051,-1018,-985,-953,-921,-889,-858, 57 -827,-796,-766,-736,-706,-677,-648,-619, 58 -590,-562,-534,-506,-479,-452,-425,-398, 59 -371,-345,-319,-293,-268,-242,-217,-192, 60 -168,-143,-119,-95,-71,-47,-23,0 61 }; 62 63 const EAS_U16 fmRateTable[128] = 64 { 65 32767,32764,32758,32747,32731,32712,32688,32659, 66 32627,32590,32548,32503,32453,32398,32340,32277, 67 32211,32140,32065,31985,31902,31815,31724,31628, 68 31529,31426,31319,31208,31094,30976,30854,30728, 69 30599,30466,30330,30191,30048,29902,29752,29599, 70 29443,29285,29123,28958,28790,28619,28445,28269, 71 28090,27909,27725,27538,27349,27158,26964,26769, 72 26571,26371,26169,25965,25760,25552,25343,25132, 73 24920,24706,24490,24274,24056,23836,23616,23394, 74 23172,22948,22724,22499,22273,22046,21819,21591, 75 21363,21135,20906,20676,20447,20217,19987,19758, 76 19528,19298,19069,18840,18610,18382,18153,17926, 77 17698,17471,17245,17020,16795,16571,16347,16125, 78 15903,15683,15463,15245,15027,14811,14596,14382, 79 14169,13957,13747,13538,13331,13125,12920,12717, 80 12516,12316,12117,11921,11725,11532,11340,0 81 }; 82 83 const EAS_U16 fmAttackTable[15] = 84 { 85 27,54,109,327,655,1310,2730,4095, 86 4681,5461,6553,8191,10922,16383,32767 87 }; 88 89 const EAS_U8 fmDecayTable[16] = 90 { 91 4,7,10,15,20,25,30,35,40,50,60,70,80,90,100,127 92 }; 93 94 const EAS_U8 fmReleaseTable[16] = 95 { 96 10,15,20,25,30,35,40,45,50,60,70,80,90,100,113,127 97 }; 98 #endif 99 100 /* this table is needed only on the DSP */ 101 #if defined(_DSP_CODE) || !defined(_SPLIT_ARCHITECTURE) 102 //--------------------------------------------------------------------- 103 // sineTable 104 // 105 // Contains sine lookup table 106 //--------------------------------------------------------------------- 107 108 const EAS_I16 sineTable[2048] = 109 { 110 0,101,201,302,402,503,603,704, 111 804,905,1005,1106,1206,1307,1407,1507, 112 1608,1708,1809,1909,2009,2110,2210,2310, 113 2410,2511,2611,2711,2811,2911,3012,3112, 114 3212,3312,3412,3512,3612,3712,3811,3911, 115 4011,4111,4210,4310,4410,4509,4609,4708, 116 4808,4907,5007,5106,5205,5305,5404,5503, 117 5602,5701,5800,5899,5998,6096,6195,6294, 118 6393,6491,6590,6688,6786,6885,6983,7081, 119 7179,7277,7375,7473,7571,7669,7767,7864, 120 7962,8059,8157,8254,8351,8448,8545,8642, 121 8739,8836,8933,9030,9126,9223,9319,9416, 122 9512,9608,9704,9800,9896,9992,10087,10183, 123 10278,10374,10469,10564,10659,10754,10849,10944, 124 11039,11133,11228,11322,11417,11511,11605,11699, 125 11793,11886,11980,12074,12167,12260,12353,12446, 126 12539,12632,12725,12817,12910,13002,13094,13187, 127 13279,13370,13462,13554,13645,13736,13828,13919, 128 14010,14101,14191,14282,14372,14462,14553,14643, 129 14732,14822,14912,15001,15090,15180,15269,15358, 130 15446,15535,15623,15712,15800,15888,15976,16063, 131 16151,16238,16325,16413,16499,16586,16673,16759, 132 16846,16932,17018,17104,17189,17275,17360,17445, 133 17530,17615,17700,17784,17869,17953,18037,18121, 134 18204,18288,18371,18454,18537,18620,18703,18785, 135 18868,18950,19032,19113,19195,19276,19357,19438, 136 19519,19600,19680,19761,19841,19921,20000,20080, 137 20159,20238,20317,20396,20475,20553,20631,20709, 138 20787,20865,20942,21019,21096,21173,21250,21326, 139 21403,21479,21554,21630,21705,21781,21856,21930, 140 22005,22079,22154,22227,22301,22375,22448,22521, 141 22594,22667,22739,22812,22884,22956,23027,23099, 142 23170,23241,23311,23382,23452,23522,23592,23662, 143 23731,23801,23870,23938,24007,24075,24143,24211, 144 24279,24346,24413,24480,24547,24613,24680,24746, 145 24811,24877,24942,25007,25072,25137,25201,25265, 146 25329,25393,25456,25519,25582,25645,25708,25770, 147 25832,25893,25955,26016,26077,26138,26198,26259, 148 26319,26378,26438,26497,26556,26615,26674,26732, 149 26790,26848,26905,26962,27019,27076,27133,27189, 150 27245,27300,27356,27411,27466,27521,27575,27629, 151 27683,27737,27790,27843,27896,27949,28001,28053, 152 28105,28157,28208,28259,28310,28360,28411,28460, 153 28510,28560,28609,28658,28706,28755,28803,28850, 154 28898,28945,28992,29039,29085,29131,29177,29223, 155 29268,29313,29358,29403,29447,29491,29534,29578, 156 29621,29664,29706,29749,29791,29832,29874,29915, 157 29956,29997,30037,30077,30117,30156,30195,30234, 158 30273,30311,30349,30387,30424,30462,30498,30535, 159 30571,30607,30643,30679,30714,30749,30783,30818, 160 30852,30885,30919,30952,30985,31017,31050,31082, 161 31113,31145,31176,31206,31237,31267,31297,31327, 162 31356,31385,31414,31442,31470,31498,31526,31553, 163 31580,31607,31633,31659,31685,31710,31736,31760, 164 31785,31809,31833,31857,31880,31903,31926,31949, 165 31971,31993,32014,32036,32057,32077,32098,32118, 166 32137,32157,32176,32195,32213,32232,32250,32267, 167 32285,32302,32318,32335,32351,32367,32382,32397, 168 32412,32427,32441,32455,32469,32482,32495,32508, 169 32521,32533,32545,32556,32567,32578,32589,32599, 170 32609,32619,32628,32637,32646,32655,32663,32671, 171 32678,32685,32692,32699,32705,32711,32717,32722, 172 32728,32732,32737,32741,32745,32748,32752,32755, 173 32757,32759,32761,32763,32765,32766,32766,32767, 174 32767,32767,32766,32766,32765,32763,32761,32759, 175 32757,32755,32752,32748,32745,32741,32737,32732, 176 32728,32722,32717,32711,32705,32699,32692,32685, 177 32678,32671,32663,32655,32646,32637,32628,32619, 178 32609,32599,32589,32578,32567,32556,32545,32533, 179 32521,32508,32495,32482,32469,32455,32441,32427, 180 32412,32397,32382,32367,32351,32335,32318,32302, 181 32285,32267,32250,32232,32213,32195,32176,32157, 182 32137,32118,32098,32077,32057,32036,32014,31993, 183 31971,31949,31926,31903,31880,31857,31833,31809, 184 31785,31760,31736,31710,31685,31659,31633,31607, 185 31580,31553,31526,31498,31470,31442,31414,31385, 186 31356,31327,31297,31267,31237,31206,31176,31145, 187 31113,31082,31050,31017,30985,30952,30919,30885, 188 30852,30818,30783,30749,30714,30679,30643,30607, 189 30571,30535,30498,30462,30424,30387,30349,30311, 190 30273,30234,30195,30156,30117,30077,30037,29997, 191 29956,29915,29874,29832,29791,29749,29706,29664, 192 29621,29578,29534,29491,29447,29403,29358,29313, 193 29268,29223,29177,29131,29085,29039,28992,28945, 194 28898,28850,28803,28755,28706,28658,28609,28560, 195 28510,28460,28411,28360,28310,28259,28208,28157, 196 28105,28053,28001,27949,27896,27843,27790,27737, 197 27683,27629,27575,27521,27466,27411,27356,27300, 198 27245,27189,27133,27076,27019,26962,26905,26848, 199 26790,26732,26674,26615,26556,26497,26438,26378, 200 26319,26259,26198,26138,26077,26016,25955,25893, 201 25832,25770,25708,25645,25582,25519,25456,25393, 202 25329,25265,25201,25137,25072,25007,24942,24877, 203 24811,24746,24680,24613,24547,24480,24413,24346, 204 24279,24211,24143,24075,24007,23938,23870,23801, 205 23731,23662,23592,23522,23452,23382,23311,23241, 206 23170,23099,23027,22956,22884,22812,22739,22667, 207 22594,22521,22448,22375,22301,22227,22154,22079, 208 22005,21930,21856,21781,21705,21630,21554,21479, 209 21403,21326,21250,21173,21096,21019,20942,20865, 210 20787,20709,20631,20553,20475,20396,20317,20238, 211 20159,20080,20000,19921,19841,19761,19680,19600, 212 19519,19438,19357,19276,19195,19113,19032,18950, 213 18868,18785,18703,18620,18537,18454,18371,18288, 214 18204,18121,18037,17953,17869,17784,17700,17615, 215 17530,17445,17360,17275,17189,17104,17018,16932, 216 16846,16759,16673,16586,16499,16413,16325,16238, 217 16151,16063,15976,15888,15800,15712,15623,15535, 218 15446,15358,15269,15180,15090,15001,14912,14822, 219 14732,14643,14553,14462,14372,14282,14191,14101, 220 14010,13919,13828,13736,13645,13554,13462,13370, 221 13279,13187,13094,13002,12910,12817,12725,12632, 222 12539,12446,12353,12260,12167,12074,11980,11886, 223 11793,11699,11605,11511,11417,11322,11228,11133, 224 11039,10944,10849,10754,10659,10564,10469,10374, 225 10278,10183,10087,9992,9896,9800,9704,9608, 226 9512,9416,9319,9223,9126,9030,8933,8836, 227 8739,8642,8545,8448,8351,8254,8157,8059, 228 7962,7864,7767,7669,7571,7473,7375,7277, 229 7179,7081,6983,6885,6786,6688,6590,6491, 230 6393,6294,6195,6096,5998,5899,5800,5701, 231 5602,5503,5404,5305,5205,5106,5007,4907, 232 4808,4708,4609,4509,4410,4310,4210,4111, 233 4011,3911,3811,3712,3612,3512,3412,3312, 234 3212,3112,3012,2911,2811,2711,2611,2511, 235 2410,2310,2210,2110,2009,1909,1809,1708, 236 1608,1507,1407,1307,1206,1106,1005,905, 237 804,704,603,503,402,302,201,101, 238 0,-101,-201,-302,-402,-503,-603,-704, 239 -804,-905,-1005,-1106,-1206,-1307,-1407,-1507, 240 -1608,-1708,-1809,-1909,-2009,-2110,-2210,-2310, 241 -2410,-2511,-2611,-2711,-2811,-2911,-3012,-3112, 242 -3212,-3312,-3412,-3512,-3612,-3712,-3811,-3911, 243 -4011,-4111,-4210,-4310,-4410,-4509,-4609,-4708, 244 -4808,-4907,-5007,-5106,-5205,-5305,-5404,-5503, 245 -5602,-5701,-5800,-5899,-5998,-6096,-6195,-6294, 246 -6393,-6491,-6590,-6688,-6786,-6885,-6983,-7081, 247 -7179,-7277,-7375,-7473,-7571,-7669,-7767,-7864, 248 -7962,-8059,-8157,-8254,-8351,-8448,-8545,-8642, 249 -8739,-8836,-8933,-9030,-9126,-9223,-9319,-9416, 250 -9512,-9608,-9704,-9800,-9896,-9992,-10087,-10183, 251 -10278,-10374,-10469,-10564,-10659,-10754,-10849,-10944, 252 -11039,-11133,-11228,-11322,-11417,-11511,-11605,-11699, 253 -11793,-11886,-11980,-12074,-12167,-12260,-12353,-12446, 254 -12539,-12632,-12725,-12817,-12910,-13002,-13094,-13187, 255 -13279,-13370,-13462,-13554,-13645,-13736,-13828,-13919, 256 -14010,-14101,-14191,-14282,-14372,-14462,-14553,-14643, 257 -14732,-14822,-14912,-15001,-15090,-15180,-15269,-15358, 258 -15446,-15535,-15623,-15712,-15800,-15888,-15976,-16063, 259 -16151,-16238,-16325,-16413,-16499,-16586,-16673,-16759, 260 -16846,-16932,-17018,-17104,-17189,-17275,-17360,-17445, 261 -17530,-17615,-17700,-17784,-17869,-17953,-18037,-18121, 262 -18204,-18288,-18371,-18454,-18537,-18620,-18703,-18785, 263 -18868,-18950,-19032,-19113,-19195,-19276,-19357,-19438, 264 -19519,-19600,-19680,-19761,-19841,-19921,-20000,-20080, 265 -20159,-20238,-20317,-20396,-20475,-20553,-20631,-20709, 266 -20787,-20865,-20942,-21019,-21096,-21173,-21250,-21326, 267 -21403,-21479,-21554,-21630,-21705,-21781,-21856,-21930, 268 -22005,-22079,-22154,-22227,-22301,-22375,-22448,-22521, 269 -22594,-22667,-22739,-22812,-22884,-22956,-23027,-23099, 270 -23170,-23241,-23311,-23382,-23452,-23522,-23592,-23662, 271 -23731,-23801,-23870,-23938,-24007,-24075,-24143,-24211, 272 -24279,-24346,-24413,-24480,-24547,-24613,-24680,-24746, 273 -24811,-24877,-24942,-25007,-25072,-25137,-25201,-25265, 274 -25329,-25393,-25456,-25519,-25582,-25645,-25708,-25770, 275 -25832,-25893,-25955,-26016,-26077,-26138,-26198,-26259, 276 -26319,-26378,-26438,-26497,-26556,-26615,-26674,-26732, 277 -26790,-26848,-26905,-26962,-27019,-27076,-27133,-27189, 278 -27245,-27300,-27356,-27411,-27466,-27521,-27575,-27629, 279 -27683,-27737,-27790,-27843,-27896,-27949,-28001,-28053, 280 -28105,-28157,-28208,-28259,-28310,-28360,-28411,-28460, 281 -28510,-28560,-28609,-28658,-28706,-28755,-28803,-28850, 282 -28898,-28945,-28992,-29039,-29085,-29131,-29177,-29223, 283 -29268,-29313,-29358,-29403,-29447,-29491,-29534,-29578, 284 -29621,-29664,-29706,-29749,-29791,-29832,-29874,-29915, 285 -29956,-29997,-30037,-30077,-30117,-30156,-30195,-30234, 286 -30273,-30311,-30349,-30387,-30424,-30462,-30498,-30535, 287 -30571,-30607,-30643,-30679,-30714,-30749,-30783,-30818, 288 -30852,-30885,-30919,-30952,-30985,-31017,-31050,-31082, 289 -31113,-31145,-31176,-31206,-31237,-31267,-31297,-31327, 290 -31356,-31385,-31414,-31442,-31470,-31498,-31526,-31553, 291 -31580,-31607,-31633,-31659,-31685,-31710,-31736,-31760, 292 -31785,-31809,-31833,-31857,-31880,-31903,-31926,-31949, 293 -31971,-31993,-32014,-32036,-32057,-32077,-32098,-32118, 294 -32137,-32157,-32176,-32195,-32213,-32232,-32250,-32267, 295 -32285,-32302,-32318,-32335,-32351,-32367,-32382,-32397, 296 -32412,-32427,-32441,-32455,-32469,-32482,-32495,-32508, 297 -32521,-32533,-32545,-32556,-32567,-32578,-32589,-32599, 298 -32609,-32619,-32628,-32637,-32646,-32655,-32663,-32671, 299 -32678,-32685,-32692,-32699,-32705,-32711,-32717,-32722, 300 -32728,-32732,-32737,-32741,-32745,-32748,-32752,-32755, 301 -32757,-32759,-32761,-32763,-32765,-32766,-32766,-32767, 302 -32767,-32767,-32766,-32766,-32765,-32763,-32761,-32759, 303 -32757,-32755,-32752,-32748,-32745,-32741,-32737,-32732, 304 -32728,-32722,-32717,-32711,-32705,-32699,-32692,-32685, 305 -32678,-32671,-32663,-32655,-32646,-32637,-32628,-32619, 306 -32609,-32599,-32589,-32578,-32567,-32556,-32545,-32533, 307 -32521,-32508,-32495,-32482,-32469,-32455,-32441,-32427, 308 -32412,-32397,-32382,-32367,-32351,-32335,-32318,-32302, 309 -32285,-32267,-32250,-32232,-32213,-32195,-32176,-32157, 310 -32137,-32118,-32098,-32077,-32057,-32036,-32014,-31993, 311 -31971,-31949,-31926,-31903,-31880,-31857,-31833,-31809, 312 -31785,-31760,-31736,-31710,-31685,-31659,-31633,-31607, 313 -31580,-31553,-31526,-31498,-31470,-31442,-31414,-31385, 314 -31356,-31327,-31297,-31267,-31237,-31206,-31176,-31145, 315 -31113,-31082,-31050,-31017,-30985,-30952,-30919,-30885, 316 -30852,-30818,-30783,-30749,-30714,-30679,-30643,-30607, 317 -30571,-30535,-30498,-30462,-30424,-30387,-30349,-30311, 318 -30273,-30234,-30195,-30156,-30117,-30077,-30037,-29997, 319 -29956,-29915,-29874,-29832,-29791,-29749,-29706,-29664, 320 -29621,-29578,-29534,-29491,-29447,-29403,-29358,-29313, 321 -29268,-29223,-29177,-29131,-29085,-29039,-28992,-28945, 322 -28898,-28850,-28803,-28755,-28706,-28658,-28609,-28560, 323 -28510,-28460,-28411,-28360,-28310,-28259,-28208,-28157, 324 -28105,-28053,-28001,-27949,-27896,-27843,-27790,-27737, 325 -27683,-27629,-27575,-27521,-27466,-27411,-27356,-27300, 326 -27245,-27189,-27133,-27076,-27019,-26962,-26905,-26848, 327 -26790,-26732,-26674,-26615,-26556,-26497,-26438,-26378, 328 -26319,-26259,-26198,-26138,-26077,-26016,-25955,-25893, 329 -25832,-25770,-25708,-25645,-25582,-25519,-25456,-25393, 330 -25329,-25265,-25201,-25137,-25072,-25007,-24942,-24877, 331 -24811,-24746,-24680,-24613,-24547,-24480,-24413,-24346, 332 -24279,-24211,-24143,-24075,-24007,-23938,-23870,-23801, 333 -23731,-23662,-23592,-23522,-23452,-23382,-23311,-23241, 334 -23170,-23099,-23027,-22956,-22884,-22812,-22739,-22667, 335 -22594,-22521,-22448,-22375,-22301,-22227,-22154,-22079, 336 -22005,-21930,-21856,-21781,-21705,-21630,-21554,-21479, 337 -21403,-21326,-21250,-21173,-21096,-21019,-20942,-20865, 338 -20787,-20709,-20631,-20553,-20475,-20396,-20317,-20238, 339 -20159,-20080,-20000,-19921,-19841,-19761,-19680,-19600, 340 -19519,-19438,-19357,-19276,-19195,-19113,-19032,-18950, 341 -18868,-18785,-18703,-18620,-18537,-18454,-18371,-18288, 342 -18204,-18121,-18037,-17953,-17869,-17784,-17700,-17615, 343 -17530,-17445,-17360,-17275,-17189,-17104,-17018,-16932, 344 -16846,-16759,-16673,-16586,-16499,-16413,-16325,-16238, 345 -16151,-16063,-15976,-15888,-15800,-15712,-15623,-15535, 346 -15446,-15358,-15269,-15180,-15090,-15001,-14912,-14822, 347 -14732,-14643,-14553,-14462,-14372,-14282,-14191,-14101, 348 -14010,-13919,-13828,-13736,-13645,-13554,-13462,-13370, 349 -13279,-13187,-13094,-13002,-12910,-12817,-12725,-12632, 350 -12539,-12446,-12353,-12260,-12167,-12074,-11980,-11886, 351 -11793,-11699,-11605,-11511,-11417,-11322,-11228,-11133, 352 -11039,-10944,-10849,-10754,-10659,-10564,-10469,-10374, 353 -10278,-10183,-10087,-9992,-9896,-9800,-9704,-9608, 354 -9512,-9416,-9319,-9223,-9126,-9030,-8933,-8836, 355 -8739,-8642,-8545,-8448,-8351,-8254,-8157,-8059, 356 -7962,-7864,-7767,-7669,-7571,-7473,-7375,-7277, 357 -7179,-7081,-6983,-6885,-6786,-6688,-6590,-6491, 358 -6393,-6294,-6195,-6096,-5998,-5899,-5800,-5701, 359 -5602,-5503,-5404,-5305,-5205,-5106,-5007,-4907, 360 -4808,-4708,-4609,-4509,-4410,-4310,-4210,-4111, 361 -4011,-3911,-3811,-3712,-3612,-3512,-3412,-3312, 362 -3212,-3112,-3012,-2911,-2811,-2711,-2611,-2511, 363 -2410,-2310,-2210,-2110,-2009,-1909,-1809,-1708, 364 -1608,-1507,-1407,-1307,-1206,-1106,-1005,-905, 365 -804,-704,-603,-503,-402,-302,-201,-101 366 }; 367 #endif 368 369