Skip to content

Commit 0f6a946

Browse files
committed
Display Harp start time in seconds (instead of ms)
1 parent caf430d commit 0f6a946

3 files changed

Lines changed: 30 additions & 17 deletions

File tree

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,9 +1251,9 @@ void RecordNode::updateSyncMonitors()
12511251

12521252
RecordNodeEditor* editor = (RecordNodeEditor*) getEditor();
12531253

1254-
editor->setStreamStartTime (streamId, synchronizer.isStreamSynced (streamKey), synchronizer.getStartTime (streamKey));
1255-
editor->setLastSyncEvent (streamId, synchronizer.isStreamSynced (streamKey), synchronizer.getLastSyncEvent (streamKey));
1256-
editor->setSyncAccuracy (streamId, synchronizer.isStreamSynced (streamKey), synchronizer.getAccuracy (streamKey));
1254+
editor->setStreamStartTime (streamId, synchronizer.getStatus (streamKey), synchronizer.getStartTime (streamKey));
1255+
editor->setLastSyncEvent (streamId, synchronizer.getStatus (streamKey), synchronizer.getLastSyncEvent (streamKey));
1256+
editor->setSyncAccuracy (streamId, synchronizer.getStatus (streamKey), synchronizer.getAccuracy (streamKey));
12571257
}
12581258
}
12591259

Source/Processors/RecordNode/RecordNodeEditor.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,20 @@ SyncMonitor::~SyncMonitor()
3535
{
3636
}
3737

38-
void SyncMonitor::setSyncMetric (bool isSynchronized_, float syncMetric_)
38+
void SyncMonitor::setSyncMetric (SyncStatus syncStatus_, float syncMetric_)
3939
{
40-
isSynchronized = isSynchronized_;
40+
syncStatus = syncStatus_;
4141
metric = syncMetric_;
42+
43+
if(syncStatus == SyncStatus::SYNCED || syncStatus == SyncStatus::HARDWARE_SYNCED || syncStatus == SyncStatus::HARP_CLOCK)
44+
isSynchronized = true;
45+
else
46+
isSynchronized = false;
47+
48+
if(syncStatus == SyncStatus::HARP_CLOCK)
49+
timeUnits = " s";
50+
else
51+
timeUnits = " ms";
4252
}
4353

4454
void SyncMonitor::setEnabled (bool state)
@@ -86,7 +96,7 @@ void SyncStartTimeMonitor::paint (Graphics& g)
8696
if (isSynchronized)
8797
{
8898
g.setColour (findColour (ThemeColours::defaultText));
89-
g.drawText (String (metric, 2) + " ms", 0, 0, 50, 20, Justification::centred);
99+
g.drawText (String (metric, 2) + timeUnits, 0, 0, 50, 20, Justification::centred);
90100
}
91101

92102
else
@@ -697,30 +707,30 @@ void RecordNodeEditor::buttonClicked (Button* button)
697707
}
698708
}
699709

700-
void RecordNodeEditor::setStreamStartTime (uint16 streamId, bool isSynchronized, float offsetMs)
710+
void RecordNodeEditor::setStreamStartTime (uint16 streamId, SyncStatus status, float offsetMs)
701711
{
702712
if (syncStartTimeMonitors.find (streamId) != syncStartTimeMonitors.end())
703713
{
704714
if (syncStartTimeMonitors[streamId] != nullptr)
705-
syncStartTimeMonitors[streamId]->setSyncMetric (isSynchronized, offsetMs);
715+
syncStartTimeMonitors[streamId]->setSyncMetric (status, offsetMs);
706716
}
707717
}
708718

709-
void RecordNodeEditor::setLastSyncEvent (uint16 streamId, bool isSynchronized, float syncTimeSeconds)
719+
void RecordNodeEditor::setLastSyncEvent (uint16 streamId, SyncStatus status, float syncTimeSeconds)
710720
{
711721
if (lastSyncEventMonitors.find (streamId) != lastSyncEventMonitors.end())
712722
{
713723
if (lastSyncEventMonitors[streamId] != nullptr)
714-
lastSyncEventMonitors[streamId]->setSyncMetric (isSynchronized, syncTimeSeconds);
724+
lastSyncEventMonitors[streamId]->setSyncMetric (status, syncTimeSeconds);
715725
}
716726
}
717727

718-
void RecordNodeEditor::setSyncAccuracy (uint16 streamId, bool isSynchronized, float syncAccuracy)
728+
void RecordNodeEditor::setSyncAccuracy (uint16 streamId, SyncStatus status, float syncAccuracy)
719729
{
720730
if (syncAccuracyMonitors.find (streamId) != syncAccuracyMonitors.end())
721731
{
722732
if (syncAccuracyMonitors[streamId] != nullptr)
723-
syncAccuracyMonitors[streamId]->setSyncMetric (isSynchronized, syncAccuracy);
733+
syncAccuracyMonitors[streamId]->setSyncMetric (status, syncAccuracy);
724734
}
725735
}
726736

Source/Processors/RecordNode/RecordNodeEditor.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "../../Utils/Utils.h"
2828
#include "../Editors/GenericEditor.h"
2929
#include "../Editors/PopupChannelSelector.h"
30+
#include "../Synchronizer/Synchronizer.h"
3031

3132
#include "DiskMonitor/DiskSpaceListener.h"
3233

@@ -51,15 +52,17 @@ class SyncMonitor : public Component
5152
~SyncMonitor();
5253

5354
/** Sets the most recent sync metric */
54-
void setSyncMetric (bool isSynchronized, float syncMetric);
55+
void setSyncMetric (SyncStatus syncStatus, float syncMetric);
5556

5657
/** Enable or disable this component*/
5758
void setEnabled (bool isEnabled);
5859

5960
protected:
6061
bool isEnabled = true;
61-
bool isSynchronized = false;
62+
SyncStatus syncStatus = SyncStatus::OFF;
6263
float metric = 0.0f;
64+
bool isSynchronized = false;
65+
String timeUnits = " ms";
6366
};
6467

6568
/**
@@ -354,13 +357,13 @@ class RecordNodeEditor : public GenericEditor,
354357
void stopRecording() override {};
355358

356359
/** Set start time for each stream */
357-
void setStreamStartTime (uint16 streamId, bool isSynchronized, float offsetMs);
360+
void setStreamStartTime (uint16 streamId, SyncStatus status, float offsetMs);
358361

359362
/** Set the time of latest sync pulse */
360-
void setLastSyncEvent (uint16 streamId, bool isSynchronized, float syncTimeSeconds);
363+
void setLastSyncEvent (uint16 streamId, SyncStatus status, float syncTimeSeconds);
361364

362365
/** Set the synchronization accuracy metric for a particular stream */
363-
void setSyncAccuracy (uint16 streamId, bool isSynchronized, float expectedMinusActual);
366+
void setSyncAccuracy (uint16 streamId, SyncStatus status, float expectedMinusActual);
364367

365368
std::unique_ptr<FifoDrawerButton> fifoDrawerButton;
366369

0 commit comments

Comments
 (0)