Skip to content

Commit

Permalink
self-mod graphing no longer results in a crash, still doesn't look right
Browse files Browse the repository at this point in the history
  • Loading branch information
hsetlik committed Apr 15, 2021
1 parent 9e8461f commit 8f2394a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
32 changes: 25 additions & 7 deletions Source/AlgorithmGraphComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,29 @@ void OperatorBox::paint(juce::Graphics &g)

void AlgorithmGraph::addPath(std::pair<int, int> from, std::pair<int, int> to)
{
paths.add(new juce::Path());
auto path = paths.getLast();
auto p1 = getCellCenter(from.first, from.second);
auto p3 = getCellCenter(to.first, to.second);
path->startNewSubPath(p1.first, p1.second);
path->lineTo(p3.first, p3.second);
if(from != to)
{
paths.add(new juce::Path());
auto path = paths.getLast();
auto p1 = getCellCenter(from.first, from.second);
auto p3 = getCellCenter(to.first, to.second);
path->startNewSubPath(p1.first, p1.second);
path->lineTo(p3.first, p3.second);
}
if(from == to)
{
auto p1 = getCellCenter(from.first, from.second);
auto leftX = p1.first - (AlgorithmGridConstants::cellSideLength * 0.8f);
auto topY = p1.second - (AlgorithmGridConstants::cellSideLength * 0.8f);
auto p2 = std::make_pair(leftX, p1.second);
auto p3 = std::make_pair(leftX, topY);
paths.add(new juce::Path());
auto path = paths.getLast();
path->startNewSubPath(p1.first, p1.second);
path->lineTo(p2.first, p2.second);
path->lineTo(p3.first, p3.second);
path->closeSubPath();
}
}

void AlgorithmGraph::timerCallback()
Expand Down Expand Up @@ -208,7 +225,8 @@ void AlgorithmGraph::paint(juce::Graphics &g)
{
auto endPoint = std::make_pair(dest->gridX, dest->gridY);
addPath(startPoint, endPoint);
g.strokePath(*paths.getLast(), strokeWeight);
auto path = *paths.getLast();
g.strokePath(path, strokeWeight);
}
}
for(auto op : opBoxes)
Expand Down
3 changes: 1 addition & 2 deletions Source/DAHDSR.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class DAHDSR
{
if(input > 0)
return input;
else
return 1;
return 1;
}
envPhase currentPhase;
unsigned long long samplesIntoPhase;
Expand Down
4 changes: 2 additions & 2 deletions Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ juce::AudioProcessorValueTreeState::ParameterLayout createLayout(int numOperator
auto sustainName = "Operator " + iStr + " sustain";
auto releaseId = "releaseParam" + iStr;
auto releaseName = "Operator " + iStr + " release";
juce::NormalisableRange<float> timeRange1(1.0f, 20000.0f, 0.1f, 0.5f);
juce::NormalisableRange<float> timeRange1(1.0f, 20000.0f, 0.5f, 0.5f);
timeRange1.setSkewForCentre(1000.0f);
juce::NormalisableRange<float> timeRange2(1.0f, 20000.0f, 0.1f, 0.5f);
juce::NormalisableRange<float> timeRange2(1.0f, 20000.0f, 0.5f, 0.5f);
timeRange2.setSkewForCentre(5000.0f);
layout.add(std::make_unique<juce::AudioParameterFloat>(delayId, delayName, timeRange2, 0.0f));
layout.add(std::make_unique<juce::AudioParameterFloat>(attackId, attackName, timeRange1, 20.0f));
Expand Down

0 comments on commit 8f2394a

Please sign in to comment.