Skip to content

Commit

Permalink
Restore sync monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Nov 2, 2024
1 parent 7955c74 commit 8acce56
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 330 deletions.
13 changes: 5 additions & 8 deletions Source/Processors/EventTranslator/EventTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,18 @@ void EventTranslator::handleTTLEvent(TTLEventPtr event)
const uint16 eventStream = event->getStreamId();
const int ttlLine = event->getLine();
const int64 sampleNumber = event->getSampleNumber();
const bool state = event->getState();

if (synchronizer.getSyncLine(eventStream) == ttlLine)
{
synchronizer.addEvent(eventStream, ttlLine, sampleNumber);
synchronizer.addEvent(eventStream, ttlLine, sampleNumber, state);

return;
}

if (eventStream == synchronizer.mainStreamId && synchronizer.isStreamSynced(eventStream))
if (eventStream == synchronizer.mainstreamId && synchronizer.isStreamSynced(eventStream))
{

//std::cout << "TRANSLATE!" << std::endl;

const bool state = event->getState();


double timestamp = synchronizer.convertSampleNumberToTimestamp(eventStream, sampleNumber);

for (auto stream : getDataStreams())
Expand Down Expand Up @@ -182,7 +179,7 @@ void EventTranslator::saveCustomParametersToXml(XmlElement* xml)

XmlElement* streamXml = xml->createNewChildElement("STREAM");

streamXml->setAttribute("isMainStream", synchronizer.mainStreamId == streamId);
streamXml->setAttribute("isMainStream", synchronizer.mainstreamId == streamId);
streamXml->setAttribute("sync_line", getSyncLine(streamId));
streamXml->setAttribute("name", stream->getName());
streamXml->setAttribute("source_node_id", stream->getSourceNodeId());
Expand Down
12 changes: 6 additions & 6 deletions Source/Processors/RecordNode/RecordNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ void RecordNode::handleBroadcastMessage(String msg)
if (recordEvents && isRecording)
{

int64 messageSampleNumber = getFirstSampleNumberForBlock(synchronizer.mainStreamId);
int64 messageSampleNumber = getFirstSampleNumberForBlock(synchronizer.mainstreamId);

TextEventPtr event = TextEvent::createTextEvent(getMessageChannel(), messageSampleNumber, msg);

double ts = synchronizer.convertSampleNumberToTimestamp(synchronizer.mainStreamId, messageSampleNumber);
double ts = synchronizer.convertSampleNumberToTimestamp(synchronizer.mainstreamId, messageSampleNumber);

event->setTimestampInSeconds(ts);

Expand Down Expand Up @@ -578,7 +578,7 @@ bool RecordNode::startAcquisition()
{
eventChannels.add(new EventChannel(*messageChannel));
eventChannels.getLast()->addProcessor(processorInfo.get());
eventChannels.getLast()->setDataStream(getDataStream(synchronizer.mainStreamId), false);
eventChannels.getLast()->setDataStream(getDataStream(synchronizer.mainstreamId), false);
}

return true;
Expand Down Expand Up @@ -628,7 +628,7 @@ void RecordNode::startRecording()
{
eventChannels.add(new EventChannel(*messageChannel));
eventChannels.getLast()->addProcessor(processorInfo.get());
eventChannels.getLast()->setDataStream(getDataStream(synchronizer.mainStreamId), false);
eventChannels.getLast()->setDataStream(getDataStream(synchronizer.mainstreamId), false);
}

int lastSourceNodeId = -1;
Expand Down Expand Up @@ -747,7 +747,7 @@ void RecordNode::handleTTLEvent(TTLEventPtr event)

int64 sampleNumber = event->getSampleNumber();

synchronizer.addEvent(event->getStreamId(), event->getLine(), sampleNumber);
synchronizer.addEvent(event->getStreamId(), event->getLine(), sampleNumber, event->getState());

if (recordEvents && isRecording)
{
Expand Down Expand Up @@ -1016,7 +1016,7 @@ void RecordNode::saveCustomParametersToXml(XmlElement* xml)
{
XmlElement* streamXml = xml->createNewChildElement("STREAM");

streamXml->setAttribute("isMainStream", synchronizer.mainStreamId == streamId);
streamXml->setAttribute("isMainStream", synchronizer.mainstreamId == streamId);
streamXml->setAttribute("sync_line", getSyncLine(streamId));
streamXml->setAttribute("name", stream->getName());
streamXml->setAttribute("source_node_id", stream->getSourceNodeId());
Expand Down
8 changes: 6 additions & 2 deletions Source/Processors/RecordNode/SyncControlButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SyncControlButton::SyncControlButton(SynchronizingProcessor* node_,

isPrimary = node->isMainDataStream(streamId);
LOGD("SyncControlButton::Constructor; Stream: ", streamId, " is main stream: ", isPrimary);
startTimer(250);
startTimer(500);

setTooltip(name);

Expand Down Expand Up @@ -113,9 +113,11 @@ void SyncControlButton::paintButton(Graphics &g, bool isMouseOver, bool isButton
g.fillRoundedRectangle(0,0,getWidth(),getHeight(),4);

switch(node->synchronizer.getStatus(streamId)) {

case SyncStatus::OFF :
{
//LOGC("Get status: ", streamId, " SYNC_OFF");

if (isMouseOver)
{
//LIGHT GREY
Expand All @@ -130,6 +132,7 @@ void SyncControlButton::paintButton(Graphics &g, bool isMouseOver, bool isButton
}
case SyncStatus::SYNCING :
{
//LOGC("Get status: ", streamId, " SYNCING");

if (isMouseOver)
{
Expand All @@ -145,6 +148,7 @@ void SyncControlButton::paintButton(Graphics &g, bool isMouseOver, bool isButton
}
case SyncStatus::SYNCED :
{
//LOGC("Get status: ", streamId, " SYNCED");

if (isMouseOver)
{
Expand Down
Loading

0 comments on commit 8acce56

Please sign in to comment.