Skip to content
Snippets Groups Projects
Commit e9da08d7 authored by jsiegle's avatar jsiegle
Browse files

Allow Digital Reference and Phase Detector to save their settings

parent 4d5a7d82
No related branches found
No related tags found
No related merge requests found
......@@ -92,4 +92,31 @@ void PhaseDetectorEditor::buttonEvent(Button* button)
{
}
void PhaseDetectorEditor::saveEditorParameters(XmlElement* xml)
{
xml->setAttribute("Type", "PhaseDetectorEditor");
XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
selectedChannel->setAttribute("ID",channelSelectionBox->getSelectedId());
}
void PhaseDetectorEditor::loadEditorParameters(XmlElement* xml)
{
forEachXmlChildElement(*xml, xmlNode)
{
if (xmlNode->hasTagName("SELECTEDID"))
{
int id = xmlNode->getIntAttribute("ID");
channelSelectionBox->setSelectedId(id);
}
}
}
\ No newline at end of file
......@@ -48,6 +48,9 @@ public:
void updateSettings();
void saveEditorParameters(XmlElement* xml);
void loadEditorParameters(XmlElement* xml);
private:
ScopedPointer<ComboBox> channelSelectionBox;
......
......@@ -92,4 +92,31 @@ void ReferenceNodeEditor::buttonEvent(Button* button)
{
}
void ReferenceNodeEditor::saveEditorParameters(XmlElement* xml)
{
xml->setAttribute("Type", "ReferenceNodeEditor");
XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
selectedChannel->setAttribute("ID",referenceSelector->getSelectedId());
}
void ReferenceNodeEditor::loadEditorParameters(XmlElement* xml)
{
forEachXmlChildElement(*xml, xmlNode)
{
if (xmlNode->hasTagName("SELECTEDID"))
{
int id = xmlNode->getIntAttribute("ID");
referenceSelector->setSelectedId(id);
}
}
}
\ No newline at end of file
......@@ -47,6 +47,10 @@ public:
void updateSettings();
void saveEditorParameters(XmlElement* xml);
void loadEditorParameters(XmlElement* xml);
private:
ScopedPointer<ComboBox> referenceSelector;
......
......@@ -236,3 +236,38 @@ void FilterNode::process(AudioSampleBuffer& buffer,
}
void FilterNode::saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, bool isEventChannel)
{
std::cout << "CHANNEL: " << channelNumber << std::endl;
if (!isEventChannel && channelNumber > -1 && channelNumber < highCuts.size())
{
std::cout << "Saving custom parameters for filter node." << std::endl;
XmlElement* channelParams = channelInfo->createNewChildElement("PARAMETERS");
channelParams->setAttribute("highcut",highCuts[channelNumber-1]);
channelParams->setAttribute("lowcut",lowCuts[channelNumber-1]);
}
}
void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
{
int channelNum = channelInfo->getIntAttribute("number");
if (!isEventChannel)
{
forEachXmlChildElement(*channelInfo, subNode)
{
if (subNode->hasTagName("PARAMETERS"))
{
highCuts.set(channelNum-1, subNode->getDoubleAttribute("highcut",6000.0f));
lowCuts.set(channelNum-1, subNode->getDoubleAttribute("lowcut",600.0f));
}
}
}
}
\ No newline at end of file
......@@ -58,6 +58,10 @@ public:
void updateSettings();
void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, bool isEventChannel);
void loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel);
private:
Array<double> lowCuts, highCuts;
......
......@@ -28,7 +28,7 @@
ReferenceNode::ReferenceNode()
: GenericProcessor("Digital Reference"), referenceChannel(-1), referenceBuffer(1,10000)
: GenericProcessor("Digital Ref"), referenceChannel(-1), referenceBuffer(1,10000)
{
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment