fixed circular reference
This commit is contained in:
parent
27b9dfb9df
commit
9427a029b9
|
@ -235,6 +235,7 @@
|
|||
560D40E30164CA9D05C6AC3B /* MyColours.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MyColours.h; path = ../../Source/MyColours.h; sourceTree = SOURCE_ROOT; };
|
||||
571BC08FE42BABE3BAF364C8 /* Info-AUv3_AppExtension.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-AUv3_AppExtension.plist"; sourceTree = SOURCE_ROOT; };
|
||||
596723D094319DA06FDDCDC6 /* StateChangeSubscriber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StateChangeSubscriber.h; path = ../../Source/StateChangeSubscriber.h; sourceTree = "<group>"; };
|
||||
59672C6315E5D06A21B4A2F2 /* SharesParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharesParams.h; path = ../../Source/SharesParams.h; sourceTree = "<group>"; };
|
||||
5B3CBC48DAB08EDF53CEE609 /* include_juce_audio_plugin_client_VST3.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = include_juce_audio_plugin_client_VST3.cpp; path = ../../JuceLibraryCode/include_juce_audio_plugin_client_VST3.cpp; sourceTree = SOURCE_ROOT; };
|
||||
5BC90F629770BCF4193FABDD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
||||
63942F8053F1E4E72C1BE98C /* FilePicker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = FilePicker.cpp; path = ../../Source/FilePicker.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -555,6 +556,7 @@
|
|||
457D4946B07CC4A74EB0FAE1 /* PluginEditor.cpp */,
|
||||
B3E8D1BE528BBA1B6004672E /* PluginEditor.h */,
|
||||
596723D094319DA06FDDCDC6 /* StateChangeSubscriber.h */,
|
||||
59672C6315E5D06A21B4A2F2 /* SharesParams.h */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
using namespace std;
|
||||
|
||||
FluidSynthModel::FluidSynthModel()
|
||||
: processor(nullptr),
|
||||
: sharesParams(nullptr),
|
||||
synth(nullptr),
|
||||
settings(nullptr),
|
||||
initialised(false),
|
||||
|
@ -27,8 +27,8 @@ FluidSynthModel::~FluidSynthModel() {
|
|||
}
|
||||
}
|
||||
|
||||
void FluidSynthModel::initialise(JuicySFAudioProcessor& p) {
|
||||
processor = &p;
|
||||
void FluidSynthModel::initialise(SharesParams& p) {
|
||||
sharesParams = &p;
|
||||
// if (initialised) {
|
||||
// delete_fluid_synth(synth);
|
||||
// delete_fluid_settings(settings);
|
||||
|
@ -39,8 +39,8 @@ void FluidSynthModel::initialise(JuicySFAudioProcessor& p) {
|
|||
|
||||
synth = new_fluid_synth(settings);
|
||||
|
||||
if (processor->soundFontPath.isNotEmpty()) {
|
||||
loadFont(processor->soundFontPath.toStdString());
|
||||
if (sharesParams->getSoundFontPath().isNotEmpty()) {
|
||||
loadFont(sharesParams->getSoundFontPath().toStdString());
|
||||
}
|
||||
|
||||
fluid_synth_set_gain(synth, 2.0);
|
||||
|
@ -153,7 +153,7 @@ FluidSynthModel::Listener::~Listener() {
|
|||
|
||||
void FluidSynthModel::Listener::fontChanged(FluidSynthModel * model, const string &absPath) {
|
||||
if (model->initialised) {
|
||||
model->processor->soundFontPath = String(absPath);
|
||||
model->sharesParams->setSoundFontPath(String(absPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "PluginProcessor.h"
|
||||
#include "SharesParams.h"
|
||||
#include <fluidsynth.h>
|
||||
#include <memory>
|
||||
#include "PresetsToBanks.h"
|
||||
|
@ -20,7 +20,7 @@ public:
|
|||
~FluidSynthModel();
|
||||
|
||||
fluid_synth_t* getSynth();
|
||||
void initialise(JuicySFAudioProcessor& p);
|
||||
void initialise(SharesParams& p);
|
||||
|
||||
BanksToPresets getBanks();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
void removeListener (Listener* listener);
|
||||
|
||||
private:
|
||||
JuicySFAudioProcessor* processor;
|
||||
SharesParams* sharesParams;
|
||||
|
||||
fluid_synth_t* synth;
|
||||
fluid_settings_t* settings;
|
||||
|
|
|
@ -254,6 +254,14 @@ FluidSynthModel* JuicySFAudioProcessor::getFluidSynthModel() {
|
|||
return &fluidSynthModel;
|
||||
}
|
||||
|
||||
void JuicySFAudioProcessor::setSoundFontPath(const String& value) {
|
||||
soundFontPath = value;
|
||||
}
|
||||
|
||||
String& JuicySFAudioProcessor::getSoundFontPath() {
|
||||
return soundFontPath;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// This creates new instances of the plugin..
|
||||
AudioProcessor* JUCE_CALLTYPE createPluginFilter()
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "FluidSynthModel.h"
|
||||
#include "StateChangeSubscriber.h"
|
||||
#include "SharesParams.h"
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
|
@ -20,7 +21,8 @@ using namespace std;
|
|||
//==============================================================================
|
||||
/**
|
||||
*/
|
||||
class JuicySFAudioProcessor : public AudioProcessor
|
||||
class JuicySFAudioProcessor : public AudioProcessor,
|
||||
public SharesParams
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
@ -65,15 +67,19 @@ public:
|
|||
|
||||
MidiKeyboardState keyboardState;
|
||||
|
||||
virtual void setSoundFontPath(const String& value) override;
|
||||
virtual String& getSoundFontPath() override;
|
||||
|
||||
// void subscribeToStateChanges(StateChangeSubscriber* subscriber);
|
||||
// void unsubscribeFromStateChanges(StateChangeSubscriber* subscriber);
|
||||
|
||||
int lastUIWidth, lastUIHeight;
|
||||
String soundFontPath;
|
||||
|
||||
private:
|
||||
void initialiseSynth();
|
||||
|
||||
String soundFontPath;
|
||||
|
||||
FluidSynthModel fluidSynthModel;
|
||||
fluid_synth_t* fluidSynth;
|
||||
Synthesiser synth;
|
||||
|
|
19
Source/SharesParams.h
Normal file
19
Source/SharesParams.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Created by Alex Birch on 10/04/2018.
|
||||
// Copyright (c) 2018 Birchlabs. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
class SharesParams {
|
||||
public:
|
||||
virtual ~SharesParams() {}
|
||||
|
||||
virtual void setSoundFontPath(const String& value) = 0;
|
||||
virtual String& getSoundFontPath() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user