memlnaut-nisps/codegen/tests/golden/paf_synth_schema.hpp

368 lines
6.6 KiB
C++
Raw Normal View History

// AUTOGENERATED — do not edit. Source: schemas/modes/paf_synth.json. Run `bun run codegen/generate.ts` to regenerate.
#ifndef NISPS_GENERATED_PAF_SYNTH_SCHEMA_HPP
#define NISPS_GENERATED_PAF_SYNTH_SCHEMA_HPP
#include "schema_types.hpp"
refactor(codegen): codegen owns mode identity, per-mode schemas and net dims Phase 3 (S1, S5, S6, S25, L11, L37, ST11, ST12). Behaviour-preserving by construction: the diff on the generated directories is PURELY ADDITIVE (217 insertions, 0 deletions), so no emitted constant changed value. This moves where truth lives; it does not change what truth says. - S5: nine mode headers each carried a mechanically identical 12-field positional ParamSchema aggregate. codegen now emits one `inline constexpr ParamSchema k<Mode>Schema` per mode, and the struct itself moved into generated/schema_types.hpp. Each param_schema() is a one-line return. - S6 + S25: every mode hand-typed its net shape a second time as MLP template args, duplicating the schema's own dims. codegen emits a `<Mode>MLP` alias built from the already-emitted constants (not re-literalled), and all nine modes use it. NMaxExamples still defaults from kDefaultMaxExamples (Phase 2). - S1: model.ts hand-imported all nine schemas by name and hand-paired each with its overlay — so the SET of modes was hand-maintained and could silently drift from codegen. codegen now emits ALL_MODE_SCHEMAS; SCHEMA_MODE_OVERLAYS is purely display truth (label/glyph/css/order), which stays hand-curated. - L37: deleted the hand-written modeEngineId switch, which duplicated schema.engine_id and silently defaulted unknown modes to 'thru'. Routes on MFMode.engineId with exactly one documented exception: sound_analysis_midi declares engine_id 'thru' because its ModeBase audio slot really is NoOpEngine, while it separately drives the real AnalysisEngine. - L11: ExternalSynthMIDIMode's shape was literal in two places; now named once in an ext_synth_defaults namespace with an ExtSynthMIDIMLP alias. Full folding into the JSON pipeline is NOT done and the reason is recorded in-file: it is a template family over an externally-supplied Device and variable NOut, with no single (device, NOut) schema to author. - ST12: extracted codegen/lib.ts for the helpers both generators duplicated, and corrected the comment that claimed they had to be separate. Proof the extraction was behaviour-free: regenerating the MIDI-device outputs produces a byte-identical tree. - ST11: deleted codegen/templates/ — dead "reference" files no generator reads, already drifted from the real emitters. Gates: run-all-tests.sh ALL GREEN; codegen idempotent (re-running both generators yields no further diff), which is what CI's dirty-diff gate checks.
2026-07-21 14:02:23 +02:00
#include "../../ml/mlp.hpp"
namespace nisps::modes::generated {
inline constexpr std::string_view kPafSynthModeId = "paf_synth";
inline constexpr std::string_view kPafSynthEngineId = "paf_synth";
inline constexpr std::array<std::string_view, 4> kPafSynthInputChannels = {{
"joy_x",
"joy_y",
"joy_z",
"joy_w",
}};
inline constexpr std::array<std::size_t, 3> kPafSynthHiddenLayers = {{
10u,
10u,
14u,
}};
inline constexpr MLConfig kPafSynthMLConfig = {
4u,
33u,
0.6f,
};
inline constexpr std::size_t kPafSynthParamCount = 33u;
inline constexpr std::array<Param, kPafSynthParamCount> kPafSynthParams = {{
Param{
"p00",
"Param 00",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"p01",
"Param 01",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"paf0_cf",
"PAF0 Center Freq",
0.0f,
1.0f,
0.5f,
Curve::linear,
"operators",
},
Param{
"paf1_cf",
"PAF1 Center Freq",
0.0f,
1.0f,
0.5f,
Curve::linear,
"operators",
},
Param{
"p04",
"Param 04",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"paf0_bw",
"PAF0 Bandwidth",
0.0f,
1.0f,
0.5f,
Curve::linear,
"operators",
},
Param{
"paf1_bw",
"PAF1 Bandwidth",
0.0f,
1.0f,
0.5f,
Curve::linear,
"operators",
},
Param{
"p07",
"Param 07",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"paf0_vib",
"PAF0 Vibrato Depth",
0.0f,
1.0f,
0.0f,
Curve::square,
"modulation",
},
Param{
"paf1_vib",
"PAF1 Vibrato Depth",
0.0f,
1.0f,
0.0f,
Curve::square,
"modulation",
},
Param{
"p10",
"Param 10",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"paf0_vfr",
"PAF0 Vibrato Rate",
0.0f,
1.0f,
0.5f,
Curve::square,
"modulation",
},
Param{
"paf1_vfr",
"PAF1 Vibrato Rate",
0.0f,
1.0f,
0.5f,
Curve::square,
"modulation",
},
Param{
"p13",
"Param 13",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"paf0_shift",
"PAF0 Shift",
0.0f,
1.0f,
0.5f,
Curve::linear,
"operators",
},
Param{
"paf1_shift",
"PAF1 Shift",
0.0f,
1.0f,
0.5f,
Curve::linear,
"operators",
},
Param{
"p16",
"Param 16",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"dl1mix",
"Delay Mix",
0.0f,
1.0f,
0.0f,
Curve::square,
"delay",
},
Param{
"p18",
"Param 18",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"dlfb",
"Delay Feedback",
0.0f,
1.0f,
0.5f,
Curve::linear,
"delay",
},
Param{
"env_decay",
"Env Decay",
0.0f,
1.0f,
0.3f,
Curve::square,
"envelope",
},
Param{
"p21",
"Param 21",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"p22",
"Param 22",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"p23",
"Param 23",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"p24",
"Param 24",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"p25",
"Param 25",
0.0f,
1.0f,
0.5f,
Curve::linear,
"general",
},
Param{
"shape_gain",
"Sine Shape Gain",
0.0f,
1.0f,
0.0f,
Curve::square,
"shaper",
},
Param{
"shape_asym",
"Sine Shape Asym",
0.0f,
1.0f,
0.0f,
Curve::square,
"shaper",
},
Param{
"shape_mix",
"Sine Shape Mix",
0.0f,
1.0f,
0.0f,
Curve::linear,
"shaper",
},
Param{
"rm_gain",
"Ring Mod Gain",
0.0f,
1.0f,
0.0f,
Curve::square,
"shaper",
},
Param{
"env_attack",
"Env Attack",
0.0f,
1.0f,
0.0f,
Curve::linear,
"envelope",
},
Param{
"env_sustain",
"Env Sustain",
0.0f,
1.0f,
0.5f,
Curve::linear,
"envelope",
},
Param{
"env_release",
"Env Release",
0.0f,
1.0f,
0.3f,
Curve::linear,
"envelope",
},
}};
inline constexpr std::size_t kPafSynthVoiceSpaceCount = 7u;
inline constexpr std::array<std::string_view, kPafSynthVoiceSpaceCount> kPafSynthVoiceSpaces = {{
"Ellipticacacia",
"Rowantares",
"Neemeda",
"Aquillow",
"Magnetarch",
"Elderstar",
"Ipeleiades",
}};
inline constexpr UIConfig kPafSynthUI = {
PrimaryInput::XYPad,
true,
true,
};
refactor(codegen): codegen owns mode identity, per-mode schemas and net dims Phase 3 (S1, S5, S6, S25, L11, L37, ST11, ST12). Behaviour-preserving by construction: the diff on the generated directories is PURELY ADDITIVE (217 insertions, 0 deletions), so no emitted constant changed value. This moves where truth lives; it does not change what truth says. - S5: nine mode headers each carried a mechanically identical 12-field positional ParamSchema aggregate. codegen now emits one `inline constexpr ParamSchema k<Mode>Schema` per mode, and the struct itself moved into generated/schema_types.hpp. Each param_schema() is a one-line return. - S6 + S25: every mode hand-typed its net shape a second time as MLP template args, duplicating the schema's own dims. codegen emits a `<Mode>MLP` alias built from the already-emitted constants (not re-literalled), and all nine modes use it. NMaxExamples still defaults from kDefaultMaxExamples (Phase 2). - S1: model.ts hand-imported all nine schemas by name and hand-paired each with its overlay — so the SET of modes was hand-maintained and could silently drift from codegen. codegen now emits ALL_MODE_SCHEMAS; SCHEMA_MODE_OVERLAYS is purely display truth (label/glyph/css/order), which stays hand-curated. - L37: deleted the hand-written modeEngineId switch, which duplicated schema.engine_id and silently defaulted unknown modes to 'thru'. Routes on MFMode.engineId with exactly one documented exception: sound_analysis_midi declares engine_id 'thru' because its ModeBase audio slot really is NoOpEngine, while it separately drives the real AnalysisEngine. - L11: ExternalSynthMIDIMode's shape was literal in two places; now named once in an ext_synth_defaults namespace with an ExtSynthMIDIMLP alias. Full folding into the JSON pipeline is NOT done and the reason is recorded in-file: it is a template family over an externally-supplied Device and variable NOut, with no single (device, NOut) schema to author. - ST12: extracted codegen/lib.ts for the helpers both generators duplicated, and corrected the comment that claimed they had to be separate. Proof the extraction was behaviour-free: regenerating the MIDI-device outputs produces a byte-identical tree. - ST11: deleted codegen/templates/ — dead "reference" files no generator reads, already drifted from the real emitters. Gates: run-all-tests.sh ALL GREEN; codegen idempotent (re-running both generators yields no further diff), which is what CI's dirty-diff gate checks.
2026-07-21 14:02:23 +02:00
using PafSynthMLP = ::nisps::ml::MLP<kPafSynthMLConfig.input_size, kPafSynthHiddenLayers[0], kPafSynthHiddenLayers[1], kPafSynthHiddenLayers[2], kPafSynthMLConfig.output_size>;
inline constexpr ::nisps::ParamSchema kPafSynthSchema = {
kPafSynthModeId,
kPafSynthEngineId,
std::span<const std::string_view>(kPafSynthInputChannels),
kPafSynthMLConfig.input_size,
std::span<const std::size_t>(kPafSynthHiddenLayers),
kPafSynthMLConfig.output_size,
kPafSynthMLConfig.default_spread,
std::span<const Param>(kPafSynthParams),
std::span<const std::string_view>(kPafSynthVoiceSpaces),
kPafSynthUI,
};
} // namespace nisps::modes::generated
#endif // NISPS_GENERATED_PAF_SYNTH_SCHEMA_HPP