| 77 | } |
| 78 | |
| 79 | void 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 | |
| 107 | void NeuralNoteAudioProcessor::clear() |
| 108 | { |
nothing calls this directly
no test coverage detected