#pragma once // ============================================================================ // NodeSimulator - virtual nodes that generate sample audio in software. // // Implements NodeSource so the CollectionService feeds simulated PCM through // the exact same path as real UDP nodes. Each virtual node emits a distinct // sine tone per mic plus a small DC marker per node, so channel -> track // mapping is easy to verify in the WAV on a PC. // // Enable/disable with NET_SIM_ENABLED (network_config.h). Use the simulator // OR real nodes, not both (node IDs would collide). // ============================================================================ #include "../services/service.h" #include "../core/node_registry.h" #include "collection_service.h" #include "network_config.h" class NodeSimulator : public Service, public NodeSource { public: NodeSimulator(NodeRegistry& registry, RecordingController& recorder); void begin() override; void update() override; // NodeSource size_t readAudio(uint8_t nodeId, uint8_t* out, size_t maxBytes) override; private: static float baseFrequency(uint8_t nodeId); NodeRegistry& nodes; RecordingController& recorder; uint32_t lastCallMs[NET_SIM_NODES]; float phase[NET_SIM_NODES][NET_MICS_PER_NODE]; };