MCPcopy Create free account
hub / github.com/DamRsn/NeuralNote / setStateInformation

Method setStateInformation

NeuralNote/PluginSources/PluginProcessor.cpp:79–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void NeuralNoteAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
80{
81 // Create an XmlElement from the binary data
82 std::unique_ptr<XmlElement> xmlState(getXmlFromBinary(data, sizeInBytes));
83
84 if (xmlState != nullptr) {
85 // Convert XmlElement to ValueTree
86 ValueTree full_state_tree = ValueTree::fromXml(*xmlState);
87
88 if (full_state_tree.isValid() && full_state_tree.hasType(NnId::FullStateId)) {
89 // Extract the parameters ValueTree
90 auto parameter_tree = full_state_tree.getChildWithName(NnId::ParametersId);
91
92 ParameterHelpers::updateParametersFromState(parameter_tree, mParams);
93
94 } else {
95 jassertfalse;
96 }
97
98 if (full_state_tree.isValid() && full_state_tree.hasType(NnId::FullStateId)) {
99 auto new_value_tree = full_state_tree.getChildWithName(NnId::NeuralNoteStateId);
100 _updateValueTree(new_value_tree);
101 } else {
102 jassertfalse;
103 }
104 }
105}
106
107void NeuralNoteAudioProcessor::clear()
108{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected