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

GraphViewer now displays the fraction of channels within each node that are...

GraphViewer now displays the fraction of channels within each node that are set to record. Closes #135
parent 873bbbf7
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@
#include "../RecordNode.h"
#include "../AudioNode.h"
#include "../ProcessorGraph.h"
#include "../../UI/GraphViewer.h"
ChannelSelector::ChannelSelector(bool createButtons, Font& titleFont_) :
eventsOnly(false), paramsToggled(true), paramsActive(true),
......@@ -594,6 +595,8 @@ void ChannelSelector::buttonClicked(Button* button)
ch->setRecordState(status);
}
editor->getGraphViewer()->repaint();
}
else // parameter type
{
......
......@@ -545,6 +545,21 @@ bool GenericEditor::getRecordStatus(int chan)
}
}
Array<bool> GenericEditor::getRecordStatusArray()
{
Array<bool> recordStatuses;
recordStatuses.resize(getProcessor()->getNumOutputs());
for (int i = 0; i < getProcessor()->getNumOutputs(); i++)
{
recordStatuses.set(i,channelSelector->getRecordStatus(i));
}
return recordStatuses;
}
bool GenericEditor::getAudioStatus(int chan)
{
if (!isSplitOrMerge)
......
......@@ -287,6 +287,9 @@ public:
/** Returns the editors a splitter or merger is connected to */
virtual Array<GenericEditor*> getConnectedEditors(){ Array<GenericEditor*> a; return a;}
/** Returns an array of record statuses for all channels. Used by GraphNode */
Array<bool> getRecordStatusArray();
protected:
......
......@@ -284,7 +284,7 @@ void GenericProcessor::clearSettings()
for (int i = 0; i < channels.size(); i++)
{
std::cout << channels[i]->getRecordState() << std::endl;
// std::cout << channels[i]->getRecordState() << std::endl;
recordStatus.set(i,channels[i]->getRecordState());
}
......
......@@ -23,6 +23,8 @@
#include "GraphViewer.h"
#define PI 3.14159265359
GraphViewer::GraphViewer()
{
......@@ -433,16 +435,32 @@ void GraphNode::updateBoundaries()
void GraphNode::paint(Graphics& g)
{
Array<bool> recordStatuses = editor->getRecordStatusArray();
Path recordPath;
for (int i = 0; i < recordStatuses.size(); i++)
{
float stepSize = 2*PI/recordStatuses.size();
float startRadians = stepSize*i;
float endRadians = startRadians + stepSize;
if (recordStatuses[i])
recordPath.addPieSegment(0,0,20,20,startRadians,endRadians,0.5);
}
g.setColour(Colours::red);
g.fillPath(recordPath);
if (mouseOver)
{
g.setColour(Colours::yellow);
g.fillEllipse(0,0,20,20);
g.fillEllipse(2,2,16,16);
} else {
g.setColour(Colours::lightgrey);
g.fillEllipse(1,1,18,18);
g.fillEllipse(2,2,16,16);
}
g.drawText(getName(), 25, 0, getWidth()-25, 20, Justification::left, true);
}
\ No newline at end of file
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