Skip to content

Commit ab32ac7

Browse files
committed
Ignore events generated by filters coming into synchronizer
1 parent 9fa72bd commit ab32ac7

2 files changed

Lines changed: 53 additions & 40 deletions

File tree

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ void RecordNode::updateSubprocessorMap()
325325
int sourceID = chan->getSourceNodeID();
326326
int subProcID = chan->getSubProcessorIdx();
327327

328-
int chCount = 0;
329-
330-
if (!syncChannelMap[sourceID][subProcID])
328+
if (dataChannelStates[sourceID][subProcID].size() && !syncChannelMap[sourceID][subProcID])
331329
{
332330
EventChannel* chan = eventChannelArray[ch];
333331
eventChannelMap[sourceID][subProcID] = chan->getNumChannels();
@@ -552,7 +550,7 @@ void RecordNode::handleEvent(const EventChannel* eventInfo, const MidiMessage& e
552550
else
553551
eventIndex = -1;
554552

555-
if (samplePosition)
553+
if (samplePosition > 0 && dataChannelStates[Event::getSourceID(event)][Event::getSubProcessorIdx(event)].size())
556554
synchronizer->addEvent(Event::getSourceID(event), Event::getSubProcessorIdx(event), eventIndex, timestamp);
557555

558556
if (isRecording)

Source/Processors/RecordNode/RecordNodeEditor.cpp

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,22 @@ void RecordNodeEditor::saveCustomParameters(XmlElement* xml)
143143
for (auto subIdx : extract_keys(recordNode->dataChannelStates[srcID]))
144144
{
145145

146-
XmlElement* subProcNode = xmlNode->createNewChildElement("SUBPROCESSOR");
146+
if (recordNode->dataChannelStates[srcID][subIdx].size() > 0)
147+
{
148+
XmlElement* subProcNode = xmlNode->createNewChildElement("SUBPROCESSOR");
147149

148-
subProcNode->setAttribute("src_id", srcID);
149-
subProcNode->setAttribute("sub_idx", subIdx);
150-
subProcNode->setAttribute("isMaster", recordNode->synchronizer->masterProcessor == srcID && recordNode->synchronizer->masterSubprocessor == subIdx);
151-
subProcNode->setAttribute("syncChannel", recordNode->syncChannelMap[srcID][subIdx]);
150+
subProcNode->setAttribute("src_id", srcID);
151+
subProcNode->setAttribute("sub_idx", subIdx);
152+
subProcNode->setAttribute("isMaster", recordNode->synchronizer->masterProcessor == srcID && recordNode->synchronizer->masterSubprocessor == subIdx);
153+
subProcNode->setAttribute("syncChannel", recordNode->syncChannelMap[srcID][subIdx]);
152154

153-
XmlElement* recStateNode = subProcNode->createNewChildElement("RECORDSTATE");
155+
XmlElement* recStateNode = subProcNode->createNewChildElement("RECORDSTATE");
156+
157+
for (int ch = 0; ch < recordNode->dataChannelStates[srcID][subIdx].size(); ch++)
158+
{
159+
recStateNode->setAttribute(String("CH")+String(ch), recordNode->dataChannelStates[srcID][subIdx][ch]);
160+
}
154161

155-
for (int ch = 0; ch < recordNode->dataChannelStates[srcID][subIdx].size(); ch++)
156-
{
157-
recStateNode->setAttribute(String("CH")+String(ch), recordNode->dataChannelStates[srcID][subIdx][ch]);
158162
}
159163

160164
}
@@ -177,6 +181,7 @@ void RecordNodeEditor::loadCustomParameters(XmlElement* xml)
177181
eventRecord->setToggleState((bool)(xmlNode->getStringAttribute("recordEvents").getIntValue()), juce::NotificationType::dontSendNotification);
178182
spikeRecord->setToggleState((bool)(xmlNode->getStringAttribute("recordSpikes").getIntValue()), juce::NotificationType::dontSendNotification);
179183

184+
180185
forEachXmlChildElement(*xmlNode, subNode)
181186
{
182187
if (subNode->hasTagName("SUBPROCESSOR"))
@@ -185,17 +190,22 @@ void RecordNodeEditor::loadCustomParameters(XmlElement* xml)
185190
int srcID = subNode->getIntAttribute("src_id");
186191
int subIdx = subNode->getIntAttribute("sub_idx");
187192

188-
if (subNode->getBoolAttribute("isMaster"))
193+
if (recordNode->dataChannelStates[srcID][subIdx].size())
189194
{
190-
recordNode->setMasterSubprocessor(srcID, subIdx);
191-
}
192-
recordNode->setSyncChannel(srcID, subIdx, subNode->getIntAttribute("syncChannel"));
193195

194-
XmlElement* recordStates = subNode->getChildByName("RECORDSTATE");
196+
if (subNode->getBoolAttribute("isMaster"))
197+
{
198+
recordNode->setMasterSubprocessor(srcID, subIdx);
199+
}
200+
recordNode->setSyncChannel(srcID, subIdx, subNode->getIntAttribute("syncChannel"));
201+
202+
XmlElement* recordStates = subNode->getChildByName("RECORDSTATE");
203+
204+
for (int ch = 0; ch < recordNode->dataChannelStates[srcID][subIdx].size(); ch++)
205+
{
206+
recordNode->dataChannelStates[srcID][subIdx][ch] = recordStates->getIntAttribute("CH" + String(ch));
207+
}
195208

196-
for (int ch = 0; ch < recordNode->dataChannelStates[srcID][subIdx].size(); ch++)
197-
{
198-
recordNode->dataChannelStates[srcID][subIdx][ch] = recordStates->getIntAttribute("CH"+String(ch));
199209
}
200210

201211
}
@@ -240,25 +250,30 @@ void RecordNodeEditor::updateSubprocessorFifos()
240250

241251
for (ptr = it->second.begin(); ptr != it->second.end(); ptr++) {
242252

243-
String name = "SP" + String(i);
244-
subProcLabels.add(new Label(name, name));
245-
subProcLabels.getLast()->setBounds(13 + i * 20, 24, 40, 20);
246-
subProcLabels.getLast()->setFont(Font("Small Text", 7.0f, Font::plain));
247-
addAndMakeVisible(subProcLabels.getLast());
248-
subProcLabels.getLast()->setVisible(false);
249-
250-
subProcMonitors.add(new FifoMonitor(recordNode, it->first, ptr->first));
251-
subProcMonitors.getLast()->setBounds(18 + i * 20, 43, 15, 62);
252-
addAndMakeVisible(subProcMonitors.getLast());
253-
subProcMonitors.getLast()->setVisible(false);
254-
255-
subProcRecords.add(new SyncControlButton(recordNode, "SP" + String(i), it->first, ptr->first));
256-
subProcRecords.getLast()->setBounds(18 + i * 20, 110, 15, 15);
257-
subProcRecords.getLast()->addListener(this);
258-
addAndMakeVisible(subProcRecords.getLast());
259-
subProcRecords.getLast()->setVisible(false);
260-
261-
i++;
253+
if (recordNode->dataChannelStates[it->first][ptr->first].size())
254+
{
255+
256+
String name = "SP" + String(i);
257+
subProcLabels.add(new Label(name, name));
258+
subProcLabels.getLast()->setBounds(13 + i * 20, 24, 40, 20);
259+
subProcLabels.getLast()->setFont(Font("Small Text", 7.0f, Font::plain));
260+
addAndMakeVisible(subProcLabels.getLast());
261+
subProcLabels.getLast()->setVisible(false);
262+
263+
subProcMonitors.add(new FifoMonitor(recordNode, it->first, ptr->first));
264+
subProcMonitors.getLast()->setBounds(18 + i * 20, 43, 15, 62);
265+
addAndMakeVisible(subProcMonitors.getLast());
266+
subProcMonitors.getLast()->setVisible(false);
267+
268+
subProcRecords.add(new SyncControlButton(recordNode, "SP" + String(i), it->first, ptr->first));
269+
subProcRecords.getLast()->setBounds(18 + i * 20, 110, 15, 15);
270+
subProcRecords.getLast()->addListener(this);
271+
addAndMakeVisible(subProcRecords.getLast());
272+
subProcRecords.getLast()->setVisible(false);
273+
274+
i++;
275+
276+
}
262277

263278
}
264279
}

0 commit comments

Comments
 (0)