Skip to content

Commit

Permalink
Added more wrapper functions to SynthGuiInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnavkar committed Oct 31, 2024
1 parent d5fd8f5 commit 7f69c4f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
16 changes: 16 additions & 0 deletions source/common/synth_gui_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,20 @@ void SynthGuiInterface::addCableConnection(Cable* c){
getSynth()->addConnection(c->connection);
}

bool SynthGuiInterface::isMidiMapped(const std::string& name){
return getSynth()->isMidiMapped(name);
}

void SynthGuiInterface::resetSynthEngine(){
getSynth()->getEngine()->resetEngine();
}

juce::ValueTree& SynthGuiInterface::getValueTree(){
return getSynth()->getValueTree(); //Not sure if std::move should be used here, I figured don't copy the whole thing
}

juce::String SynthGuiInterface::getComments(){
return getSynth()->getComments();
}

#endif
12 changes: 12 additions & 0 deletions source/common/synth_gui_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,23 @@ class SynthGuiInterface {
void openSaveDialog();
void externalPresetLoaded(juce::File preset);
void setGuiSize(float scale);

void tryEnqueueProcessorInitQueue(juce::FixedSizeFunction<16, void()> callback);

/* SynthBase Wrapper Functions */
bool isMidiMapped(const std::string& name);
void addCableConnection(Cable* c);
void resetSynthEngine();
juce::ValueTree& getValueTree();
juce::String getComments();

FullInterface* getGui() { return gui_.get(); }
OpenGlWrapper* getOpenGlWrapper();
UserPreferencesWrapper* userPreferences;
SynthBase* synth_; //does this need to be there??
SampleLoadManager* sampleLoadManager ;


protected:


Expand All @@ -72,3 +82,5 @@ class SynthGuiInterface {
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthGuiInterface)
};



4 changes: 2 additions & 2 deletions source/interface/ConstructionSite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ void ConstructionSite::reset()
{
SynthGuiInterface* _parent = findParentComponentOfClass<SynthGuiInterface>();
//safe to do on message thread because we have locked processing if this is called
_parent->getSynth()->getEngine()->resetEngine();
parent = _parent->getSynth()->getValueTree().getChildWithName (IDs::PIANO);
_parent->resetSynthEngine();
parent = _parent->getValueTree().getChildWithName (IDs::PIANO);

cableView.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion source/interface/preset_browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ bool PresetBrowser::loadFromFile(juce::File& preset) {
synth->setPresetName(preset.getFileNameWithoutExtension());
synth->setAuthor(author_);

juce::String comments = parent->getSynth()->getComments();
juce::String comments = parent->getComments();
int comments_font_size = kCommentsFontHeight * size_ratio_;
if (comments_) {
comments_->setText(comments);
Expand Down
4 changes: 2 additions & 2 deletions source/interface/synth_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void SynthButton::handlePopupResult(int result) {
if (parent == nullptr)
return;

SynthBase* synth = parent->getSynth();
//SynthBase* synth = parent->getSynth();
//
// if (result == kArmMidiLearn)
// mainSynth->armMidiLearn(getName().toStdString());
Expand All @@ -308,7 +308,7 @@ void SynthButton::mouseDown(const juce::MouseEvent& e) {
if (parent == nullptr)
return;

SynthBase* synth = parent->getSynth();
//SynthBase* synth = parent->getSynth();

// if (e.mods.isPopupMenu()) {
// OpenGlToggleButton::mouseExit(e);
Expand Down
2 changes: 1 addition & 1 deletion source/interface/synth_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ PopupItems SynthSlider::createPopupMenu() {
if (has_parameter_assignment_)
options.addItem(kArmMidiLearn, "Learn MIDI Assignment");

if (has_parameter_assignment_ && synth_interface_->getSynth()->isMidiMapped(getName().toStdString()))
if (has_parameter_assignment_ && synth_interface_->isMidiMapped (getName().toStdString()))
options.addItem(kClearMidiLearn, "Clear MIDI Assignment");

options.addItem(kManualEntry, "Enter juce::Value");
Expand Down

0 comments on commit 7f69c4f

Please sign in to comment.