mirror of
https://codeberg.org/armin/terion.git
synced 2026-10-11 16:41:53 +02:00
Add mono toggle, wider scale dropdown, dynamic UI scaling
This commit is contained in:
parent
9ee92e515c
commit
d15e61b96f
6 changed files with 90 additions and 30 deletions
|
|
@ -29,6 +29,10 @@ TerionProcessor::TerionProcessor()
|
|||
std::make_unique<juce::AudioParameterBool>(
|
||||
juce::ParameterID{"freeze", 5},
|
||||
"Freeze",
|
||||
false),
|
||||
std::make_unique<juce::AudioParameterBool>(
|
||||
juce::ParameterID{"mono", 6},
|
||||
"Mono",
|
||||
false)
|
||||
})
|
||||
{
|
||||
|
|
@ -46,8 +50,10 @@ void TerionProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiB
|
|||
juce::ScopedNoDenormals noDenormals;
|
||||
|
||||
const int numSamples = buffer.getNumSamples();
|
||||
const float* left = buffer.getReadPointer(0);
|
||||
const float* right = buffer.getNumChannels() > 1 ? buffer.getReadPointer(1) : left;
|
||||
float* leftOut = buffer.getWritePointer(0);
|
||||
float* rightOut = buffer.getNumChannels() > 1 ? buffer.getWritePointer(1) : leftOut;
|
||||
const float* left = leftOut;
|
||||
const float* right = rightOut;
|
||||
|
||||
const float fadeTime = apvts.getRawParameterValue("fadeTime")->load();
|
||||
const float agePerSample = 1.0f / (fadeTime * static_cast<float>(getSampleRate()));
|
||||
|
|
@ -55,6 +61,18 @@ void TerionProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiB
|
|||
const float sensGain = juce::Decibels::decibelsToGain(apvts.getRawParameterValue("sensitivity")->load());
|
||||
const float smoothCoef = apvts.getRawParameterValue("smoothing")->load();
|
||||
const float frozen = apvts.getRawParameterValue("freeze")->load();
|
||||
const float mono = apvts.getRawParameterValue("mono")->load();
|
||||
|
||||
// Collapse to mono: sum L/R and duplicate into both channels
|
||||
if (mono > 0.5f && buffer.getNumChannels() > 1)
|
||||
{
|
||||
for (int i = 0; i < numSamples; ++i)
|
||||
{
|
||||
float m = (left[i] + right[i]) * 0.5f;
|
||||
leftOut[i] = m;
|
||||
rightOut[i] = m;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset metrics for this block
|
||||
sumMid = 0.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue