mirror of
https://codeberg.org/armin/horizont.git
synced 2026-09-01 04:10:46 +02:00
fix pitch feedback loop; tune analyzer UI and dry/wet reflection
This commit is contained in:
parent
b1b83104a7
commit
2359bfd579
5 changed files with 57 additions and 33 deletions
|
|
@ -10,7 +10,7 @@ namespace
|
|||
const juce::Colour wetFillCol (0xE63CE0C8);
|
||||
const juce::Colour wetPeakCol (0x883CE0C8);
|
||||
const juce::Colour dryLineCol (0xCCF0A03C);
|
||||
const juce::Colour dryFillCol (0x22F0A03C);
|
||||
const juce::Colour dryFillCol (0x66F0A03C);
|
||||
const juce::Colour dryPeakCol (0x55E89B3A);
|
||||
|
||||
juce::String formatFreq (float hz)
|
||||
|
|
@ -89,6 +89,19 @@ void SpectrumDisplay::timerCallback()
|
|||
computeLevels (wetBuf.getReadPointer (0), got, level);
|
||||
computeLevels (dryBuf.getReadPointer (0), fftSize, dryLevel);
|
||||
|
||||
float wetPeakDb = -200.0f;
|
||||
float dryPeakDb = -200.0f;
|
||||
for (int i = 0; i < numBins; ++i)
|
||||
{
|
||||
wetPeakDb = jmax (wetPeakDb, level[(size_t) i]);
|
||||
dryPeakDb = jmax (dryPeakDb, dryLevel[(size_t) i]);
|
||||
}
|
||||
|
||||
const float dryBoostDb = juce::jlimit (0.0f, 30.0f, wetPeakDb - dryPeakDb - 6.0f);
|
||||
if (dryBoostDb > 0.0f)
|
||||
for (int i = 0; i < numBins; ++i)
|
||||
dryLevel[(size_t) i] += dryBoostDb;
|
||||
|
||||
for (int i = 0; i < numBins; ++i)
|
||||
{
|
||||
const int lo = jmax (0, i - 1);
|
||||
|
|
@ -144,7 +157,7 @@ void SpectrumDisplay::paint (juce::Graphics& g)
|
|||
g.fillRoundedRectangle (bounds, 12.0f * s);
|
||||
|
||||
g.setColour (juce::Colour (0x3A3CE0C8));
|
||||
g.drawRoundedRectangle (bounds.expanded (1.0f * s), 13.0f * s, 1.0f * s);
|
||||
g.drawRoundedRectangle (bounds.expanded (1.0f * s), 16.0f * s, 1.0f * s);
|
||||
|
||||
g.setColour (juce::Colour (0x38FFFFFF));
|
||||
g.drawHorizontalLine (juce::roundToInt (bounds.getY() + 1.0f * s), juce::roundToInt (bounds.getX() + 3.0f * s), juce::roundToInt (bounds.getRight() - 3.0f * s));
|
||||
|
|
@ -155,7 +168,7 @@ void SpectrumDisplay::paint (juce::Graphics& g)
|
|||
|
||||
g.saveState();
|
||||
g.reduceClipRegion (bounds.toNearestInt().reduced (juce::roundToInt (1.0f * s)));
|
||||
auto refl = juce::ColourGradient (juce::Colour (0x28FFFFFF), { 0.0f, bounds.getY() },
|
||||
auto refl = juce::ColourGradient (juce::Colour (0x12FFFFFF), { 0.0f, bounds.getY() },
|
||||
juce::Colour (0x00FFFFFF), { 0.0f, bounds.getY() + bounds.getHeight() * 0.45f },
|
||||
false);
|
||||
g.setGradientFill (refl);
|
||||
|
|
@ -227,7 +240,7 @@ void SpectrumDisplay::paint (juce::Graphics& g)
|
|||
g.fillPath (wetFill);
|
||||
|
||||
auto dryGrad = juce::ColourGradient (dryFillCol, { 0.0f, graph.getY() },
|
||||
juce::Colour (0x00FFFFFF), { 0.0f, graph.getBottom() },
|
||||
juce::Colour (0x12F0A03C), { 0.0f, graph.getBottom() },
|
||||
false);
|
||||
g.setGradientFill (dryGrad);
|
||||
g.fillPath (dryFill);
|
||||
|
|
@ -235,6 +248,11 @@ void SpectrumDisplay::paint (juce::Graphics& g)
|
|||
g.setColour (wetPeakCol);
|
||||
g.strokePath (makeCurve (graph, peak), juce::PathStrokeType (1.0f * s));
|
||||
|
||||
g.setColour (wetLineCol);
|
||||
g.strokePath (curve, juce::PathStrokeType (1.4f * s,
|
||||
juce::PathStrokeType::JointStyle::curved,
|
||||
juce::PathStrokeType::EndCapStyle::rounded));
|
||||
|
||||
g.setColour (dryLineCol);
|
||||
g.strokePath (dry, juce::PathStrokeType (1.2f * s,
|
||||
juce::PathStrokeType::JointStyle::curved,
|
||||
|
|
@ -242,30 +260,20 @@ void SpectrumDisplay::paint (juce::Graphics& g)
|
|||
|
||||
g.setColour (dryPeakCol);
|
||||
g.strokePath (makeCurve (graph, dryPeak), juce::PathStrokeType (0.8f * s));
|
||||
|
||||
g.setColour (wetLineCol);
|
||||
g.strokePath (curve, juce::PathStrokeType (1.4f * s,
|
||||
juce::PathStrokeType::JointStyle::curved,
|
||||
juce::PathStrokeType::EndCapStyle::rounded));
|
||||
}
|
||||
|
||||
g.setColour (juce::Colour (0x66FFFFFF));
|
||||
g.setFont (juce::Font (juce::FontOptions (10.0f * s, juce::Font::bold)));
|
||||
g.drawText ("REVERB SPECTRUM", graph.withTop (graph.getY() - 2.0f * s).withBottom (graph.getY() + 14.0f * s),
|
||||
juce::Justification::bottomLeft, false);
|
||||
|
||||
const float legendY = graph.getY() + 4.0f * s;
|
||||
const float legendY = graph.getY() + 24.0f * s;
|
||||
const float legendX = graph.getRight() - 2.0f * s;
|
||||
const auto legendRow = juce::Rectangle<float> (legendX - 84.0f * s, legendY - 9.0f * s, 84.0f * s, 12.0f * s);
|
||||
|
||||
g.setFont (juce::Font (juce::FontOptions (9.0f * s)));
|
||||
g.setColour (wetPeakCol);
|
||||
g.setColour (wetLineCol);
|
||||
g.drawHorizontalLine (juce::roundToInt (legendRow.getY() + 8.0f * s), juce::roundToInt (legendRow.getX()), juce::roundToInt (legendRow.getX() + 11.0f * s));
|
||||
g.setColour (juce::Colour (0x88FFFFFF));
|
||||
g.drawText ("WET", legendRow.withX (legendRow.getX() + 14.0f * s).withWidth (28.0f * s),
|
||||
juce::Justification::left, false);
|
||||
|
||||
g.setColour (dryPeakCol);
|
||||
g.setColour (dryLineCol);
|
||||
g.drawHorizontalLine (juce::roundToInt (legendRow.getY() + 8.0f * s), juce::roundToInt (legendRow.getX() + 42.0f * s), juce::roundToInt (legendRow.getX() + 53.0f * s));
|
||||
g.setColour (juce::Colour (0x88FFFFFF));
|
||||
g.drawText ("DRY", legendRow.withX (legendRow.getX() + 56.0f * s).withWidth (28.0f * s),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue