Skip to content

Commit

Permalink
Display additional stream info in popup window
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Dec 29, 2023
1 parent e81e851 commit f58705b
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 48 deletions.
11 changes: 10 additions & 1 deletion Source/Processors/Editors/DelayMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ DelayMonitor::DelayMonitor() :

DelayMonitor::~DelayMonitor()
{
std::cout << "DELAY MONITOR DELETING" << std::endl;
//std::cout << "DELAY MONITOR DELETING" << std::endl;
}

void DelayMonitor::setDelay(float delayMs)
{
//std::cout << "Delay monitor::setDelay " << delayMs << std::endl;
delay = delayMs;
}

Expand Down Expand Up @@ -72,7 +73,15 @@ void DelayMonitor::timerCallback()

void DelayMonitor::paint(Graphics& g)
{

g.setColour(colour);
g.setFont(font);
g.drawText(String(delay, 2) + " ms", 0, 0, 60, 20, Justification::centredLeft);

}


void DelayMonitor::handleCommandMessage(int commandId)
{
repaint();
}
4 changes: 4 additions & 0 deletions Source/Processors/Editors/DelayMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ class PLUGIN_API DelayMonitor :
/** Stops the timer*/
void stopAcquisition();

/** Sends repaint command asynchronously */
void handleCommandMessage(int commandId);

private:

bool isEnabled;
Colour colour;
float delay;
Font font;
bool canRepaint = true;
};


Expand Down
32 changes: 22 additions & 10 deletions Source/Processors/Editors/GenericEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,18 @@ bool GenericEditor::checkDrawerButton(Button* button)

}

void GenericEditor::updateDelayAndTTLMonitors()
{
for (auto stream : getProcessor()->getDataStreams())
{
delayMonitors[stream->getStreamId()] = streamSelector->getDelayMonitor(stream);
ttlMonitors[stream->getStreamId()] = streamSelector->getTTLMonitor(stream);

streamSelector->getTTLMonitor(stream)->updateSettings(stream->getEventChannels());

}
}

void GenericEditor::update(bool isEnabled_)
{
isEnabled = isEnabled_;
Expand Down Expand Up @@ -540,14 +552,7 @@ void GenericEditor::update(bool isEnabled_)

selectedStream = streamSelector->finishedUpdate();

for (auto stream : p->getDataStreams())
{
delayMonitors[stream->getStreamId()] = streamSelector->getDelayMonitor(stream);
ttlMonitors[stream->getStreamId()] = streamSelector->getTTLMonitor(stream);

streamSelector->getTTLMonitor(stream)->updateSettings(stream->getEventChannels());

}
updateDelayAndTTLMonitors();

if (numChannels == 0)
{
Expand All @@ -573,13 +578,20 @@ void GenericEditor::update(bool isEnabled_)
void GenericEditor::setTTLState(uint16 streamId, int bit, bool state)
{
if (ttlMonitors.find(streamId) != ttlMonitors.end())
ttlMonitors[streamId]->setState(bit, state);
{
if (ttlMonitors[streamId] != nullptr)
ttlMonitors[streamId]->setState(bit, state);
}
}

void GenericEditor::setMeanLatencyMs(uint16 streamId, float latencyMs)
{
if (delayMonitors.find(streamId) != delayMonitors.end())
delayMonitors[streamId]->setDelay(latencyMs);
{
if (delayMonitors[streamId] != nullptr)
delayMonitors[streamId]->setDelay(latencyMs);
}

}

bool GenericEditor::getCollapsedState()
Expand Down
3 changes: 3 additions & 0 deletions Source/Processors/Editors/GenericEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ class PLUGIN_API GenericEditor : public AudioProcessorEditor
/** Get the ID of the stream that's currently selected.*/
uint16 getCurrentStream() { return selectedStream; }

/** Called when new TTL and Delay monitors are created */
void updateDelayAndTTLMonitors();

/** Notifies editor that the selected stream has changed.*/
virtual void selectedStreamHasChanged();

Expand Down
Loading

0 comments on commit f58705b

Please sign in to comment.