Files
NeuralSynth/Source/NeuralSharedParams.h
2025-10-12 16:41:38 +01:00

131 lines
5.0 KiB
C++

/*
==============================================================================
NeuralSharedParams.h
Created: 21 Jun 2025 7:53:02am
Author: timot
==============================================================================
*/
#pragma once
#include <atomic>
struct SliderDetail {
std::string label;
float min, max, interval, defValue;
};
typedef std::unordered_map <std::string, SliderDetail> ParamMap;
// Each SliderDetail: { label, min, max, step, defaultValue }
const std::unordered_map<std::string, ParamMap> PARAM_SETTINGS = {
{ "chorus", {
{ "rate", { "Rate", 0.0f, 1.0f, 0.1f, 0.1f } }, // Modulation speed
{ "depth", { "Depth", 0.0f, 1.0f, 0.1f, 0.1f } }, // Modulation amount
{ "centre", { "Centre", 0.0f, 1.0f, 0.1f, 0.1f } }, // Center delay
{ "feedback", { "Feedback", 0.0f, 1.0f, 0.1f, 0.1f } }, // Feedback amount
{ "mix", { "Mix", 0.0f, 1.0f, 0.1f, 0.1f } } // Dry/wet blend
}},
{ "delay", {
{ "delay", { "Delay", 0.0f, 1.0f, 0.1f, 0.1f } } // Delay time
}},
{ "reverb", {
{ "roomSize", { "Room Size", 0.0f, 1.0f, 0.1f, 0.1f } }, // Size of reverb space
{ "damping", { "Damping", 0.0f, 1.0f, 0.1f, 0.1f } }, // High-frequency attenuation
{ "wetLevel", { "Wet Level", 0.0f, 1.0f, 0.1f, 0.1f } }, // Reverb amount
{ "dryLevel", { "Dry Level", 0.0f, 1.0f, 0.1f, 0.1f } }, // Dry signal amount
{ "width", { "Width", 0.0f, 1.0f, 0.1f, 0.1f } }, // Stereo width
{ "freezeMode", { "Freeze Mode", 0.0f, 1.0f, 0.1f, 0.1f } } // Infinite decay toggle
}},
{ "adsr", {
{ "attack", { "Attack", 0.0f, 1.0f, 0.1f, 0.1f } }, // Attack time
{ "decay", { "Decay", 0.0f, 1.0f, 0.1f, 0.1f } }, // Decay time
{ "sustain", { "Sustain", 0.0f, 1.0f, 0.1f, 0.1f } }, // Sustain level
{ "release", { "Release", 0.0f, 1.0f, 0.1f, 0.1f } } // Release time
}},
{ "flanger", {
{ "rate", { "Rate", 0.1f, 5.0f, 0.1f, 0.1f } }, // LFO speed
{ "depth", { "Depth", 0.1f, 10.0f, 0.1f, 0.1f } }, // Mod depth in ms
{ "feedback", { "Feedback", 0.0f, 1.0f, 0.1f, 0.1f } }, // Feedback amount
{ "dryMix", { "Dry/Wet", 0.0f, 1.0f, 0.1f, 0.1f } }, // Mix control
{ "phase", { "Phase", 0.0f, 1.0f, 0.1f, 0.1f } }, // LFO phase offset (for stereo)
{ "delay", { "Delay", 0.0f, 3.0f, 0.1f, 0.1f } } // Base delay offset
}},
{ "filter", {
{ "cutoff", { "Cutoff", 0.2f, 20000.0f, 1.0f, 1000.0f } }, // Frequency cutoff
{ "resonance", { "Resonance", 0.1f, 10.0f, 0.1f, 0.2f } }, // Resonance/Q factor
{ "type", { "L/H/B", 0.0f, 2.0f, 1.0f, 0.0f } }, // 0 = LPF, 1 = HPF, 2 = BPF
{ "drive", { "Drive", 0.0f, 1.0f, 0.01f, 0.0f } }, // Pre-gain into filter
{ "mod", { "Mod", -1.0f, 1.0f, 0.1f, 0.0f } }, // Modulation amount
{ "key", { "Key", 0.0f, 1.0f, 0.1f, 0.0f } } // Key tracking
}},
{ "distortion", {
{ "drive", { "Drive", 0.0f, 30.0f, 0.1f, 10.0f } }, // Input gain before shaping
{ "mix", { "Mix", 0.0f, 1.0f, 0.01f, 0.5f } }, // Wet/dry blend
{ "bias", { "Bias", -1.0f, 1.0f, 0.01f, 0.0f } }, // DC offset
{ "tone", { "Tone", 100.0f, 8000.0f, 10.0f, 3000.0f } }, // LPF after distortion
{ "shape", { "Shape", 0.0f, 2.0f, 1.0f, 0.0f } } // 0=tanh, 1=hard clip, 2=atan
}}
};
struct NeuralSharedParams
{
std::atomic<int> waveform{ -1 };
std::atomic<float>* adsrAttack;
std::atomic<float>* adsrDecay;
std::atomic<float>* adsrSustain;
std::atomic<float>* adsrRelease;
std::atomic<float>* delayTime;
std::atomic<float>* chorusRate;
std::atomic<float>* chorusDepth;
std::atomic<float>* chorusCentre;
std::atomic<float>* chorusFeedback;
std::atomic<float>* chorusMix;
std::atomic<float>* reverbRoomSize;
std::atomic<float>* reverbDamping;
std::atomic<float>* reverbWetLevel;
std::atomic<float>* reverbDryLevel;
std::atomic<float>* reverbWidth;
std::atomic<float>* reverbFreezeMode;
std::atomic<float>* flangerRate;
std::atomic<float>* flangerDepth;
std::atomic<float>* flangerFeedback;
std::atomic<float>* flangerDryMix;
std::atomic<float>* flangerPhase;
std::atomic<float>* flangerDelay;
std::atomic<float>* filterCutoff;
std::atomic<float>* filterResonance;
std::atomic<float>* filterType;
std::atomic<float>* filterDrive;
std::atomic<float>* filterMod;
std::atomic<float>* filterKey;
std::atomic<float>* distortionDrive;
std::atomic<float>* distortionMix;
std::atomic<float>* distortionBias;
std::atomic<float>* distortionTone;
std::atomic<float>* distortionShape;
std::atomic<float>* lowGainDbls;
std::atomic<float>* midGainDbls;
std::atomic<float>* highGainDbls;
std::atomic<float>* masterDbls;
};