Switch from 44.1kHz to 48kHz, turn on CAN loopback

This commit is contained in:
Aadi Desai 2023-06-28 10:25:30 +01:00
parent 168b093445
commit 2d765f904a
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM

View file

@ -9,7 +9,7 @@
#pragma region Globals(Config values, Variables, Objects, Types, etc.) #pragma region Globals(Config values, Variables, Objects, Types, etc.)
// Config values // Config values
const uint32_t interval = 10; // Display update interval const uint32_t interval = 10; // Display update interval
const uint32_t samplingRate = 44100; // Sampling rate const uint32_t samplingRate = 48000; // Sampling rate
const uint32_t canID = 0x123; const uint32_t canID = 0x123;
// Variables // Variables
std::atomic<bool> isMainSynth; std::atomic<bool> isMainSynth;
@ -30,11 +30,11 @@ int32_t bufferB[220];
// Objects // Objects
U8G2_SSD1305_128X32_NONAME_F_HW_I2C u8g2(U8G2_R0); // Display Driver Object U8G2_SSD1305_128X32_NONAME_F_HW_I2C u8g2(U8G2_R0); // Display Driver Object
Knob K0(1, 7, 4); // Octave Knob Object Knob K0(1, 7, 4); // Octave Knob Object
Knob K1(0, 3, 1); // Waveform Knob Object Knob K1(0, 3, 2); // Waveform Knob Object
Knob K2(0, 1); // Send / Receive Knob Object Knob K2(0, 1); // Send / Receive Knob Object
Knob K3(0, 16); // Volume Knob Object Knob K3(0, 16, 2); // Volume Knob Object
// Program Specific Structures // Program Specific Structures
const int32_t stepSizes[85] = {0, 3185014, 3374405, 3575058, 3787642, 4012867, 4251484, 4504291, 4772130, 5055895, 5356535, 5675051, 6012507, 6370029, 6748811, 7150116, 7575284, 8025734, 8502969, 9008582, 9544260, 10111791, 10713070, 11350102, 12025014, 12740059, 13497622, 14300233, 15150569, 16051469, 17005939, 18017164, 19088521, 20223583, 21426140, 22700205, 24050029, 25480118, 26995245, 28600466, 30301138, 32102938, 34011878, 36034329, 38177042, 40447167, 42852281, 45400410, 48100059, 50960237, 53990491, 57200933, 60602277, 64205876, 68023756, 72068659, 76354085, 80894335, 85704562, 90800821, 96200119, 101920475, 107980982, 114401866, 121204555, 128411753, 136047513, 144137319, 152708170, 161788670, 171409125, 181601642, 192400238, 203840951, 215961965, 228803732, 242409110, 256823506, 272095026, 288274638, 305416340, 323577341, 342818251, 363203285, 384800476}; const int32_t stepSizes[85] = {0, 2926231, 3100234, 3284584, 3479896, 3686821, 3906050, 4138317, 4384394, 4645103, 4921316, 5213953, 5523990, 5852464, 6200470, 6569169, 6959792, 7373643, 7812102, 8276634, 8768788, 9290207, 9842633, 10427906, 11047981, 11704929, 12400940, 13138339, 13919585, 14747287, 15624206, 16553269, 17537578, 18580416, 19685266, 20855813, 22095964, 23409858, 24801881, 26276678, 27839170, 29494574, 31248412, 33106539, 35075157, 37160834, 39370533, 41711626, 44191929, 46819717, 49603763, 52553357, 55678341, 58989148, 62496825, 66213080, 70150315, 74321670, 78741066, 83423254, 88383859, 93639436, 99207527, 105106714, 111356684, 117978298, 124993652, 132426161, 140300631, 148643340, 157482133, 166846508, 176767718, 187278873, 198415055, 210213428, 222713369, 235956596, 249987305, 264852323, 280601262, 297286682, 314964268, 333693018, 353535437};
const char *notes[85] = {"None", "C1", "C1#", "D1", "D1#", "E1", "F1", "F1#", "G1", "G1#", "A1", "A1#", "B1", "C2", "C2#", "D2", "D2#", "E2", "F2", "F2#", "G2", "G2#", "A2", "A2#", "B2", "C3", "C3#", "D3", "D3#", "E3", "F3", "F3#", "G3", "G3#", "A3", "A3#", "B3", "C4", "C4#", "D4", "D4#", "E4", "F4", "F4#", "G4", "G4#", "A4", "A4#", "B4", "C5", "C5#", "D5", "D5#", "E5", "F5", "F5#", "G5", "G5#", "A5", "A5#", "B5", "C6", "C6#", "D6", "D6#", "E6", "F6", "F6#", "G6", "G6#", "A6", "A6#", "B6", "C7", "C7#", "D7", "D7#", "E7", "F7", "F7#", "G7", "G7#", "A7", "A7#", "B7"}; const char *notes[85] = {"None", "C1", "C1#", "D1", "D1#", "E1", "F1", "F1#", "G1", "G1#", "A1", "A1#", "B1", "C2", "C2#", "D2", "D2#", "E2", "F2", "F2#", "G2", "G2#", "A2", "A2#", "B2", "C3", "C3#", "D3", "D3#", "E3", "F3", "F3#", "G3", "G3#", "A3", "A3#", "B3", "C4", "C4#", "D4", "D4#", "E4", "F4", "F4#", "G4", "G4#", "A4", "A4#", "B4", "C5", "C5#", "D5", "D5#", "E5", "F5", "F5#", "G5", "G5#", "A5", "A5#", "B5", "C6", "C6#", "D6", "D6#", "E6", "F6", "F6#", "G6", "G6#", "A6", "A6#", "B6", "C7", "C7#", "D7", "D7#", "E7", "F7", "F7#", "G7", "G7#", "A7", "A7#", "B7"};
std::atomic<bool> activeNotes[85] = {{0}}; std::atomic<bool> activeNotes[85] = {{0}};
enum waveform { enum waveform {
@ -384,7 +384,7 @@ void setup() {
#pragma endregion #pragma endregion
#pragma region CAN Setup #pragma region CAN Setup
msgInQ = xQueueCreate(36, 8); msgInQ = xQueueCreate(36, 8);
CAN_Init(false); CAN_Init(true);
setCANFilter(canID, 0x7fc); // Mask last 2 bits setCANFilter(canID, 0x7fc); // Mask last 2 bits
CAN_RegisterRX_ISR(CAN_RX_ISR); CAN_RegisterRX_ISR(CAN_RX_ISR);
CAN_Start(); CAN_Start();