memlnaut-nisps/nisps/modes/generated/breakor_schema.hpp

571 lines
9.8 KiB
C++
Raw Normal View History

// AUTOGENERATED — do not edit. Source: schemas/modes/breakor.json. Run `bun run codegen/generate.ts` to regenerate.
#ifndef NISPS_GENERATED_BREAKOR_SCHEMA_HPP
#define NISPS_GENERATED_BREAKOR_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 kBreakorModeId = "breakor";
inline constexpr std::string_view kBreakorEngineId = "breakor";
inline constexpr std::array<std::string_view, 4> kBreakorInputChannels = {{
"joy_x",
"joy_y",
"joy_z",
"joy_w",
}};
inline constexpr std::array<std::size_t, 3> kBreakorHiddenLayers = {{
10u,
14u,
18u,
}};
inline constexpr MLConfig kBreakorMLConfig = {
4u,
56u,
0.6f,
1.0f,
1000u,
};
inline constexpr std::size_t kBreakorParamCount = 56u;
inline constexpr std::array<Param, kBreakorParamCount> kBreakorParams = {{
Param{
"kick_ratio0",
"Kick Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"kick",
},
Param{
"kick_ratio1",
"Kick Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"kick",
},
Param{
"kick_ratio2",
"Kick Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"kick",
},
Param{
"kick_pmul",
"Kick Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"kick",
},
Param{
"kick_poff",
"Kick Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"kick",
},
Param{
"kick_amp0",
"Kick Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"kick",
},
Param{
"kick_amp1",
"Kick Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"kick",
},
Param{
"snare_ratio0",
"Snare Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"snare",
},
Param{
"snare_ratio1",
"Snare Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"snare",
},
Param{
"snare_ratio2",
"Snare Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"snare",
},
Param{
"snare_pmul",
"Snare Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"snare",
},
Param{
"snare_poff",
"Snare Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"snare",
},
Param{
"snare_amp0",
"Snare Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"snare",
},
Param{
"snare_amp1",
"Snare Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"snare",
},
Param{
"tom_ratio0",
"Tom Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"tom",
},
Param{
"tom_ratio1",
"Tom Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"tom",
},
Param{
"tom_ratio2",
"Tom Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"tom",
},
Param{
"tom_pmul",
"Tom Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"tom",
},
Param{
"tom_poff",
"Tom Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"tom",
},
Param{
"tom_amp0",
"Tom Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"tom",
},
Param{
"tom_amp1",
"Tom Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"tom",
},
Param{
"lowtom_ratio0",
"LowTom Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"lowtom",
},
Param{
"lowtom_ratio1",
"LowTom Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"lowtom",
},
Param{
"lowtom_ratio2",
"LowTom Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"lowtom",
},
Param{
"lowtom_pmul",
"LowTom Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"lowtom",
},
Param{
"lowtom_poff",
"LowTom Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"lowtom",
},
Param{
"lowtom_amp0",
"LowTom Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"lowtom",
},
Param{
"lowtom_amp1",
"LowTom Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"lowtom",
},
Param{
"rim_ratio0",
"Rim Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"rim",
},
Param{
"rim_ratio1",
"Rim Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"rim",
},
Param{
"rim_ratio2",
"Rim Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"rim",
},
Param{
"rim_pmul",
"Rim Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"rim",
},
Param{
"rim_poff",
"Rim Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"rim",
},
Param{
"rim_amp0",
"Rim Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"rim",
},
Param{
"rim_amp1",
"Rim Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"rim",
},
Param{
"hat_ratio0",
"Hat Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"hat",
},
Param{
"hat_ratio1",
"Hat Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"hat",
},
Param{
"hat_ratio2",
"Hat Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"hat",
},
Param{
"hat_pmul",
"Hat Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"hat",
},
Param{
"hat_poff",
"Hat Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"hat",
},
Param{
"hat_amp0",
"Hat Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"hat",
},
Param{
"hat_amp1",
"Hat Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"hat",
},
Param{
"ophat_ratio0",
"OpenHat Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"openhat",
},
Param{
"ophat_ratio1",
"OpenHat Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"openhat",
},
Param{
"ophat_ratio2",
"OpenHat Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"openhat",
},
Param{
"ophat_pmul",
"OpenHat Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"openhat",
},
Param{
"ophat_poff",
"OpenHat Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"openhat",
},
Param{
"ophat_amp0",
"OpenHat Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"openhat",
},
Param{
"ophat_amp1",
"OpenHat Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"openhat",
},
Param{
"perc_ratio0",
"Perc Ratio 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"perc",
},
Param{
"perc_ratio1",
"Perc Ratio 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"perc",
},
Param{
"perc_ratio2",
"Perc Ratio 2",
0.0f,
1.0f,
0.5f,
Curve::linear,
"perc",
},
Param{
"perc_pmul",
"Perc Phasor Mul",
0.0f,
1.0f,
0.0f,
Curve::linear,
"perc",
},
Param{
"perc_poff",
"Perc Phase Off",
0.0f,
1.0f,
0.0f,
Curve::linear,
"perc",
},
Param{
"perc_amp0",
"Perc Amp 0",
0.0f,
1.0f,
0.5f,
Curve::linear,
"perc",
},
Param{
"perc_amp1",
"Perc Amp 1",
0.0f,
1.0f,
0.5f,
Curve::linear,
"perc",
},
}};
inline constexpr std::size_t kBreakorVoiceSpaceCount = 0u;
inline constexpr std::array<std::string_view, 0> kBreakorVoiceSpaces = {};
inline constexpr UIConfig kBreakorUI = {
PrimaryInput::XYPad,
false,
false,
};
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 BreakorMLP = ::nisps::ml::MLP<kBreakorMLConfig.input_size, kBreakorHiddenLayers[0], kBreakorHiddenLayers[1], kBreakorHiddenLayers[2], kBreakorMLConfig.output_size>;
inline constexpr ::nisps::ParamSchema kBreakorSchema = {
kBreakorModeId,
kBreakorEngineId,
std::span<const std::string_view>(kBreakorInputChannels),
kBreakorMLConfig.input_size,
std::span<const std::size_t>(kBreakorHiddenLayers),
kBreakorMLConfig.output_size,
kBreakorMLConfig.default_spread,
kBreakorMLConfig.default_learning_rate,
kBreakorMLConfig.default_max_iterations,
std::span<const Param>(kBreakorParams),
std::span<const std::string_view>(kBreakorVoiceSpaces),
kBreakorUI,
};
} // namespace nisps::modes::generated
#endif // NISPS_GENERATED_BREAKOR_SCHEMA_HPP