Optimization: grid processing array

This commit is contained in:
Dejvino
2026-03-01 12:09:07 +01:00
parent 82bab0698b
commit 1047d846f9
4 changed files with 372 additions and 292 deletions
+6
View File
@@ -2,6 +2,8 @@
#define SYNTH_ENGINE_H
#include <stdint.h>
#include <vector>
#include <utility>
#if defined(ARDUINO_ARCH_RP2040)
#include <pico/mutex.h>
@@ -103,6 +105,7 @@ public:
float param = 0.5f; // 0.0 to 1.0
int rotation = 0; // 0:N, 1:E, 2:S, 3:W (Output direction)
float value = 0.0f; // Current output sample
float next_value = 0.0f; // For double-buffering in processGridStep
float phase = 0.0f; // For Oscillator, Noise state
};
@@ -113,6 +116,7 @@ public:
void exportGrid(uint8_t* buffer);
void importGrid(const uint8_t* buffer);
void loadPreset(int preset);
void rebuildProcessingOrder();
void clearGrid();
GridCell grid[GRID_W][GRID_H];
@@ -129,6 +133,8 @@ private:
Waveform _waveform;
bool _isGateOpen;
uint32_t _rngState;
std::vector<std::pair<int, int>> _processing_order;
void rebuildProcessingOrder_locked();
// Internal random number generator
float _random();