try to correctly modify value tree and listen for changes
This commit is contained in:
parent
8c1be957fe
commit
11d7296813
|
@ -56,7 +56,8 @@ void FilePicker::filenameComponentChanged (FilenameComponent*) {
|
|||
// currentPath = fileChooser.getCurrentFile().getFullPathName();
|
||||
// fluidSynthModel.onFileNameChanged(fileChooser.getCurrentFile().getFullPathName(), -1, -1);
|
||||
Value value{valueTreeState.state.getChildWithName("soundFont").getPropertyAsValue("path", nullptr)};
|
||||
value = fileChooser.getCurrentFile().getFullPathName();
|
||||
value.setValue(fileChooser.getCurrentFile().getFullPathName());
|
||||
// value = fileChooser.getCurrentFile().getFullPathName();
|
||||
}
|
||||
|
||||
void FilePicker::valueTreePropertyChanged(ValueTree& treeWhosePropertyHasChanged,
|
||||
|
|
|
@ -347,6 +347,7 @@ void FluidSynthModel::loadFont(const String &absPath) {
|
|||
banks.appendChild({ "bank", {
|
||||
{ "num", initialBankOffset },
|
||||
}, {} }, nullptr);
|
||||
int greatestPersistedBank{initialBankOffset};
|
||||
|
||||
fluid_sfont_iteration_start(sfont);
|
||||
|
||||
|
@ -362,10 +363,11 @@ void FluidSynthModel::loadFont(const String &absPath) {
|
|||
// fluid_preset_get_name(preset)
|
||||
// )
|
||||
// ));
|
||||
if (bankOffset > initialBankOffset) {
|
||||
if (bankOffset > greatestPersistedBank) {
|
||||
banks.appendChild({ "bank", {
|
||||
{ "num", bankOffset },
|
||||
}, {} }, nullptr);
|
||||
greatestPersistedBank = bankOffset;
|
||||
}
|
||||
presets.appendChild({ "preset", {
|
||||
{ "num", fluid_preset_get_num(preset) },
|
||||
|
@ -373,8 +375,15 @@ void FluidSynthModel::loadFont(const String &absPath) {
|
|||
}, {} }, nullptr);
|
||||
}
|
||||
}
|
||||
valueTreeState.state.getChildWithName("banks") = banks;
|
||||
valueTreeState.state.getChildWithName("presets") = presets;
|
||||
// valueTreeState.state.getChildWithName("banks") = banks;
|
||||
// valueTreeState.state.getChildWithName("presets") = presets;
|
||||
valueTreeState.state.getChildWithName("banks").copyPropertiesAndChildrenFrom(banks, nullptr);
|
||||
valueTreeState.state.getChildWithName("presets").copyPropertiesAndChildrenFrom(presets, nullptr);
|
||||
|
||||
#if JUCE_DEBUG
|
||||
unique_ptr<XmlElement> xml{valueTreeState.state.createXml()};
|
||||
Logger::outputDebugString(xml->createDocument("",false,false));
|
||||
#endif
|
||||
}
|
||||
|
||||
// FluidSynthModel::Listener::~Listener() {
|
||||
|
|
|
@ -388,7 +388,7 @@ void JuicySFAudioProcessor::getStateInformation (MemoryBlock& destData)
|
|||
// XmlElement xml{"MYPLUGINSETTINGS"};
|
||||
// sharedParams->setAttributesOnXml(xml);
|
||||
auto state{valueTreeState.copyState()};
|
||||
shared_ptr<XmlElement> xml{state.createXml()};
|
||||
unique_ptr<XmlElement> xml{state.createXml()};
|
||||
// sharedParams.setAttributesOnXml(xml);
|
||||
|
||||
// list<StateChangeSubscriber*>::iterator p;
|
||||
|
|
|
@ -120,11 +120,17 @@ void TableComponent::parameterChanged(const String& parameterID, float newValue)
|
|||
}
|
||||
}
|
||||
|
||||
void TableComponent::valueTreePropertyChanged(
|
||||
ValueTree& treeWhosePropertyHasChanged,
|
||||
const Identifier& property) {
|
||||
if (treeWhosePropertyHasChanged.getType() == StringRef("presets")) {
|
||||
loadModelFrom(treeWhosePropertyHasChanged);
|
||||
// void TableComponent::valueTreePropertyChanged(
|
||||
// ValueTree& treeWhosePropertyHasChanged,
|
||||
// const Identifier& property) {
|
||||
// if (treeWhosePropertyHasChanged.getType() == StringRef("presets")) {
|
||||
// loadModelFrom(treeWhosePropertyHasChanged);
|
||||
// }
|
||||
// }
|
||||
|
||||
void TableComponent::valueTreeParentChanged(ValueTree& treeWhoseParentHasChanged) {
|
||||
if (treeWhoseParentHasChanged.getType() == StringRef("presets")) {
|
||||
loadModelFrom(treeWhoseParentHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ public:
|
|||
|
||||
virtual void parameterChanged (const String& parameterID, float newValue) override;
|
||||
|
||||
virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
|
||||
const Identifier& property) override;
|
||||
inline virtual void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged,
|
||||
const Identifier& property) override {};
|
||||
inline virtual void valueTreeChildAdded (ValueTree& parentTree,
|
||||
ValueTree& childWhichHasBeenAdded) override {};
|
||||
inline virtual void valueTreeChildRemoved (ValueTree& parentTree,
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
int indexFromWhichChildWasRemoved) override {};
|
||||
inline virtual void valueTreeChildOrderChanged (ValueTree& parentTreeWhoseChildrenHaveMoved,
|
||||
int oldIndex, int newIndex) override {};
|
||||
inline virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) override {};
|
||||
virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) override;
|
||||
inline virtual void valueTreeRedirected (ValueTree& treeWhichHasBeenChanged) override {};
|
||||
private:
|
||||
void loadModelFrom(ValueTree& presets);
|
||||
|
|
Loading…
Reference in New Issue
Block a user