#pragma once #include #include #include // Shared state between OSC thread and Writer thread. // Per-byte atomic array: worst-case small inter-byte tear between // a single LED's R/G/B is acceptable per Phase 16 D-07 (transient artifact, // resolves on next 11 ms tick). All stores are relaxed; no happens-before // is required because the Writer thread treats each tick as a fresh snapshot. class ParamMap { public: // led in [0..9], channel in [0..2] (R=0, G=1, B=2) void SetChannel(int led, int channel, float value01); void SetBrightness(float value01); // Copies 30 bytes into dst; worst-case small tear between bytes is acceptable per D-07. void SnapshotFrame(std::array& dst) const; uint8_t SnapshotBri() const; // Updates lastOscNs to now. Called after every valid OSC packet. void MarkOscArrived(); // Returns nanoseconds since last OSC; used by silence-fade (D-15). int64_t NsSinceLastOsc() const; private: std::array, 30> m_rgb{}; // 10 LEDs * 3 channels std::atomic m_bri{0}; std::atomic m_lastOscNs{0}; };