diff options
Diffstat (limited to 'src/uxn/devices/apu.c')
-rw-r--r-- | src/uxn/devices/apu.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/src/uxn/devices/apu.c b/src/uxn/devices/apu.c index 2b1c8ff..96b9058 100644 --- a/src/uxn/devices/apu.c +++ b/src/uxn/devices/apu.c | |||
@@ -1,32 +1,22 @@ | |||
1 | #define SAMPLE_FREQUENCY 44100 | 1 | // Calculated as (44100 << 12) / 18157 for C4 |
2 | #define NOTE_PERIOD (SAMPLE_FREQUENCY * 0x4000 / 11025) | 2 | static u32 pitch_table_44100[] = { |
3 | #define ADSR_STEP (SAMPLE_FREQUENCY / 0xf) | 3 | 310, 329, 348, 369, 391, 414, 439, 465, |
4 | 4 | 493, 522, 553, 586, 621, 658, 697, 739, | |
5 | static u16 pitch_table[] = { | 5 | 783, 829, 879, 931, 987, 1045, 1107, 1173, |
6 | 12173, 11490, 10845, 10237, 9662, 9120, 8608, 8125, | 6 | 1243, 1317, 1395, 1478, 1566, 1659, 1758, 1863, |
7 | 7669, 7238, 6832, 6448, 6086, 5745, 5422, 5118, | 7 | 1974, 2091, 2215, 2347, 2487, 2634, 2791, 2957, |
8 | 4831, 4560, 4304, 4062, 3834, 3619, 3416, 3224, | 8 | 3133, 3319, 3517, 3726, 3948, 4182, 4431, 4695, |
9 | 3043, 2872, 2711, 2559, 2415, 2280, 2152, 2031, | 9 | 4974, 5269, 5583, 5915, 6267, 6639, 7034, 7452, |
10 | 1917, 1809, 1708, 1612, 1521, 1436, 1355, 1279, | 10 | 7896, 8365, 8863, 9390, 9948, 10539, 11166, 11830, |
11 | 1207, 1140, 1076, 1015, 958, 904, 854, 806, | 11 | 12534, 13279, 14069, 14905, 15792, 16731, 17726, 18780, |
12 | 760, 718, 677, 639, 603, 570, 538, 507, | 12 | 19896, 21079, 22333, 23661, 25068, 26559, 28138, 29811, |
13 | 479, 452, 427, 403, 380, 359, 338, 319, | 13 | 31584, 33462, 35452, 37560, 39793, 42159, 44666, 47322, |
14 | 301, 285, 269, 253, 239, 226, 213, 201, | 14 | 50136, 53118, 56276, 59623, 63168, 66924, 70904, 75120, |
15 | 190, 179, 169, 159, 150, 142, 134, 126, | 15 | 79587, 84319, 89333, 94645, 100273, 106236, 112553, 119246, |
16 | 119, 113, 106, 100, 95, 89, 84, 79, | 16 | 126337, 133849, 141808, 150241, 159174, 168639, 178667, 189291, |
17 | 75, 71, 67, 63, 59, 56, 53, 50, | 17 | 200547, 212472, 225107, 238492, 252674, 267699, 283617, 300482, |
18 | 47, 44, 42, 39, 37, 35, 33, 31, | ||
19 | 29, 28, 26, 25, 23, 22, 21, 19, | ||
20 | 18, 17, 16, 15, 14, 14, 13, 12, | ||
21 | 2, | ||
22 | }; | 18 | }; |
23 | 19 | ||
24 | s8 square_wave[] = { | ||
25 | (s8)0x00 + (s8)0x80, (s8)0xFF + (s8)0x80 | ||
26 | }; | ||
27 | |||
28 | #include "text.h" | ||
29 | |||
30 | // | 20 | // |
31 | // REG_TM0D frequency buffer size | 21 | // REG_TM0D frequency buffer size |
32 | // | | | | 22 | // | | | |