Skip to content

Commit

Permalink
Little bits of cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Jan 3, 2024
1 parent c0e0fa7 commit 1e035bd
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/dsp/Brickwall/BrickwallProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void BrickwallProcessor::processBlock (const chowdsp::BufferView<float>& buffer)
filter.setCutoffFrequency (*params.cutoff);
filter.processBlock (buffer);

if (extraState.isEditorOpen.load() && extraState.showPostSpectrum.get())
if (extraState.isEditorOpen.load() && extraState.showSpectrum.get())
postSpectrumAnalyserTask.processBlockInput (buffer.toAudioBuffer());
}

Expand Down
2 changes: 1 addition & 1 deletion src/dsp/Brickwall/BrickwallProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum class FilterType
struct ExtraState
{
std::atomic<bool> isEditorOpen { false };
chowdsp::StateValue<std::atomic_bool, bool> showPostSpectrum { "brickwall_show_post_spectrum", true };
chowdsp::StateValue<std::atomic_bool, bool> showSpectrum { "brickwall_show_spectrum", true };
};

} // namespace dsp::brickwall
Expand Down
3 changes: 1 addition & 2 deletions src/gui/AnalogEQ/AnalogEQEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ AnalogEQEditor::AnalogEQEditor (State& pluginState,
dsp::analog_eq::ExtraState& analogEqExtraState,
const chowdsp::HostContextProvider& hcp,
SpectrumAnalyserTask::PrePostPair spectrumAnalyserTasks)
: plot (pluginState, params, analogEqExtraState, hcp, spectrumAnalyserTasks),
extraState (analogEqExtraState)
: plot (pluginState, params, analogEqExtraState, hcp, spectrumAnalyserTasks)
{
addAndMakeVisible (plot);
}
Expand Down
1 change: 0 additions & 1 deletion src/gui/AnalogEQ/AnalogEQEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class AnalogEQEditor : public juce::Component

private:
AnalogEQPlot plot;
dsp::analog_eq::ExtraState& extraState;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AnalogEQEditor)
};
Expand Down
1 change: 0 additions & 1 deletion src/gui/BandSplitter/BandSplitterPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ void BandSplitterPlot::updateSpectrumPlots()
for (auto id : spectrumIDs())
{
auto* spectrumTask = *spectrumTasks[id];
spectrumTask->reset();
auto prePostPair = SpectrumAnalyserTask::PrePostPair { std::nullopt, std::ref (spectrumTask->spectrumAnalyserUITask) };
spectrumAnalysers.insert_or_assign (id, std::make_unique<SpectrumAnalyser> (*this, prePostPair));
}
Expand Down
10 changes: 5 additions & 5 deletions src/gui/Brickwall/BrickwallPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ BrickwallPlot::BrickwallPlot (State& pluginState,
{
addMouseListener (this, true);
extraState.isEditorOpen.store (true);
spectrumAnalyser.setShouldShowPostEQ (extraState.showPostSpectrum.get());
spectrumAnalyser.setShouldShowPostEQ (extraState.showSpectrum.get());
callbacks += {
extraState.showPostSpectrum.changeBroadcaster.connect ([this]
extraState.showSpectrum.changeBroadcaster.connect ([this]
{
spectrumAnalyser.setShouldShowPostEQ(extraState.showPostSpectrum.get());
spectrumAnalyser.setShouldShowPostEQ(extraState.showSpectrum.get());
spectrumAnalyser.repaint(); }),
};

Expand Down Expand Up @@ -179,10 +179,10 @@ void BrickwallPlot::mouseDown (const juce::MouseEvent& event)

juce::PopupMenu::Item postSpectrumItem;
postSpectrumItem.itemID = 100;
postSpectrumItem.text = extraState.showPostSpectrum.get() ? "Disable Post-EQ Visualizer" : "Enable Post-EQ Visualizer";
postSpectrumItem.text = extraState.showSpectrum.get() ? "Disable Spectrum Visualizer" : "Enable Spectrum Visualizer";
postSpectrumItem.action = [this]
{
extraState.showPostSpectrum.set (! extraState.showPostSpectrum.get());
extraState.showSpectrum.set (! extraState.showSpectrum.get());
};
menu.addItem (postSpectrumItem);

Expand Down
4 changes: 2 additions & 2 deletions src/gui/SVF/SVFPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void SVFPlot::mouseDown (const juce::MouseEvent& event)

juce::PopupMenu::Item preSpectrumItem;
preSpectrumItem.itemID = 100;
preSpectrumItem.text = extraState.showPreSpectrum.get() ? "Disable Pre-EQ Visualizer" : "Enable Pre-EQ Visualizer";
preSpectrumItem.text = extraState.showPreSpectrum.get() ? "Disable Pre-Filter Visualizer" : "Enable Pre-Filter Visualizer";
preSpectrumItem.action = [this]
{
extraState.showPreSpectrum.set (! extraState.showPreSpectrum.get());
Expand All @@ -203,7 +203,7 @@ void SVFPlot::mouseDown (const juce::MouseEvent& event)

juce::PopupMenu::Item postSpectrumItem;
postSpectrumItem.itemID = 101;
postSpectrumItem.text = extraState.showPostSpectrum.get() ? "Disable Post-EQ Visualizer" : "Enable Post-EQ Visualizer";
postSpectrumItem.text = extraState.showPostSpectrum.get() ? "Disable Post-Filter Visualizer" : "Enable Post-Filter Visualizer";
postSpectrumItem.action = [this]
{
extraState.showPostSpectrum.set (! extraState.showPostSpectrum.get());
Expand Down
6 changes: 6 additions & 0 deletions src/gui/Shared/SpectrumAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ void SpectrumAnalyser::visibilityChanged()
if (isVisible())
{
if (preTask)
{
preTask->get().reset();
preTask->get().setShouldBeRunning (showPreEQ);
}
if (postTask)
{
postTask->get().reset();
postTask->get().setShouldBeRunning (showPostEQ);
}
startTimerHz (32);
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/state/PluginState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PluginExtraState::PluginExtraState()
&analogEqExtraState->showPostSpectrum,
&eqExtraState->showPreSpectrum,
&eqExtraState->showPostSpectrum,
&brickwallExtraState->showPostSpectrum,
&brickwallExtraState->showSpectrum,
&svfExtraState->showPreSpectrum,
&svfExtraState->showPostSpectrum,
&bandSplitterExtraState->showSpectrum,
Expand Down

0 comments on commit 1e035bd

Please sign in to comment.