change to construction-time reference
This commit is contained in:
parent
9427a029b9
commit
d7b87fe84f
@ -7,8 +7,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
FluidSynthModel::FluidSynthModel()
|
||||
: sharesParams(nullptr),
|
||||
FluidSynthModel::FluidSynthModel(SharesParams& p)
|
||||
: sharesParams(p),
|
||||
synth(nullptr),
|
||||
settings(nullptr),
|
||||
initialised(false),
|
||||
@ -27,8 +27,7 @@ FluidSynthModel::~FluidSynthModel() {
|
||||
}
|
||||
}
|
||||
|
||||
void FluidSynthModel::initialise(SharesParams& p) {
|
||||
sharesParams = &p;
|
||||
void FluidSynthModel::initialise() {
|
||||
// if (initialised) {
|
||||
// delete_fluid_synth(synth);
|
||||
// delete_fluid_settings(settings);
|
||||
@ -39,8 +38,8 @@ void FluidSynthModel::initialise(SharesParams& p) {
|
||||
|
||||
synth = new_fluid_synth(settings);
|
||||
|
||||
if (sharesParams->getSoundFontPath().isNotEmpty()) {
|
||||
loadFont(sharesParams->getSoundFontPath().toStdString());
|
||||
if (sharesParams.getSoundFontPath().isNotEmpty()) {
|
||||
loadFont(sharesParams.getSoundFontPath().toStdString());
|
||||
}
|
||||
|
||||
fluid_synth_set_gain(synth, 2.0);
|
||||
@ -152,9 +151,7 @@ FluidSynthModel::Listener::~Listener() {
|
||||
}
|
||||
|
||||
void FluidSynthModel::Listener::fontChanged(FluidSynthModel * model, const string &absPath) {
|
||||
if (model->initialised) {
|
||||
model->sharesParams->setSoundFontPath(String(absPath));
|
||||
}
|
||||
model->sharesParams.setSoundFontPath(String(absPath));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
@ -16,11 +16,11 @@ using std::shared_ptr;
|
||||
|
||||
class FluidSynthModel {
|
||||
public:
|
||||
FluidSynthModel();
|
||||
FluidSynthModel(SharesParams& p);
|
||||
~FluidSynthModel();
|
||||
|
||||
fluid_synth_t* getSynth();
|
||||
void initialise(SharesParams& p);
|
||||
void initialise();
|
||||
|
||||
BanksToPresets getBanks();
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
void removeListener (Listener* listener);
|
||||
|
||||
private:
|
||||
SharesParams* sharesParams;
|
||||
SharesParams& sharesParams;
|
||||
|
||||
fluid_synth_t* synth;
|
||||
fluid_settings_t* settings;
|
||||
|
@ -22,7 +22,7 @@ JuicySFAudioProcessor::JuicySFAudioProcessor()
|
||||
lastUIWidth(400),
|
||||
lastUIHeight(300),
|
||||
soundFontPath(String()),
|
||||
fluidSynthModel()
|
||||
fluidSynthModel(*this)
|
||||
{
|
||||
initialiseSynth();
|
||||
}
|
||||
@ -33,7 +33,7 @@ JuicySFAudioProcessor::~JuicySFAudioProcessor()
|
||||
}
|
||||
|
||||
void JuicySFAudioProcessor::initialiseSynth() {
|
||||
fluidSynthModel.initialise(*this);
|
||||
fluidSynthModel.initialise();
|
||||
|
||||
fluidSynth = fluidSynthModel.getSynth();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user