Skip to content

Commit

Permalink
Holy fuck lol
Browse files Browse the repository at this point in the history
  • Loading branch information
MeijisIrlnd committed Jan 14, 2023
1 parent 1c4759b commit 46cda4f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
1 change: 0 additions & 1 deletion Source/Expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
15 changes: 7 additions & 8 deletions Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>::filterHalfBandFIREquiripple)
parameterTree(*this, nullptr, juce::Identifier("Transfer"), createParameterLayout()), m_distortion(parameterTree)
{
ErrorReporter::init();
//context.reset(new Expression<float>("x", 0, 0));
Expand Down Expand Up @@ -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<float>(getTotalNumOutputChannels(), m_oversamplingFactor, juce::dsp::Oversampling<float>::filterHalfBandFIREquiripple));
m_oversampler->setUsingIntegerLatency(true);
m_oversampler->initProcessing(samplesPerBlock);
setLatencySamples(m_oversampler->getLatencyInSamples());
m_distortion.prepareToPlay(samplesPerBlock, sampleRate * m_oversamplingFactor);
}

Expand Down Expand Up @@ -155,9 +154,9 @@ void TransferAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juc
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
juce::dsp::AudioBlock<float> 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);
}

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion Source/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> m_oversampler;
std::unique_ptr<juce::dsp::Oversampling<float> > m_oversampler{ nullptr };
std::unique_ptr<Expression<float>> context;
Transfer::Audio::Distortion m_distortion;
double currentCoefficient = 1;
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/LF.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
9 changes: 6 additions & 3 deletions Source/UI/TransferCodeEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand All @@ -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:
Expand All @@ -112,5 +115,5 @@ class TransferCodeEditor : public juce::CodeEditorComponent
private:
juce::String m_errorText;
}; std::unique_ptr<ErrorRenderer> m_errorRenderer{ nullptr };

bool m_inErrorMode{ false };
};

0 comments on commit 46cda4f

Please sign in to comment.