#define RESBITS 16 #define SAMPLEBITS 10 #define SAMPLEBITS_N 1024 #define SAMPLEBITS_MASK 0x3ff static const uint16_t sin_samples[SAMPLEBITS_N] = { 32767,32968,33169,33370,33571,33772,33973,34173,34374,34575,34776,34976,35177,35377,35578,35778, 35978,36178,36378,36578,36777,36977,37176,37375,37574,37773,37972,38170,38368,38566,38764,38962, 39159,39356,39553,39749,39946,40142,40337,40533,40728,40923,41117,41312,41506,41699,41892,42085, 42278,42470,42662,42854,43045,43235,43426,43616,43805,43994,44183,44371,44559,44746,44933,45120, 45306,45491,45676,45861,46045,46228,46411,46594,46776,46957,47138,47319,47498,47678,47857,48035, 48212,48389,48566,48742,48917,49091,49265,49439,49612,49784,49955,50126,50296,50466,50635,50803, 50970,51137,51303,51469,51633,51797,51961,52123,52285,52446,52607,52766,52925,53083,53241,53397, 53553,53708,53862,54016,54168,54320,54471,54621,54771,54919,55067,55214,55360,55505,55649,55793, 55936,56077,56218,56358,56497,56635,56773,56909,57045,57179,57313,57445,57577,57708,57838,57967, 58095,58222,58348,58473,58597,58721,58843,58964,59084,59204,59322,59439,59555,59671,59785,59898, 60010,60122,60232,60341,60449,60556,60662,60767,60871,60974,61075,61176,61276,61374,61472,61568, 61664,61758,61851,61943,62034,62124,62212,62300,62387,62472,62556,62639,62721,62802,62882,62961, 63038,63115,63190,63264,63337,63409,63479,63549,63617,63684,63750,63815,63879,63941,64003,64063, 64122,64179,64236,64291,64346,64399,64450,64501,64551,64599,64646,64692,64736,64780,64822,64863, 64903,64942,64979,65015,65050,65084,65116,65148,65178,65207,65234,65261,65286,65310,65333,65354, 65375,65394,65412,65428,65444,65458,65471,65483,65493,65502,65510,65517,65523,65527,65530,65532, 65533,65532,65530,65527,65523,65517,65510,65502,65493,65483,65471,65458,65444,65428,65412,65394, 65375,65354,65333,65310,65286,65261,65234,65207,65178,65148,65116,65084,65050,65015,64979,64942, 64903,64863,64822,64780,64736,64692,64646,64599,64551,64501,64450,64399,64346,64291,64236,64179, 64122,64063,64003,63941,63879,63815,63750,63684,63617,63549,63479,63409,63337,63264,63190,63115, 63038,62961,62882,62802,62721,62639,62556,62472,62387,62300,62212,62124,62034,61943,61851,61758, 61664,61568,61472,61374,61276,61176,61075,60974,60871,60767,60662,60556,60449,60341,60232,60122, 60010,59898,59785,59671,59555,59439,59322,59204,59084,58964,58843,58721,58597,58473,58348,58222, 58095,57967,57838,57708,57577,57445,57313,57179,57045,56909,56773,56635,56497,56358,56218,56077, 55936,55793,55649,55505,55360,55214,55067,54919,54771,54621,54471,54320,54168,54016,53862,53708, 53553,53397,53241,53083,52925,52766,52607,52446,52285,52123,51961,51797,51633,51469,51303,51137, 50970,50803,50635,50466,50296,50126,49955,49784,49612,49439,49265,49091,48917,48742,48566,48389, 48212,48035,47857,47678,47498,47319,47138,46957,46776,46594,46411,46228,46045,45861,45676,45491, 45306,45120,44933,44746,44559,44371,44183,43994,43805,43616,43426,43235,43045,42854,42662,42470, 42278,42085,41892,41699,41506,41312,41117,40923,40728,40533,40337,40142,39946,39749,39553,39356, 39159,38962,38764,38566,38368,38170,37972,37773,37574,37375,37176,36977,36777,36578,36378,36178, 35978,35778,35578,35377,35177,34976,34776,34575,34374,34173,33973,33772,33571,33370,33169,32968, 32767,32565,32364,32163,31962,31761,31560,31360,31159,30958,30757,30557,30356,30156,29955,29755, 29555,29355,29155,28955,28756,28556,28357,28158,27959,27760,27561,27363,27165,26967,26769,26571, 26374,26177,25980,25784,25587,25391,25196,25000,24805,24610,24416,24221,24027,23834,23641,23448, 23255,23063,22871,22679,22488,22298,22107,21917,21728,21539,21350,21162,20974,20787,20600,20413, 20227,20042,19857,19672,19488,19305,19122,18939,18757,18576,18395,18214,18035,17855,17676,17498, 17321,17144,16967,16791,16616,16442,16268,16094,15921,15749,15578,15407,15237,15067,14898,14730, 14563,14396,14230,14064,13900,13736,13572,13410,13248,13087,12926,12767,12608,12450,12292,12136, 11980,11825,11671,11517,11365,11213,11062,10912,10762,10614,10466,10319,10173,10028,9884,9740, 9597,9456,9315,9175,9036,8898,8760,8624,8488,8354,8220,8088,7956,7825,7695,7566, 7438,7311,7185,7060,6936,6812,6690,6569,6449,6329,6211,6094,5978,5862,5748,5635, 5523,5411,5301,5192,5084,4977,4871,4766,4662,4559,4458,4357,4257,4159,4061,3965, 3869,3775,3682,3590,3499,3409,3321,3233,3146,3061,2977,2894,2812,2731,2651,2572, 2495,2418,2343,2269,2196,2124,2054,1984,1916,1849,1783,1718,1654,1592,1530,1470, 1411,1354,1297,1242,1187,1134,1083,1032,982,934,887,841,797,753,711,670, 630,591,554,518,483,449,417,385,355,326,299,272,247,223,200,179, 158,139,121,105,89,75,62,50,40,31,23,16,10,6,3,1, 1,1,3,6,10,16,23,31,40,50,62,75,89,105,121,139, 158,179,200,223,247,272,299,326,355,385,417,449,483,518,554,591, 630,670,711,753,797,841,887,934,982,1032,1083,1134,1187,1242,1297,1354, 1411,1470,1530,1592,1654,1718,1783,1849,1916,1984,2054,2124,2196,2269,2343,2418, 2495,2572,2651,2731,2812,2894,2977,3061,3146,3233,3321,3409,3499,3590,3682,3775, 3869,3965,4061,4159,4257,4357,4458,4559,4662,4766,4871,4977,5084,5192,5301,5411, 5523,5635,5748,5862,5978,6094,6211,6329,6449,6569,6690,6812,6936,7060,7185,7311, 7438,7566,7695,7825,7956,8088,8220,8354,8488,8624,8760,8898,9036,9175,9315,9456, 9597,9740,9884,10028,10173,10319,10466,10614,10762,10912,11062,11213,11365,11517,11671,11825, 11980,12136,12292,12450,12608,12767,12926,13087,13248,13410,13572,13736,13900,14064,14230,14396, 14563,14730,14898,15067,15237,15407,15578,15749,15921,16094,16268,16442,16616,16791,16967,17144, 17321,17498,17676,17855,18035,18214,18395,18576,18757,18939,19122,19305,19488,19672,19857,20042, 20227,20413,20600,20787,20974,21162,21350,21539,21728,21917,22107,22298,22488,22679,22871,23063, 23255,23448,23641,23834,24027,24221,24416,24610,24805,25000,25196,25391,25587,25784,25980,26177, 26374,26571,26769,26967,27165,27363,27561,27760,27959,28158,28357,28556,28756,28955,29155,29355, 29555,29755,29955,30156,30356,30557,30757,30958,31159,31360,31560,31761,31962,32163,32364,32565, };