summaryrefslogtreecommitdiff
path: root/muse2/muse/arranger/pcanvas.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-08-30 01:14:15 +0000
committerTim E. Real <termtech@rogers.com>2011-08-30 01:14:15 +0000
commit0f08cac5b167b989ccf3607a231ee5e992cdee05 (patch)
tree8f81066a386da313feda5f134a34ede9d829b36e /muse2/muse/arranger/pcanvas.cpp
parentfe843e9d861971a7053e26570d7854f048e3eb7e (diff)
Small fix - could not add new points to discrete automation graphs.
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 57bf71ba..ef45c9df 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -3587,6 +3587,7 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt
double min, max;
cl->range(&min,&max);
//bool discrete = cl->valueType() == VAL_BOOL || cl->mode() == CtrlList::DISCRETE; // Tim
+ bool discrete = cl->mode() == CtrlList::DISCRETE;
// First check that there IS automation, ic == cl->end means no automation
if (ic == cl->end())
@@ -3611,7 +3612,7 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt
}
else
y = (y-min)/(max-min); // we need to set curVal between 0 and 1
-
+
ypixel = mapy(trackY + trackH - 2 - y * trackH);
xpixel = mapx(tempomap.frame2tick(ic->second.frame));
@@ -3625,7 +3626,7 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt
double firstX=oldX;
double lastX=xpixel;
double firstY=oldY;
- double lastY=ypixel;
+ double lastY = discrete ? oldY : ypixel;
double proportion = (currX-firstX)/(lastX-firstX);
@@ -3807,7 +3808,8 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint)
// we need to set val between 0 and 1 (unless integer)
cvval = yfraction * (max-min) + min;
// 'Snap' to integer or boolean
- if (automation.currentCtrlList->valueType() == VAL_INT || automation.currentCtrlList->valueType() == VAL_BOOL)
+ //if (automation.currentCtrlList->valueType() == VAL_INT || automation.currentCtrlList->valueType() == VAL_BOOL)
+ if (automation.currentCtrlList->mode() == CtrlList::DISCRETE)
cvval = rint(cvval + 0.1); // LADSPA docs say add a slight bias to avoid rounding errors. Try this.
if (cvval< min) cvval=min;
if (cvval>max) cvval=max;