mirror of
https://codeberg.org/armin/beamgrid.git
synced 2026-09-01 04:10:47 +02:00
Add TILT spectral-tilt knob plus grid zoom/fade and curving controls
- TILT knob (-1..1, 0=flat) boosts highs / cuts lows about the log-frequency centre so high frequencies become more visible in the display - Add GRID ZOOM, GRID FADE, and CURVING knobs; refine BARS/LEDS snapping - Fix README MODE knob placement description
This commit is contained in:
parent
b6bdc73488
commit
ca9555af13
7 changed files with 176 additions and 15 deletions
|
|
@ -51,12 +51,33 @@ BeamgridAudioProcessor::createParameterLayout()
|
|||
juce::NormalisableRange<float> (0.0f, 1.0f, 0.001f), 0.32f,
|
||||
juce::AudioParameterFloatAttributes().withLabel ("")));
|
||||
|
||||
params.push_back (std::make_unique<juce::AudioParameterFloat>(
|
||||
"gridzoom", "Grid Zoom",
|
||||
juce::NormalisableRange<float> (0.98f, 1.02f, 0.001f), 1.0f,
|
||||
juce::AudioParameterFloatAttributes().withLabel ("")));
|
||||
|
||||
params.push_back (std::make_unique<juce::AudioParameterFloat>(
|
||||
"gridfade", "Grid Fade",
|
||||
juce::NormalisableRange<float> (0.0f, 1.0f, 0.001f), 0.0f,
|
||||
juce::AudioParameterFloatAttributes().withLabel ("")));
|
||||
|
||||
params.push_back (std::make_unique<juce::AudioParameterFloat>(
|
||||
"curving", "Curving",
|
||||
juce::NormalisableRange<float> (0.0f, 1.0f, 0.001f), 0.0f,
|
||||
juce::AudioParameterFloatAttributes().withLabel ("")));
|
||||
|
||||
params.push_back (std::make_unique<juce::AudioParameterFloat>(
|
||||
"tilt", "Tilt",
|
||||
juce::NormalisableRange<float> (-1.0f, 1.0f, 0.001f), 0.0f,
|
||||
juce::AudioParameterFloatAttributes().withLabel ("")));
|
||||
|
||||
juce::NormalisableRange<float> barsRange (8.0f, 128.0f,
|
||||
[] (float start, float end, float v) { return start + v * (end - start); }, // convertFrom0To1
|
||||
[] (float start, float end, float v) { return (v - start) / (end - start); }, // convertTo0To1
|
||||
[] (float, float, float v) // snapToLegalValue
|
||||
{
|
||||
const float steps[] = { 8.0f, 16.0f, 32.0f, 64.0f, 128.0f };
|
||||
const float steps[] = { 8.0f, 16.0f, 24.0f, 32.0f, 40.0f, 48.0f, 56.0f, 64.0f,
|
||||
72.0f, 80.0f, 88.0f, 96.0f, 104.0f, 112.0f, 120.0f, 128.0f };
|
||||
float best = steps[0];
|
||||
float bestDist = std::abs (v - best);
|
||||
for (float s : steps)
|
||||
|
|
@ -77,8 +98,29 @@ BeamgridAudioProcessor::createParameterLayout()
|
|||
params.push_back (std::make_unique<juce::AudioParameterInt>(
|
||||
"mode", "Mode", 1, 3, 1));
|
||||
|
||||
params.push_back (std::make_unique<juce::AudioParameterInt>(
|
||||
"leds", "LEDs/Bar", 4, 48, 16));
|
||||
juce::NormalisableRange<float> ledsRange (4.0f, 48.0f,
|
||||
[] (float start, float end, float v) { return start + v * (end - start); }, // convertFrom0To1
|
||||
[] (float start, float end, float v) { return (v - start) / (end - start); }, // convertTo0To1
|
||||
[] (float, float, float v) // snapToLegalValue
|
||||
{
|
||||
const float steps[] = { 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f,
|
||||
28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f };
|
||||
float best = steps[0];
|
||||
float bestDist = std::abs (v - best);
|
||||
for (float s : steps)
|
||||
{
|
||||
const float dist = std::abs (v - s);
|
||||
if (dist < bestDist)
|
||||
{
|
||||
bestDist = dist;
|
||||
best = s;
|
||||
}
|
||||
}
|
||||
return best;
|
||||
});
|
||||
|
||||
params.push_back (std::make_unique<juce::AudioParameterFloat>(
|
||||
"leds", "LEDs/Bar", ledsRange, 16.0f));
|
||||
|
||||
return { params.begin(), params.end() };
|
||||
}
|
||||
|
|
@ -107,6 +149,8 @@ void BeamgridAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer,
|
|||
{
|
||||
juce::ScopedNoDenormals noDenormals;
|
||||
|
||||
analyser.setTilt (*params.getRawParameterValue ("tilt"));
|
||||
|
||||
// Analyse the first channel; pass the audio through unchanged.
|
||||
if (buffer.getNumChannels() > 0)
|
||||
analyser.push (buffer.getReadPointer (0), buffer.getNumSamples());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue