diff --git a/Source/Expression.h b/Source/Expression.h index edb33db..3ecb326 100644 --- a/Source/Expression.h +++ b/Source/Expression.h @@ -30,7 +30,6 @@ struct Expression symbolTable.add_variable("prev", previous); symbolTable.add_constants(); expression.register_symbol_table(symbolTable); - parser.settings().disable_all_control_structures(); parser.settings().enable_all_control_structures(); setExpr(initialExpr); } diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index a405671..976d875 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -24,6 +24,7 @@ TransferAudioProcessorEditor::TransferAudioProcessorEditor(TransferAudioProcesso m_expressionLabel.setFont(m_titleLF.getLabelFont(m_expressionLabel)); m_expressionLabel.setJustificationType(juce::Justification::centredTop); m_expressionLabel.setText("transfer", juce::dontSendNotification); + addAndMakeVisible(&m_expressionLabel); setLookAndFeel(&m_lookAndFeel); addAndMakeVisible(&m_graphing); diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 4ef7c15..e9753a9 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -25,8 +25,7 @@ TransferAudioProcessor::TransferAudioProcessor() #else : #endif - parameterTree(*this, nullptr, juce::Identifier("Transfer"), createParameterLayout()), m_distortion(parameterTree), - m_oversampler(2, m_oversamplingFactor, juce::dsp::Oversampling::filterHalfBandFIREquiripple) + parameterTree(*this, nullptr, juce::Identifier("Transfer"), createParameterLayout()), m_distortion(parameterTree) { ErrorReporter::init(); //context.reset(new Expression("x", 0, 0)); @@ -113,10 +112,10 @@ void TransferAudioProcessor::changeProgramName (int index, const juce::String& n //============================================================================== void TransferAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { - m_oversampler.reset(); - m_oversampler.setUsingIntegerLatency(true); - m_oversampler.initProcessing(samplesPerBlock); - setLatencySamples(m_oversampler.getLatencyInSamples()); + m_oversampler.reset(new juce::dsp::Oversampling(getTotalNumOutputChannels(), m_oversamplingFactor, juce::dsp::Oversampling::filterHalfBandFIREquiripple)); + m_oversampler->setUsingIntegerLatency(true); + m_oversampler->initProcessing(samplesPerBlock); + setLatencySamples(m_oversampler->getLatencyInSamples()); m_distortion.prepareToPlay(samplesPerBlock, sampleRate * m_oversamplingFactor); } @@ -155,9 +154,9 @@ void TransferAudioProcessor::processBlock (juce::AudioBuffer& buffer, juc auto totalNumInputChannels = getTotalNumInputChannels(); auto totalNumOutputChannels = getTotalNumOutputChannels(); juce::dsp::AudioBlock block{ buffer }; - auto oversampled = m_oversampler.processSamplesUp(block); + auto oversampled = m_oversampler->processSamplesUp(block); m_distortion.getNextAudioBlock(oversampled); - m_oversampler.processSamplesDown(block); + m_oversampler->processSamplesDown(block); } //============================================================================== diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 6d575fb..014b4d5 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -66,7 +66,7 @@ class TransferAudioProcessor : public juce::AudioProcessor, public juce::AudioP const size_t m_oversamplingFactor{ 4 }; // 16x juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout() noexcept; juce::AudioProcessorValueTreeState parameterTree; - juce::dsp::Oversampling m_oversampler; + std::unique_ptr > m_oversampler{ nullptr }; std::unique_ptr> context; Transfer::Audio::Distortion m_distortion; double currentCoefficient = 1; diff --git a/Source/UI/LF.h b/Source/UI/LF.h index d17a2a2..c3e2eba 100644 --- a/Source/UI/LF.h +++ b/Source/UI/LF.h @@ -81,7 +81,7 @@ class TitleLF : public juce::LookAndFeel_V4 public: TitleLF() { - setColour(juce::Label::ColourIds::textColourId, juce::Colour(0x237F7F7F)); + setColour(juce::Label::ColourIds::textColourId, juce::Colour(0xFFA0A0A0)); } ~TitleLF() override { } diff --git a/Source/UI/TransferCodeEditor.h b/Source/UI/TransferCodeEditor.h index 22ad24a..993ef80 100644 --- a/Source/UI/TransferCodeEditor.h +++ b/Source/UI/TransferCodeEditor.h @@ -14,8 +14,8 @@ class TransferCodeEditor : public juce::CodeEditorComponent { public: - TransferCodeEditor(juce::CodeDocument& document, juce::CodeTokeniser* tokeniser) : - juce::CodeEditorComponent(document, tokeniser), m_tokeniser(tokeniser) + TransferCodeEditor(juce::CodeDocument& document, juce::CodeTokeniser* tokeniser) : + juce::CodeEditorComponent(document, tokeniser), m_tokeniser(tokeniser), m_inErrorMode(false) { setFont(LF::createFont()); @@ -82,6 +82,7 @@ class TransferCodeEditor : public juce::CodeEditorComponent void toggleErrorMode(bool hasError, const juce::String& errorText = "") { + if (m_inErrorMode == hasError) return; auto font = getFont(); font.setUnderline(hasError); setFont(font); @@ -91,10 +92,12 @@ class TransferCodeEditor : public juce::CodeEditorComponent m_errorRenderer.reset(new ErrorRenderer(errorText)); addAndMakeVisible(m_errorRenderer.get()); m_errorRenderer->setBounds(getLocalBounds()); + m_inErrorMode = true; } else { removeChildComponent(m_errorRenderer.get()); m_errorRenderer.reset(nullptr); + m_inErrorMode = false; } } private: @@ -112,5 +115,5 @@ class TransferCodeEditor : public juce::CodeEditorComponent private: juce::String m_errorText; }; std::unique_ptr m_errorRenderer{ nullptr }; - + bool m_inErrorMode{ false }; }; \ No newline at end of file