make file picker contruct using whatever soundfont path is available at construction-time. work towards giving Processor access to change its File on load.

This commit is contained in:
Alex Birch
2018-04-11 00:08:15 +01:00
parent 191641ddd1
commit 114bb2f10a
6 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,11 @@ FilePicker::FilePicker(
// faster (rounded edges introduce transparency) // faster (rounded edges introduce transparency)
setOpaque (true); setOpaque (true);
const String& currentSoundFontAbsPath = fluidSynthModel->getCurrentSoundFontAbsPath();
if (currentSoundFontAbsPath.isNotEmpty()) {
fileChooser.setCurrentFile(File(currentSoundFontAbsPath), true, dontSendNotification);
}
addAndMakeVisible (fileChooser); addAndMakeVisible (fileChooser);
fileChooser.addListener (this); fileChooser.addListener (this);
} }

View File

@ -170,6 +170,10 @@ bool FluidSynthModel::shouldLoadFont(const String &absPath) {
void FluidSynthModel::Listener::fontChanged(FluidSynthModel * model, const String &absPath) { void FluidSynthModel::Listener::fontChanged(FluidSynthModel * model, const String &absPath) {
} }
const String& FluidSynthModel::getCurrentSoundFontAbsPath() {
return currentSoundFontAbsPath;
}
//============================================================================== //==============================================================================
void FluidSynthModel::addListener (FluidSynthModel::Listener* const newListener) void FluidSynthModel::addListener (FluidSynthModel::Listener* const newListener)
{ {

View File

@ -56,6 +56,8 @@ public:
*/ */
void removeListener (Listener* listener); void removeListener (Listener* listener);
const String& getCurrentSoundFontAbsPath();
private: private:
SharesParams& sharesParams; SharesParams& sharesParams;

View File

@ -134,3 +134,7 @@ bool JuicySFAudioProcessorEditor::keyStateChanged (bool isKeyDown) {
// } // }
// return false; // return false;
} }
const FilePicker& JuicySFAudioProcessorEditor::getFilePicker() {
}

View File

@ -37,6 +37,8 @@ public:
// void getStateInformation (XmlElement& xml) override; // void getStateInformation (XmlElement& xml) override;
// void setStateInformation (XmlElement* xmlState) override; // void setStateInformation (XmlElement* xmlState) override;
const FilePicker& getFilePicker();
private: private:
// This reference is provided as a quick way for your editor to // This reference is provided as a quick way for your editor to
// access the processor object that created it. // access the processor object that created it.

View File

@ -242,6 +242,11 @@ void JuicySFAudioProcessor::setStateInformation (const void* data, int sizeInByt
if (editor != nullptr) { if (editor != nullptr) {
editor->setSize(lastUIWidth, lastUIHeight); editor->setSize(lastUIWidth, lastUIHeight);
} }
// const String& currentSoundFontAbsPath = fluidSynthModel->getCurrentSoundFontAbsPath();
// if (currentSoundFontAbsPath.isNotEmpty()) {
// fileChooser.setCurrentFile(File(currentSoundFontAbsPath), true, dontSendNotification);
// }
} }
} }
} }