Convert Gen~ code into a Juce Plugin
I'm wondering if anyone can point me in the right direction. I have planned to program a Synthesizer using Gen then port the code to c++ and implement the GUI in Juce (which I have some experience in). I can get through the example in the gen_plugin_export Repo, but am really unsure how to link the DSP code to a Juce GUI. I've viewed these two videos linked below, but am still unsure. Can anyone help?
Repo- https://github.com/Cycling74/gen-plugin-export
https://www.youtube.com/watch?v=ysmEYOYosbs&t=1076s&ab_channel=vikingfoolez
https://www.youtube.com/watch?v=2WridRXnri0&t=832s&ab_channel=IGRAM%E9%9F%B3%E9%9F%BF%E9%9F%B3%E6%A5%BD%E7%A0%94%E7%A9%B6%E6%89%80
Hi,
Same as in the video, using Listeners with sliderValueChanged, bottonClicked, etc., and adding a timerCallback() to update the values of the GUIs components from the parameters works fine for me, but I guess it’s more convenient to use the AudioProcessorValueTreeState class.
Cheers
// 1 gain param in gen~ patch, for example
// PluginEditor.h
class C74GenAudioProcessorEditor : public AudioProcessorEditor,
public juce::Slider::Listener,
public juce::Timer
{
public:
……………….
……………….
……………….
void sliderValueChanged (Slider* sliderThatWasMoved) override;
private:
std::unique_ptr<juce::Slider> gainSlider;
void timerCallback() override;
……………….
……………….
……………….
};
////////////////////// PluginEditor.cpp
C74GenAudioProcessorEditor::C74GenAudioProcessorEditor (C74GenAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
{
gainSlider.reset (new juce::Slider (“gainSlider"));
gainSlider->setRange (0, 1, 0.01);
gainSlider->setSliderStyle (juce::Slider::RotaryHorizontalVerticalDrag);
gainSlider->setTextBoxStyle (juce::Slider::NoTextBox, true, 80, 20);
gainSlider->setColour (juce::Slider::thumbColourId, juce::Colours::yellow);
gainSlider->addListener (this);
gainSlider->setBounds (12, 8, 116, 104);
addAndMakeVisible (gainSlider.get());
……………….
……………….
……………….
startTimer(50);
……………….
……………….
……………….
}
……………….
……………….
……………….
void C74GenAudioProcessorEditor::sliderValueChanged (juce::Slider* sliderThatWasMoved)
{
if (sliderThatWasMoved == gainSlider.get())
{
processor.setParameter(0, sliderThatWasMoved->getValue());
}
}
void C74GenAudioProcessorEditor::timerCallback()
{
gainSlider->setValue(processor.getParameter(0), dontSendNotification);
}
////////////////////// PluginProcessor.cpp
C74GenAudioProcessor::C74GenAudioProcessor() : m_CurrentBufferSize(0)
{
……………….
……………….
……………….
C74GenAudioProcessor::setParameter (0, 1.0f);
}
//////////////////
pd. also in C74_GENPLUGIN::reset, do not initialize member variables (m_gain_1 = 1)