Rename breakpoint envelope related things
This commit is contained in:
parent
023989d3de
commit
007cc1cded
@ -32,10 +32,10 @@ EnvelopeComponent::~EnvelopeComponent()
|
||||
|
||||
}
|
||||
|
||||
void EnvelopeComponent::show_bubble(int x, int y, const envelope_node& node)
|
||||
void EnvelopeComponent::show_bubble(int x, int y, const envelope_point& node)
|
||||
{
|
||||
double scaledtime = XFromNormalized(node.Time);
|
||||
double scaledvalue = YFromNormalized(node.Value);
|
||||
double scaledtime = XFromNormalized(node.pt_x);
|
||||
double scaledvalue = YFromNormalized(node.pt_y);
|
||||
x -= 50;
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
@ -114,9 +114,9 @@ void EnvelopeComponent::paint(Graphics& g)
|
||||
draw_env(Colours::aquamarine.darker(), true, 1.0f);
|
||||
for (int i = 0; i < m_envelope->GetNumNodes(); ++i)
|
||||
{
|
||||
const envelope_node& pt = m_envelope->GetNodeAtIndex(i);
|
||||
double xcor = jmap(pt.Time, m_view_start_time, m_view_end_time, 0.0, (double)getWidth());
|
||||
double ycor = (double)getHeight() - jmap(pt.Value, m_view_start_value, m_view_end_value, 0.0, (double)getHeight());
|
||||
const envelope_point& pt = m_envelope->GetNodeAtIndex(i);
|
||||
double xcor = jmap(pt.pt_x, m_view_start_time, m_view_end_time, 0.0, (double)getWidth());
|
||||
double ycor = (double)getHeight() - jmap(pt.pt_y, m_view_start_value, m_view_end_value, 0.0, (double)getHeight());
|
||||
g.setColour(Colours::white);
|
||||
if (pt.Status == 0)
|
||||
g.drawRect((float)xcor - 4.0f, (float)ycor - 4.0f, 8.0f, 8.0f, 1.0f);
|
||||
@ -148,7 +148,7 @@ void EnvelopeComponent::mouseDrag(const MouseEvent& ev)
|
||||
if (m_segment_drag_info.first >= 0 && ev.mods.isAltDown())
|
||||
{
|
||||
double dist = jmap<double>(ev.getDistanceFromDragStartX(), -300.0, 300.0, -1.0, 1.0);
|
||||
m_envelope->performRelativeTransformation([dist, this](int index, envelope_node& point)
|
||||
m_envelope->performRelativeTransformation([dist, this](int index, envelope_point& point)
|
||||
{
|
||||
if (index == m_segment_drag_info.first)
|
||||
{
|
||||
@ -170,23 +170,23 @@ void EnvelopeComponent::mouseDrag(const MouseEvent& ev)
|
||||
if (m_node_to_drag >= 0)
|
||||
{
|
||||
//Logger::writeToLog("trying to move pt " + String(m_node_to_drag));
|
||||
envelope_node& pt = m_envelope->GetNodeAtIndex(m_node_to_drag);
|
||||
envelope_point& pt = m_envelope->GetNodeAtIndex(m_node_to_drag);
|
||||
double left_bound = m_view_start_time;
|
||||
double right_bound = m_view_end_time;
|
||||
if (m_node_to_drag > 0 )
|
||||
{
|
||||
left_bound = m_envelope->GetNodeAtIndex(m_node_to_drag - 1).Time;
|
||||
left_bound = m_envelope->GetNodeAtIndex(m_node_to_drag - 1).pt_x;
|
||||
}
|
||||
if (m_node_to_drag < m_envelope->GetNumNodes() - 1)
|
||||
{
|
||||
right_bound = m_envelope->GetNodeAtIndex(m_node_to_drag + 1).Time;
|
||||
right_bound = m_envelope->GetNodeAtIndex(m_node_to_drag + 1).pt_x;
|
||||
}
|
||||
double normx = jmap((double)ev.x, 0.0, (double)getWidth(), m_view_start_time, m_view_end_time);
|
||||
double normy = jmap((double)getHeight() - ev.y, 0.0, (double)getHeight(), m_view_start_value, m_view_end_value);
|
||||
pt.Time=jlimit(left_bound+0.001, right_bound - 0.001, normx);
|
||||
pt.Value=jlimit(0.0,1.0,normy);
|
||||
pt.pt_x=jlimit(left_bound+0.001, right_bound - 0.001, normx);
|
||||
pt.pt_y=jlimit(0.0,1.0,normy);
|
||||
m_envelope->updateMinMaxValues();
|
||||
m_last_tip = String(pt.Time, 2) + " " + String(pt.Value, 2);
|
||||
m_last_tip = String(pt.pt_x, 2) + " " + String(pt.pt_y, 2);
|
||||
show_bubble(ev.x, ev.y, pt);
|
||||
m_node_that_was_dragged = m_node_to_drag;
|
||||
repaint();
|
||||
@ -239,8 +239,8 @@ void EnvelopeComponent::mouseDown(const MouseEvent & ev)
|
||||
{
|
||||
for (int i = 0; i < m_envelope->GetNumNodes(); ++i)
|
||||
{
|
||||
double val = 1.0 - m_envelope->GetNodeAtIndex(i).Value;
|
||||
m_envelope->GetNodeAtIndex(i).Value = val;
|
||||
double val = 1.0 - m_envelope->GetNodeAtIndex(i).pt_y;
|
||||
m_envelope->GetNodeAtIndex(i).pt_y = val;
|
||||
}
|
||||
}
|
||||
if (r == 3)
|
||||
@ -375,7 +375,7 @@ bool EnvelopeComponent::keyPressed(const KeyPress & ev)
|
||||
m_node_to_drag = -1;
|
||||
{
|
||||
ScopedLock locker(*m_cs);
|
||||
m_envelope->removePointsConditionally([](const envelope_node& pt) { return pt.Status == 1; });
|
||||
m_envelope->removePointsConditionally([](const envelope_point& pt) { return pt.Status == 1; });
|
||||
if (m_envelope->GetNumNodes() == 0)
|
||||
m_envelope->AddNode({ 0.0,0.5 });
|
||||
}
|
||||
@ -392,9 +392,9 @@ int EnvelopeComponent::find_hot_envelope_point(double xcor, double ycor)
|
||||
return -1;
|
||||
for (int i = 0; i < m_envelope->GetNumNodes(); ++i)
|
||||
{
|
||||
const envelope_node& pt = m_envelope->GetNodeAtIndex(i);
|
||||
double ptxcor = jmap(pt.Time, m_view_start_time, m_view_end_time, 0.0, (double)getWidth());
|
||||
double ptycor = (double)getHeight() - jmap(pt.Value, m_view_start_value, m_view_end_value, 0.0, (double)getHeight());
|
||||
const envelope_point& pt = m_envelope->GetNodeAtIndex(i);
|
||||
double ptxcor = jmap(pt.pt_x, m_view_start_time, m_view_end_time, 0.0, (double)getWidth());
|
||||
double ptycor = (double)getHeight() - jmap(pt.pt_y, m_view_start_value, m_view_end_value, 0.0, (double)getHeight());
|
||||
juce::Rectangle<double> target(ptxcor - 4.0, ptycor - 4.0, 8.0, 8.0);
|
||||
if (target.contains(xcor, ycor) == true)
|
||||
{
|
||||
@ -410,10 +410,10 @@ int EnvelopeComponent::findHotEnvelopeSegment(double xcor, double ycor, bool det
|
||||
return -1;
|
||||
for (int i = 0; i < m_envelope->GetNumNodes()-1; ++i)
|
||||
{
|
||||
const envelope_node& pt0 = m_envelope->GetNodeAtIndex(i);
|
||||
const envelope_node& pt1 = m_envelope->GetNodeAtIndex(i+1);
|
||||
float xcor0 = (float)jmap<double>(pt0.Time, m_view_start_time, m_view_end_time, 0.0, getWidth());
|
||||
float xcor1 = (float)jmap<double>(pt1.Time, m_view_start_time, m_view_end_time, 0.0, getWidth());
|
||||
const envelope_point& pt0 = m_envelope->GetNodeAtIndex(i);
|
||||
const envelope_point& pt1 = m_envelope->GetNodeAtIndex(i+1);
|
||||
float xcor0 = (float)jmap<double>(pt0.pt_x, m_view_start_time, m_view_end_time, 0.0, getWidth());
|
||||
float xcor1 = (float)jmap<double>(pt1.pt_x, m_view_start_time, m_view_end_time, 0.0, getWidth());
|
||||
float segwidth = xcor1 - xcor0;
|
||||
juce::Rectangle<float> segrect(xcor0+8.0f, 0.0f, segwidth-16.0f, (float)getHeight());
|
||||
if (segrect.contains((float)xcor, (float)ycor))
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
int m_node_that_was_dragged = -1;
|
||||
String m_last_tip;
|
||||
BubbleMessageComponent m_bubble;
|
||||
void show_bubble(int x, int y, const envelope_node &node);
|
||||
void show_bubble(int x, int y, const envelope_point &node);
|
||||
CriticalSection* m_cs = nullptr;
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EnvelopeComponent)
|
||||
};
|
||||
|
@ -23,14 +23,14 @@ www.gnu.org/licenses
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "PS_Source/globals.h"
|
||||
|
||||
struct envelope_node
|
||||
struct envelope_point
|
||||
{
|
||||
envelope_node()
|
||||
: Time(0.0), Value(0.0), ShapeParam1(0.5), ShapeParam2(0.5) {}
|
||||
envelope_node(double x, double y, double p1=0.5, double p2=0.5)
|
||||
: Time(x), Value(y),ShapeParam1(p1),ShapeParam2(p2) {}
|
||||
double Time;
|
||||
double Value;
|
||||
envelope_point()
|
||||
: pt_x(0.0), pt_y(0.0), ShapeParam1(0.5), ShapeParam2(0.5) {}
|
||||
envelope_point(double x, double y, double p1=0.5, double p2=0.5)
|
||||
: pt_x(x), pt_y(y),ShapeParam1(p1),ShapeParam2(p2) {}
|
||||
double pt_x;
|
||||
double pt_y;
|
||||
int Shape = 0;
|
||||
double ShapeParam1;
|
||||
double ShapeParam2;
|
||||
@ -38,8 +38,8 @@ struct envelope_node
|
||||
size_t get_hash() const
|
||||
{
|
||||
size_t seed = 0;
|
||||
seed ^= std::hash<double>()(Time) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= std::hash<double>()(Value) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= std::hash<double>()(pt_x) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= std::hash<double>()(pt_y) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= std::hash<int>()(Shape) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= std::hash<double>()(ShapeParam1) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= std::hash<double>()(ShapeParam2) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
@ -49,9 +49,9 @@ struct envelope_node
|
||||
|
||||
};
|
||||
|
||||
inline bool operator<(const envelope_node& a, const envelope_node& b)
|
||||
inline bool operator<(const envelope_point& a, const envelope_point& b)
|
||||
{
|
||||
return a.Time<b.Time;
|
||||
return a.pt_x<b.pt_x;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -147,36 +147,36 @@ inline double get_shaped_value(double x, int, double p1, double)
|
||||
#endif
|
||||
}
|
||||
|
||||
using nodes_t=std::vector<envelope_node>;
|
||||
using nodes_t=std::vector<envelope_point>;
|
||||
|
||||
inline double GetInterpolatedNodeValue(const nodes_t& m_nodes, double atime, double m_defvalue=0.5)
|
||||
{
|
||||
int maxnodeind=(int)m_nodes.size()-1;
|
||||
if (m_nodes.size()==0) return m_defvalue;
|
||||
if (m_nodes.size()==1) return m_nodes[0].Value;
|
||||
if (atime<=m_nodes[0].Time)
|
||||
return m_nodes[0].Value;
|
||||
if (atime>m_nodes[maxnodeind].Time)
|
||||
return m_nodes[maxnodeind].Value;
|
||||
const envelope_node to_search(atime,0.0);
|
||||
if (m_nodes.size()==1) return m_nodes[0].pt_y;
|
||||
if (atime<=m_nodes[0].pt_x)
|
||||
return m_nodes[0].pt_y;
|
||||
if (atime>m_nodes[maxnodeind].pt_x)
|
||||
return m_nodes[maxnodeind].pt_y;
|
||||
const envelope_point to_search(atime,0.0);
|
||||
//to_search.Time=atime;
|
||||
auto it=std::lower_bound(m_nodes.begin(),m_nodes.end(),to_search,
|
||||
[](const envelope_node& a, const envelope_node& b)
|
||||
{ return a.Time<b.Time; } );
|
||||
[](const envelope_point& a, const envelope_point& b)
|
||||
{ return a.pt_x<b.pt_x; } );
|
||||
if (it==m_nodes.end())
|
||||
{
|
||||
return m_defvalue;
|
||||
}
|
||||
--it; // lower_bound has returned iterator to point one too far
|
||||
double t1=it->Time;
|
||||
double v1=it->Value;
|
||||
double t1=it->pt_x;
|
||||
double v1=it->pt_y;
|
||||
double p1=it->ShapeParam1;
|
||||
double p2=it->ShapeParam2;
|
||||
++it; // next envelope point
|
||||
double tdelta=it->Time-t1;
|
||||
double tdelta=it->pt_x-t1;
|
||||
if (tdelta<0.00001)
|
||||
tdelta=0.00001;
|
||||
double vdelta=it->Value-v1;
|
||||
double vdelta=it->pt_y-v1;
|
||||
return v1+vdelta*get_shaped_value(((1.0/tdelta*(atime-t1))),0,p1,p2);
|
||||
|
||||
}
|
||||
@ -230,7 +230,7 @@ public:
|
||||
{
|
||||
ValueTree pt_tree("pt");
|
||||
storeToTreeProperties(pt_tree, nullptr,
|
||||
"x", m_nodes[i].Time, "y", m_nodes[i].Value, "p1", m_nodes[i].ShapeParam1, "p2", m_nodes[i].ShapeParam2);
|
||||
"x", m_nodes[i].pt_x, "y", m_nodes[i].pt_y, "p1", m_nodes[i].ShapeParam1, "p2", m_nodes[i].ShapeParam2);
|
||||
result.addChild(pt_tree, -1, nullptr);
|
||||
}
|
||||
result.setProperty("wrapxtransform", m_transform_wrap_x, nullptr);
|
||||
@ -263,8 +263,8 @@ public:
|
||||
MemoryBlock mb;
|
||||
for (int i = 0; i < m_nodes.size(); ++i)
|
||||
{
|
||||
appendToMemoryBlock(mb, m_nodes[i].Time);
|
||||
appendToMemoryBlock(mb, m_nodes[i].Value);
|
||||
appendToMemoryBlock(mb, m_nodes[i].pt_x);
|
||||
appendToMemoryBlock(mb, m_nodes[i].pt_y);
|
||||
appendToMemoryBlock(mb, m_nodes[i].ShapeParam1);
|
||||
appendToMemoryBlock(mb, m_nodes[i].ShapeParam2);
|
||||
}
|
||||
@ -279,7 +279,7 @@ public:
|
||||
return 0.0;
|
||||
if (index == 0)
|
||||
return 0.0;
|
||||
return m_nodes[index - 1].Time + margin;
|
||||
return m_nodes[index - 1].pt_x + margin;
|
||||
}
|
||||
double getNodeRightBound(int index, double margin = 0.01) const noexcept
|
||||
{
|
||||
@ -287,11 +287,11 @@ public:
|
||||
return 1.0;
|
||||
if (index == m_nodes.size()-1)
|
||||
return 1.0;
|
||||
return m_nodes[index + 1].Time - margin;
|
||||
return m_nodes[index + 1].pt_x - margin;
|
||||
}
|
||||
const std::vector<envelope_node>& get_all_nodes() const { return m_nodes; }
|
||||
const std::vector<envelope_point>& get_all_nodes() const { return m_nodes; }
|
||||
void set_all_nodes(nodes_t nds) { m_nodes=std::move(nds); }
|
||||
void set_reset_nodes(const std::vector<envelope_node>& nodes, bool convertvalues=false)
|
||||
void set_reset_nodes(const std::vector<envelope_point>& nodes, bool convertvalues=false)
|
||||
{
|
||||
if (convertvalues==false)
|
||||
m_reset_nodes=nodes;
|
||||
@ -302,8 +302,8 @@ public:
|
||||
m_nodes.clear();
|
||||
for (int i=0;i<nodes.size();++i)
|
||||
{
|
||||
envelope_node node=nodes[i];
|
||||
node.Value=scaled_to_normalized_func(node.Value);
|
||||
envelope_point node=nodes[i];
|
||||
node.pt_y=scaled_to_normalized_func(node.pt_y);
|
||||
m_nodes.push_back(node);
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ public:
|
||||
m_updateopinprogress=false;
|
||||
SortNodes();
|
||||
}
|
||||
void AddNode(envelope_node newnode)
|
||||
void AddNode(envelope_point newnode)
|
||||
{
|
||||
m_nodes.push_back(newnode);
|
||||
if (!m_updateopinprogress)
|
||||
@ -351,7 +351,7 @@ public:
|
||||
{
|
||||
m_nodes.erase(std::remove_if(std::begin(m_nodes),
|
||||
std::end(m_nodes),
|
||||
[t0,t1](const envelope_node& a) { return a.Time>=t0 && a.Time<=t1; } ),
|
||||
[t0,t1](const envelope_point& a) { return a.pt_x>=t0 && a.pt_x<=t1; } ),
|
||||
std::end(m_nodes) );
|
||||
}
|
||||
template<typename F>
|
||||
@ -359,7 +359,7 @@ public:
|
||||
{
|
||||
m_nodes.erase(std::remove_if(m_nodes.begin(), m_nodes.end(), predicate), m_nodes.end());
|
||||
}
|
||||
envelope_node& GetNodeAtIndex(int indx)
|
||||
envelope_point& GetNodeAtIndex(int indx)
|
||||
{
|
||||
if (m_nodes.size()==0)
|
||||
{
|
||||
@ -371,7 +371,7 @@ public:
|
||||
indx=(int)m_nodes.size()-1;
|
||||
return m_nodes[indx];
|
||||
}
|
||||
const envelope_node& GetNodeAtIndex(int indx) const
|
||||
const envelope_point& GetNodeAtIndex(int indx) const
|
||||
{
|
||||
if (m_nodes.size()==0)
|
||||
{
|
||||
@ -390,7 +390,7 @@ public:
|
||||
if (indx>(int)m_nodes.size()-1) i=(int)m_nodes.size()-1;
|
||||
m_nodes[i].Status=nstatus;
|
||||
}
|
||||
void SetNode(int indx, envelope_node anode)
|
||||
void SetNode(int indx, envelope_point anode)
|
||||
{
|
||||
int i=indx;
|
||||
if (indx<0) i=0;
|
||||
@ -402,8 +402,8 @@ public:
|
||||
int i=indx;
|
||||
if (indx<0) i=0;
|
||||
if (indx>(int)m_nodes.size()-1) i=(int)m_nodes.size()-1;
|
||||
if (setTime) m_nodes[i].Time=atime;
|
||||
if (setValue) m_nodes[i].Value=avalue;
|
||||
if (setTime) m_nodes[i].pt_x=atime;
|
||||
if (setValue) m_nodes[i].pt_y=avalue;
|
||||
}
|
||||
|
||||
|
||||
@ -419,8 +419,8 @@ public:
|
||||
if (m_nodes.size()==0)
|
||||
return m_defvalue;
|
||||
if (m_nodes.size()==1)
|
||||
return m_nodes[0].Value;
|
||||
if (atime<=m_nodes[0].Time)
|
||||
return m_nodes[0].pt_y;
|
||||
if (atime<=m_nodes[0].pt_x)
|
||||
{
|
||||
#ifdef INTERPOLATING_ENVELOPE_BORDERS
|
||||
t1=m_nodes[0].Time;
|
||||
@ -431,10 +431,10 @@ public:
|
||||
v1=m_nodes[0].Value;
|
||||
return interpolate_foo(atime,t0,v0,t1,v1,p1,p2);
|
||||
#else
|
||||
return m_nodes[0].Value;
|
||||
return m_nodes[0].pt_y;
|
||||
#endif
|
||||
}
|
||||
if (atime>m_nodes[maxnodeind].Time)
|
||||
if (atime>m_nodes[maxnodeind].pt_x)
|
||||
{
|
||||
#ifdef INTERPOLATING_ENVELOPE_BORDERS
|
||||
t0=m_nodes[maxnodeind].Time;
|
||||
@ -445,40 +445,40 @@ public:
|
||||
p2=m_nodes[maxnodeind].ShapeParam2;
|
||||
return interpolate_foo(atime,t0,v0,t1,v1,p1,p2);
|
||||
#else
|
||||
return m_nodes.back().Value;
|
||||
return m_nodes.back().pt_y;
|
||||
#endif
|
||||
}
|
||||
const envelope_node to_search(atime,0.0);
|
||||
const envelope_point to_search(atime,0.0);
|
||||
//to_search.Time=atime;
|
||||
auto it=std::lower_bound(m_nodes.begin(),m_nodes.end(),to_search,
|
||||
[](const envelope_node& a, const envelope_node& b)
|
||||
{ return a.Time<b.Time; } );
|
||||
[](const envelope_point& a, const envelope_point& b)
|
||||
{ return a.pt_x<b.pt_x; } );
|
||||
if (it==m_nodes.end())
|
||||
{
|
||||
return m_defvalue;
|
||||
}
|
||||
--it; // lower_bound has returned iterator to point one too far
|
||||
t0=it->Time;
|
||||
v0=it->Value;
|
||||
t0=it->pt_x;
|
||||
v0=it->pt_y;
|
||||
p1=it->ShapeParam1;
|
||||
p2=it->ShapeParam2;
|
||||
++it; // next envelope point
|
||||
t1=it->Time;
|
||||
v1=it->Value;
|
||||
t1=it->pt_x;
|
||||
v1=it->pt_y;
|
||||
return interpolate_foo(atime,t0,v0,t1,v1,p1,p2);
|
||||
}
|
||||
bool IsSorted() const
|
||||
{
|
||||
return std::is_sorted(m_nodes.begin(), m_nodes.end(), []
|
||||
(const envelope_node& lhs, const envelope_node& rhs)
|
||||
(const envelope_point& lhs, const envelope_point& rhs)
|
||||
{
|
||||
return lhs.Time<rhs.Time;
|
||||
return lhs.pt_x<rhs.pt_x;
|
||||
});
|
||||
}
|
||||
void SortNodes()
|
||||
{
|
||||
stable_sort(m_nodes.begin(),m_nodes.end(),
|
||||
[](const envelope_node& a, const envelope_node& b){ return a.Time<b.Time; } );
|
||||
[](const envelope_point& a, const envelope_point& b){ return a.pt_x<b.pt_x; } );
|
||||
}
|
||||
double minimum_value() const { return m_minvalue; }
|
||||
double maximum_value() const { return m_maxvalue; }
|
||||
@ -503,7 +503,7 @@ public:
|
||||
{
|
||||
for (int i = 0; i < m_old_nodes.size(); ++i)
|
||||
{
|
||||
envelope_node node = m_old_nodes[i];
|
||||
envelope_point node = m_old_nodes[i];
|
||||
f(i, node);
|
||||
node.ShapeParam1 = jlimit(0.0, 1.0, node.ShapeParam1);
|
||||
m_nodes[i] = node;
|
||||
@ -513,11 +513,11 @@ public:
|
||||
{
|
||||
if (index >= m_old_nodes.size())
|
||||
{
|
||||
m_nodes.back().Value = jlimit(0.0,1.0,m_old_nodes.back().Value+amount);
|
||||
m_nodes.back().pt_y = jlimit(0.0,1.0,m_old_nodes.back().pt_y+amount);
|
||||
return;
|
||||
}
|
||||
m_nodes[index].Value = jlimit(0.0, 1.0, m_old_nodes[index].Value + amount);
|
||||
m_nodes[index+1].Value = jlimit(0.0, 1.0, m_old_nodes[index+1].Value + amount);
|
||||
m_nodes[index].pt_y = jlimit(0.0, 1.0, m_old_nodes[index].pt_y + amount);
|
||||
m_nodes[index+1].pt_y = jlimit(0.0, 1.0, m_old_nodes[index+1].pt_y + amount);
|
||||
}
|
||||
const nodes_t& repeater_nodes() const
|
||||
{
|
||||
@ -528,10 +528,10 @@ public:
|
||||
m_repeater_nodes.clear();
|
||||
for (int i=0;i<m_nodes.size();++i)
|
||||
{
|
||||
if (m_nodes[i].Time>=m_playoffset && m_nodes[i].Time<=m_playoffset+1.0)
|
||||
if (m_nodes[i].pt_x>=m_playoffset && m_nodes[i].pt_x<=m_playoffset+1.0)
|
||||
{
|
||||
envelope_node temp=m_nodes[i];
|
||||
temp.Time-=m_playoffset;
|
||||
envelope_point temp=m_nodes[i];
|
||||
temp.pt_x-=m_playoffset;
|
||||
m_repeater_nodes.push_back(temp);
|
||||
}
|
||||
}
|
||||
@ -558,17 +558,17 @@ public:
|
||||
if (m_nodes.size() == 0)
|
||||
return;
|
||||
|
||||
envelope_node pt0 = GetNodeAtIndex(point_index);
|
||||
envelope_node pt1 = GetNodeAtIndex(point_index+1);
|
||||
double xdiff = pt1.Time - pt0.Time;
|
||||
envelope_point pt0 = GetNodeAtIndex(point_index);
|
||||
envelope_point pt1 = GetNodeAtIndex(point_index+1);
|
||||
double xdiff = pt1.pt_x - pt0.pt_x;
|
||||
if (xdiff > 0.0)
|
||||
{
|
||||
int numsegments = numsegmentsfunc(xdiff);
|
||||
for (int j=0;j<numsegments;++j)
|
||||
{
|
||||
double cb_x0 = pt0.Time + xdiff / (numsegments)*j;
|
||||
double cb_x0 = pt0.pt_x + xdiff / (numsegments)*j;
|
||||
double cb_y0 = GetInterpolatedNodeValue(cb_x0);
|
||||
double cb_x1 = pt0.Time + xdiff / (numsegments)*(j+1);
|
||||
double cb_x1 = pt0.pt_x + xdiff / (numsegments)*(j+1);
|
||||
double cb_y1 = GetInterpolatedNodeValue(cb_x1);
|
||||
handlesegmentfunc(cb_x0, cb_y0,cb_x1,cb_y1);
|
||||
}
|
||||
@ -642,8 +642,8 @@ public:
|
||||
double maxv = 0.0;
|
||||
for (auto& e : m_nodes)
|
||||
{
|
||||
minv = std::min(minv, e.Value);
|
||||
maxv = std::max(maxv, e.Value);
|
||||
minv = std::min(minv, e.pt_y);
|
||||
maxv = std::max(maxv, e.pt_y);
|
||||
}
|
||||
m_minvalue = minv;
|
||||
m_maxvalue = maxv;
|
||||
|
Loading…
Reference in New Issue
Block a user