memlnaut-nisps/nisps/engines/base.hpp
w1n5t0n 5cd5041b6a fix: NoOpEngine engine_id → 'thru' to match sound_analysis_midi schema
Stream 3's NoOpEngine used engine_id()=='noop' but the schema for
sound_analysis_midi.json declares engine_id: 'thru' (matches firmware's
ThruAudioApp naming). The class name stays NoOpEngine — it accurately
describes what process() does — but the schema-facing identifier is now
'thru'. BreakOr/Elysiamorf compose NoOpEngine by type, not engine_id, so
they're unaffected.
2026-04-29 16:12:12 +03:00

43 lines
1.4 KiB
C++

// nisps/engines/base.hpp — common building blocks for AudioEngine
// implementations.
//
// Includes:
// - NoOpEngine: silent passthrough. Two uses:
// (1) the standalone "thru" engine for the SoundAnalysisMIDI mode (audio
// is analysed but not synthesised), exposed via engine_id()=="thru";
// (2) composed inside sequencer-only engines (BreakOr, Elysiamorf) whose
// MIDI/I2C event emission lives outside the audio path. Internal
// composition uses the type directly, not the engine_id lookup.
// - Helper macros / static_asserts to verify each concrete engine satisfies
// `nisps::AudioEngine` at compile time.
#pragma once
#include <cstddef>
#include <span>
#include <string_view>
#include "../core/concepts.hpp"
#include "../core/perf.hpp"
#include "../core/types.hpp"
namespace nisps {
class NoOpEngine {
public:
static constexpr std::size_t param_count() noexcept { return 0u; }
static constexpr std::string_view engine_id() noexcept { return "thru"; }
void setup(float /*sample_rate*/) noexcept {}
void set_params(std::span<const float> /*params*/) noexcept {}
NISPS_HOT NISPS_FORCE_INLINE stereosample_t process(stereosample_t /*x*/) noexcept {
return {0.f, 0.f};
}
DriverConfig driver_config() const noexcept { return {}; }
};
static_assert(AudioEngine<NoOpEngine>, "NoOpEngine must satisfy AudioEngine");
} // namespace nisps