42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
|
|
// nisps/engines/base.hpp — common building blocks for AudioEngine
|
||
|
|
// implementations.
|
||
|
|
//
|
||
|
|
// Includes:
|
||
|
|
// - NoOpEngine: a silent passthrough used by sequencer-only modes
|
||
|
|
// (BreakOr, Elysiamorf). Their actual behaviour (MIDI/I2C event emission)
|
||
|
|
// lives in the engine wrapper outside the audio path; `process()` returns
|
||
|
|
// zeros so the audio driver has something to consume.
|
||
|
|
// - 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 "noop"; }
|
||
|
|
|
||
|
|
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
|