summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-11-02 15:28:41 +0000
committerWerner Schweer <ws.seh.de>2006-11-02 15:28:41 +0000
commitfdcce890fad0639086ff19d3159366aed9cf2ed0 (patch)
treee37e2eef0932d41d7c60f23cc9cdef13a820ef1d
parent16ffdc43b5101899e8cf3ce343187a8754f58178 (diff)
controller & automation updates
-rw-r--r--muse/muse/arranger/canvas.cpp2
-rw-r--r--muse/muse/audiotrack.cpp2
-rw-r--r--muse/muse/ctrl.cpp139
-rw-r--r--muse/muse/ctrl.h39
-rw-r--r--muse/muse/ctrl/ctrleditor.cpp116
-rw-r--r--muse/muse/ctrl/ctrleditor.h5
-rw-r--r--muse/muse/exportmidi.cpp4
-rw-r--r--muse/muse/midiedit/ecanvas.cpp2
-rw-r--r--muse/muse/midiout.cpp18
-rw-r--r--muse/muse/mixer/astrip.cpp3
-rw-r--r--muse/muse/song.cpp18
-rw-r--r--muse/muse/track.cpp2
-rw-r--r--muse/muse/track.h2
13 files changed, 177 insertions, 175 deletions
diff --git a/muse/muse/arranger/canvas.cpp b/muse/muse/arranger/canvas.cpp
index b3c56a6c..17dec5d5 100644
--- a/muse/muse/arranger/canvas.cpp
+++ b/muse/muse/arranger/canvas.cpp
@@ -565,7 +565,7 @@ void PartCanvas::mousePress(QMouseEvent* me)
if (hit == HIT_SUBTRACK) {
TLSWidget* w = (TLSWidget*)(at->tw);
int y = wpos.y() + pos.y() - w->y();
- w->mousePress(QPoint(pos.x(), y), button);
+ w->mousePress(QPoint(pos.x(), y), button, me->modifiers());
state = S_SUBTRACK;
return;
}
diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp
index 1639a19a..b1a72db3 100644
--- a/muse/muse/audiotrack.cpp
+++ b/muse/muse/audiotrack.cpp
@@ -133,7 +133,7 @@ void AudioTrack::addPlugin(PluginI* plugin, int idx, bool pre)
}
cl->setRange(min, max);
cl->setName(name);
- plugin->setParam(i, cl->schedVal().f);
+ plugin->setParam(i, cl->curVal().f);
plugin->setControllerList(cl);
}
}
diff --git a/muse/muse/ctrl.cpp b/muse/muse/ctrl.cpp
index b505744e..2e40f297 100644
--- a/muse/muse/ctrl.cpp
+++ b/muse/muse/ctrl.cpp
@@ -34,8 +34,6 @@ Ctrl::Ctrl(int id, const QString& s, int t)
setRange(.0f, 1.f);
_default.f = 0.0f;
_curVal.f = 0.0f;
- _schedVal.f = 0.0f;
- _schedValRaw.f = 0.0f;
_touched = false;
_changed = false;
}
@@ -49,7 +47,6 @@ Ctrl::Ctrl(int id, const QString& s, int t, float a, float b)
setRange(a, b);
_default.f = 0.0f;
_curVal.f = 0.0f;
- _schedValRaw.f = 0.0f;
_touched = false;
_changed = false;
}
@@ -61,7 +58,6 @@ Ctrl::Ctrl()
_id = 0;
_default.f = 0.0f;
_curVal.f = 0.0f;
- _schedValRaw.f = 0.0f;
_touched = false;
_changed = false;
}
@@ -73,7 +69,6 @@ Ctrl::Ctrl(const MidiController* mc)
_id = mc->num();
_default.i = mc->initVal();
_curVal.i = CTRL_VAL_UNKNOWN;
- _schedValRaw.i = CTRL_VAL_UNKNOWN;
_name = mc->name();
_touched = false;
_changed = false;
@@ -93,54 +88,59 @@ CVal Ctrl::value(unsigned time)
//
// midi controller
//
- ciCtrlVal i = upper_bound(time);
+ ciCtrlVal i = upperBound(time);
if (i == end()) {
--i;
- rv = i->second;
+ rv = i.value();
}
else if (i == begin()) {
- if (i->first == time)
- rv = i->second;
+ if (i.key() == time)
+ rv = i.value();
else
return _curVal;
}
else {
--i;
- rv = i->second;
+ rv = i.value();
}
}
else {
- ciCtrlVal i = upper_bound(time);
+ //
+ // linear interpolated audio
+ // controller
+ //
+ ciCtrlVal i = upperBound(time);
if (i == end()) {
--i;
- return i->second;
- }
- int frame2 = i->first;
- CVal val2 = i->second;
- int frame1;
- CVal val1;
- if (i == begin()) {
- frame1 = 0;
- val1 = _default;
- }
- else {
- --i;
- frame1 = i->first;
- val1 = i->second;
- }
- time -= frame1;
- frame2 -= frame1;
- if (_type & INT) {
- val2.i -= val1.i;
- rv.i = val1.i + (time * val2.i)/frame2;
+ rv = i.value();
}
else {
- val2.f -= val1.f;
- rv.f = val1.f + (time * val2.f)/frame2;
+ int frame2 = i.key();
+ CVal val2 = i.value();
+ int frame1;
+ CVal val1;
+ if (i == begin()) {
+ rv = val2;
+ }
+ else {
+ --i;
+ frame1 = i.key();
+ val1 = i.value();
+ time -= frame1;
+ frame2 -= frame1;
+ if (_type & INT) {
+ val2.i -= val1.i;
+ rv.i = val1.i + (time * val2.i)/frame2;
+ }
+ else {
+ val2.f -= val1.f;
+ rv.f = val1.f + (time * val2.f)/frame2;
+ }
+ }
}
}
if (_type & LOG) {
- if (rv.f == -1000.0f)
+ if (rv.f <= -1000.0f)
rv.f = 0.0f;
else
rv.f = pow(10.0f, rv.f);
@@ -157,35 +157,13 @@ bool Ctrl::add(unsigned frame, CVal val)
{
if (_type & LOG) {
if (val.f <= 0.0)
- val.f = -1000.0f;
+ val.f = -1001.0f;
else
val.f = fast_log10(val.f);
}
- iCtrlVal e = find(frame);
- if (e != end()) {
- e->second = val;
- return false;
- }
- insert(std::pair<const int, CVal> (frame, val));
- return true;
- }
-
-//---------------------------------------------------------
-// setSchedVal
-//---------------------------------------------------------
-
-void Ctrl::setSchedVal(CVal val)
- {
- if (_type & LOG) {
- if (val.f <= 0.0)
- _schedValRaw.f = -1000.0f;
- else
- _schedValRaw.f = fast_log10(val.f);
- }
- else {
- _schedValRaw = val;
- }
- _schedVal = val;
+ bool rv = find(frame) == end();
+ insert(frame, val);
+ return rv;
}
//---------------------------------------------------------
@@ -228,7 +206,7 @@ void Ctrl::read(QDomNode node, bool)
_curVal.f = e.attribute("cur","0.0").toFloat();
_default.f = e.attribute("default","0.0").toFloat();
}
- setSchedVal(_curVal);
+ setCurVal(_curVal);
if (_type & INT) {
min.i = e.attribute("min", minS).toInt();
max.i = e.attribute("max", maxS).toInt();
@@ -284,24 +262,24 @@ void Ctrl::write(Xml& xml)
if (empty()) {
if (_type & INT)
- xml.tagE(s.arg(id()).arg(_name).arg(schedVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data());
+ xml.tagE(s.arg(id()).arg(_name).arg(curVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data());
else
- xml.tagE(s.arg(id()).arg(_name).arg(schedVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data());
+ xml.tagE(s.arg(id()).arg(_name).arg(curVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data());
return;
}
if (_type & INT)
- xml.tag(s.arg(id()).arg(_name).arg(schedVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data());
+ xml.tag(s.arg(id()).arg(_name).arg(curVal().i).arg(_type).arg(min.i).arg(max.i).arg(_default.i).toAscii().data());
else
- xml.tag(s.arg(id()).arg(_name).arg(schedVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data());
+ xml.tag(s.arg(id()).arg(_name).arg(curVal().f).arg(_type).arg(min.f).arg(max.f).arg(_default.f).toAscii().data());
int i = 0;
for (ciCtrlVal ic = begin(); ic != end(); ++ic) {
if (i == 0)
xml.putLevel();
- int time = ic->first;
- CVal val = ic->second;
+ int time = ic.key();
+ CVal val = ic.value();
if (_type & LOG)
- val.f = (val.f == -1000.0) ? 0.0f : pow(10.0f, val.f);
+ val.f = (val.f <= -1000.0) ? 0.0f : pow(10.0f, val.f);
if (_type & INT) {
xml.nput("%d %d,", time, val.i);
}
@@ -333,8 +311,11 @@ int Ctrl::val2pixelR(CVal val, int maxpixel)
maxpixel -= 1;
if (_type & INT)
return maxpixel - ((maxpixel * (val.i - min.i) + (max.i-min.i)/2) / (max.i - min.i));
- else
+ else {
+ if ((_type & LOG) && (val.f <= -1000.0f))
+ return maxpixel;
return maxpixel - lrint(double(maxpixel) * (val.f - min.f) / (max.f-min.f));
+ }
}
int Ctrl::val2pixelR(int val, int maxpixel)
@@ -345,6 +326,26 @@ int Ctrl::val2pixelR(int val, int maxpixel)
}
//---------------------------------------------------------
+// cur2pixel
+//---------------------------------------------------------
+
+int Ctrl::cur2pixel(int maxpixel)
+ {
+ maxpixel -= 1;
+
+ if (_type & INT)
+ return maxpixel - ((maxpixel * (_curVal.i - min.i) + (max.i-min.i)/2) / (max.i - min.i));
+ float f = _curVal.f;
+ if (_type & LOG) {
+ if (f <= 0.0)
+ return maxpixel;
+ else
+ f = fast_log10(f);
+ }
+ return maxpixel - lrint(double(maxpixel) * (f - min.f) / (max.f-min.f));
+ }
+
+//---------------------------------------------------------
// pixel2val
//---------------------------------------------------------
diff --git a/muse/muse/ctrl.h b/muse/muse/ctrl.h
index 34a81c79..6a3705f0 100644
--- a/muse/muse/ctrl.h
+++ b/muse/muse/ctrl.h
@@ -136,7 +136,7 @@ class CtrlRecList : public std::list<CtrlRecVal> {
};
typedef CtrlRecList::iterator iCtrlRec;
-typedef std::map<unsigned, CVal, std::less<unsigned> > CTRL;
+typedef QMap<unsigned, CVal> CTRL;
typedef CTRL::iterator iCtrlVal;
typedef CTRL::const_iterator ciCtrlVal;
@@ -162,10 +162,7 @@ class Ctrl : public CTRL {
QString _name;
int _type; // bitmask of CtrlType
CVal _default;
- CVal _curVal; // used to optimize controller events send to
- // midi devices
- CVal _schedVal; // used by gui to determine "current" value
- CVal _schedValRaw;
+ CVal _curVal; // used to optimize controller events
CVal min, max;
bool _changed;
bool _touched;
@@ -177,35 +174,16 @@ class Ctrl : public CTRL {
Ctrl(int id, const QString& name, int t, float a, float b);
int type() const { return _type; }
void setType(int t) { _type = t; }
- CVal getDefault() const { return _default; }
+
+ const CVal& getDefault() const { return _default; }
void setDefault(float val) { _default.f = val; }
void setDefault(CVal val) { _default = val; }
void setDefault(int val) { _default.i = val; }
- CVal curVal() const { return _curVal; }
- void setCurVal(CVal v) {
- _curVal = v;
- setSchedVal(v);
- }
- void setCurVal(float v) {
- _curVal.f = v;
- CVal val;
- val.f = v;
- setSchedVal(val);
- }
- void setCurVal(int v) {
- _curVal.i = v;
- _schedVal.i = v;
- _schedValRaw.i = v;
- }
-
- void setSchedVal(int v) {
- _schedVal.i = v;
- _schedValRaw.i = v;
- }
- void setSchedVal(CVal v);
- CVal schedVal() const { return _schedVal; }
- CVal schedValRaw() const { return _schedValRaw; }
+ const CVal& curVal() const { return _curVal; }
+ void setCurVal(CVal v) { _curVal = v; }
+ void setCurVal(float v) { _curVal.f = v; }
+ void setCurVal(int v) { _curVal.i = v; }
int id() const { return _id; }
void setId(int i) { _id = i; }
@@ -225,6 +203,7 @@ class Ctrl : public CTRL {
void read(QDomNode node, bool midi);
void write(Xml&);
int val2pixelR(CVal, int maxpixel);
+ int cur2pixel(int maxpixel);
int val2pixelR(int, int maxpixel);
CVal pixel2val(int pixel, int maxpixel);
CVal pixel2valR(int pixel, int maxpixel);
diff --git a/muse/muse/ctrl/ctrleditor.cpp b/muse/muse/ctrl/ctrleditor.cpp
index 01e86a58..13f3bc49 100644
--- a/muse/muse/ctrl/ctrleditor.cpp
+++ b/muse/muse/ctrl/ctrleditor.cpp
@@ -58,6 +58,17 @@ inline static void drawHandle(QPainter& p, int x, int y, int lselected)
}
//---------------------------------------------------------
+// ctrlY
+//---------------------------------------------------------
+
+int CtrlEditor::ctrlY(int x, const CVal& val) const
+ {
+ if (dragy != -1 && lselected == x)
+ return dragy;
+ return ctrl()->val2pixelR(val, cheight());
+ }
+
+//---------------------------------------------------------
// paint
//---------------------------------------------------------
@@ -111,51 +122,61 @@ void CtrlEditor::paint(QPainter& p, const QRect& r)
}
}
else {
- if (!ctrl()->empty()) {
- int x1 = from, y1 = 0, x2 = 0, y2 = 0;
- ciCtrlVal i = ctrl()->begin();
- if (i != ctrl()->end()) {
- x1 = tc()->pos2pix(Pos(i->first, tt));
- if (dragy != -1 && lselected == x1)
- y1 = dragy;
- else
- y1 = ctrl()->val2pixelR(i->second, th);
- if (x1 >= from)
- drawHandle(p, x1, y1, lselected);
+ if (ctrl()->empty()) {
+ if (aR) {
+ int y = ctrl()->cur2pixel(th);
+ p.drawLine(r.x(), y, r.x() + r.width(), y);
}
- for (; i != ctrl()->end(); ++i) {
- x2 = tc()->pos2pix(Pos(i->first, tt));
- if (dragy != -1 && lselected == x2)
- y2 = dragy;
+ }
+ else {
+ int x1, y1, x2, y2;
+
+
+ Pos pos1 = tc()->pix2pos(from);
+ ciCtrlVal i = ctrl()->lowerBound(pos1.time(tt));
+
+ if (i == ctrl()->end()) {
+ --i;
+ int x = tc()->pos2pix(Pos(i.key(), tt));
+ int y = ctrlY(x, i.value());
+ p.drawLine(r.x(), y, r.x() + r.width(), y);
+ }
+ else {
+ if (i == ctrl()->begin()) {
+ x1 = tc()->pos2pix(Pos(i.key(), tt));
+ y1 = ctrlY(x1, i.value());
+ x1 = r.x();
+ }
else {
- y2 = ctrl()->val2pixelR(i->second, th);
+ --i;
+ x1 = tc()->pos2pix(Pos(i.key(), tt));
+ y1 = ctrlY(x1, i.value());
+ drawHandle(p, x1, y1, lselected);
+ ++i;
}
- if (x2 >= to)
- break;
- if (x2 >= from) {
+ do {
+ x2 = tc()->pos2pix(Pos(i.key(), tt));
+ y2 = ctrlY(x2, i.value());
if (ctrl()->type() & Ctrl::DISCRETE) {
p.drawLine(x1, y1, x2, y1);
p.drawLine(x2, y1, x2, y2);
}
else
p.drawLine(x1, y1, x2, y2);
- drawHandle(p, x1, y1, lselected);
+ if (x2 >= to)
+ break;
+ drawHandle(p, x2, y2, lselected);
+ x1 = x2;
+ y1 = y2;
+ ++i;
+ } while (i != ctrl()->end());
+ if (x2 < to) {
+ p.drawLine(x2, y1, to, y1);
}
- x1 = x2;
- y1 = y2;
- }
- if (x1 < to) {
- if (i == ctrl()->end())
- x2 = to;
- if (ctrl()->type() & Ctrl::DISCRETE)
- y2 = y1;
- p.drawLine(x1, y1, x2, y2);
- drawHandle(p, x1, y1, lselected);
}
}
if (!aR) {
- p.setPen(QPen(Qt::white, 2));
- int y = ctrl()->val2pixelR(ctrl()->schedValRaw(), th);
+ int y = ctrl()->cur2pixel(th);
p.drawLine(r.x(), y, r.x() + r.width(), y);
}
}
@@ -183,7 +204,7 @@ void CtrlEditor::paint(QPainter& p, const QRect& r)
// mousePress
//---------------------------------------------------------
-void CtrlEditor::mousePress(const QPoint& pos, int button)
+void CtrlEditor::mousePress(const QPoint& pos, int button, Qt::KeyboardModifiers modifiers)
{
Tool tool = tc()->tool();
if (button & Qt::RightButton) {
@@ -214,7 +235,7 @@ void CtrlEditor::mousePress(const QPoint& pos, int button)
int cid = ctrl()->id();
- if (tool == PencilTool) {
+ if (tool == PencilTool || (modifiers & Qt::ShiftModifier)) {
selected = tc()->pix2pos(x);
lselected = x;
dragy = y;
@@ -240,19 +261,20 @@ void CtrlEditor::mousePress(const QPoint& pos, int button)
Pos pos2(tc()->pix2pos(x + HANDLE2));
TType tt = track()->timeType();
- ciCtrlVal s = ctrl()->upper_bound(pos1.time(tt));
- ciCtrlVal e = ctrl()->upper_bound(pos2.time(tt));
+ ciCtrlVal s = ctrl()->upperBound(pos1.time(tt));
+ ciCtrlVal e = ctrl()->upperBound(pos2.time(tt));
for (ciCtrlVal i = s; i != e; ++i) {
- int yy = ctrl()->val2pixelR(i->second, wh);
+ int yy = ctrl()->val2pixelR(i.value(), wh);
startY = yy;
if ((yy >= (y-HANDLE2)) && (yy < (y + HANDLE2))) {
if (tt == AL::TICKS)
- selected.setTick(i->first);
+ selected.setTick(i.key());
else
- selected.setFrame(i->first);
+ selected.setFrame(i.key());
lselected = tc()->pos2pix(selected);
- if (tool == RubberTool || button == Qt::RightButton) {
- song->removeControllerVal(ctrlTrack(), ctrl()->id(), i->first);
+ if (tool == RubberTool || button == Qt::RightButton
+ || modifiers & Qt::ControlModifier) {
+ song->removeControllerVal(ctrlTrack(), ctrl()->id(), i.key());
dragy = -1;
}
else {
@@ -417,18 +439,18 @@ void CtrlEditor::mouseMove(const QPoint& pos)
Pos pos2(tc()->pix2pos(x + HANDLE2));
TType tt = track()->timeType();
- ciCtrlVal s = ctrl()->upper_bound(pos1.time(tt));
- ciCtrlVal e = ctrl()->upper_bound(pos2.time(tt));
+ ciCtrlVal s = ctrl()->upperBound(pos1.time(tt));
+ ciCtrlVal e = ctrl()->upperBound(pos2.time(tt));
for (ciCtrlVal i = s; i != e; ++i) {
- int yy = ctrl()->val2pixelR(i->second, wh);
+ int yy = ctrl()->val2pixelR(i.value(), wh);
startY = yy;
if ((yy >= (y-HANDLE2)) && (yy < (y + HANDLE2))) {
if (tt == AL::TICKS)
- selected.setTick(i->first);
+ selected.setTick(i.key());
else
- selected.setFrame(i->first);
+ selected.setFrame(i.key());
lselected = tc()->pos2pix(selected);
- song->removeControllerVal(ctrlTrack(), ctrl()->id(), i->first);
+ song->removeControllerVal(ctrlTrack(), ctrl()->id(), i.key());
dragy = -1;
break;
}
diff --git a/muse/muse/ctrl/ctrleditor.h b/muse/muse/ctrl/ctrleditor.h
index 3df29507..11f042fa 100644
--- a/muse/muse/ctrl/ctrleditor.h
+++ b/muse/muse/ctrl/ctrleditor.h
@@ -26,6 +26,7 @@
class Ctrl;
class TimeCanvas;
class Track;
+struct CVal;
//---------------------------------------------------------
// CtrlEditor
@@ -50,6 +51,8 @@ class CtrlEditor {
virtual Track* track() const = 0;
virtual Track* ctrlTrack() const = 0;
+ int ctrlY(int x, const CVal&) const;
+
protected:
int singlePitch;
@@ -58,7 +61,7 @@ class CtrlEditor {
virtual ~CtrlEditor() {}
void paint(QPainter& p, const QRect& r);
void setDrawCtrlName(bool val) { _drawCtrlName = val; }
- void mousePress(const QPoint&, int);
+ void mousePress(const QPoint&, int, Qt::KeyboardModifiers);
void mouseRelease();
void mouseMove(const QPoint& pos);
};
diff --git a/muse/muse/exportmidi.cpp b/muse/muse/exportmidi.cpp
index 94838d4e..fb17e485 100644
--- a/muse/muse/exportmidi.cpp
+++ b/muse/muse/exportmidi.cpp
@@ -161,8 +161,8 @@ void MusE::exportMidi()
Ctrl* c = ivl->second;
int id = c->id();
for (iCtrlVal iv = c->begin(); iv != c->end(); ++iv) {
- int tick = ivl->first;
- int val = iv->second.i;
+ int tick = iv.key();
+ int val = iv.value().i;
addController(l, tick, port, channel, id, val);
}
}
diff --git a/muse/muse/midiedit/ecanvas.cpp b/muse/muse/midiedit/ecanvas.cpp
index 757856fe..3373805a 100644
--- a/muse/muse/midiedit/ecanvas.cpp
+++ b/muse/muse/midiedit/ecanvas.cpp
@@ -1192,7 +1192,7 @@ void EventCanvas::mousePress(QMouseEvent* me)
QRect r(rCanvasB.x(), rCanvasB.y() + c->y + splitWidth,
rCanvasB.width(), c->cheight());
if (r.contains(pos)) {
- c->mousePress(pos - r.topLeft(), me->button());
+ c->mousePress(pos - r.topLeft(), me->button(), me->modifiers());
break;
}
}
diff --git a/muse/muse/midiout.cpp b/muse/muse/midiout.cpp
index 788d7ace..fc04b586 100644
--- a/muse/muse/midiout.cpp
+++ b/muse/muse/midiout.cpp
@@ -322,7 +322,7 @@ void MidiOut::reset()
// _playEvents queue which is processed by the MidiSeq thread.
//-------------------------------------------------------------------
-void MidiOut::processMidi(MPEventList& el, unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame)
+void MidiOut::processMidi(MPEventList& el, unsigned fromTick, unsigned toTick, unsigned /*fromFrame*/, unsigned /*toFrame*/)
{
while (!eventFifo.isEmpty())
el.add(eventFifo.get());
@@ -332,13 +332,13 @@ void MidiOut::processMidi(MPEventList& el, unsigned fromTick, unsigned toTick, u
CtrlList* cl = track->controller();
for (iCtrl ic = cl->begin(); ic != cl->end(); ++ic) {
Ctrl* c = ic->second;
- iCtrlVal is = c->lower_bound(fromTick);
- iCtrlVal ie = c->lower_bound(toTick);
+ iCtrlVal is = c->lowerBound(fromTick);
+ iCtrlVal ie = c->lowerBound(toTick);
for (iCtrlVal ic = is; ic != ie; ++ic) {
- unsigned frame = AL::tempomap.tick2frame(ic->first);
+ unsigned frame = AL::tempomap.tick2frame(ic.key());
Event ev(Controller);
ev.setA(c->id());
- ev.setB(ic->second.i);
+ ev.setB(ic.value().i);
el.add(MidiEvent(frame, -1, ev));
}
}
@@ -353,13 +353,13 @@ void MidiOut::processMidi(MPEventList& el, unsigned fromTick, unsigned toTick, u
CtrlList* cl = mc->controller();
for (iCtrl ic = cl->begin(); ic != cl->end(); ++ic) {
Ctrl* c = ic->second;
- iCtrlVal is = c->lower_bound(fromTick);
- iCtrlVal ie = c->lower_bound(toTick);
+ iCtrlVal is = c->lowerBound(fromTick);
+ iCtrlVal ie = c->lowerBound(toTick);
for (; is != ie; ++is) {
- unsigned frame = AL::tempomap.tick2frame(is->first);
+ unsigned frame = AL::tempomap.tick2frame(is.key());
Event ev(Controller);
ev.setA(c->id());
- ev.setB(is->second.i);
+ ev.setB(is.value().i);
el.add(MidiEvent(frame, ch, ev));
}
}
diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp
index c7a6c071..7462b575 100644
--- a/muse/muse/mixer/astrip.cpp
+++ b/muse/muse/mixer/astrip.cpp
@@ -601,7 +601,7 @@ static void addWavePorts(AudioTrack* t, QMenu* lb, RouteList* r, bool input)
//---------------------------------------------------------
// addMidiOutPorts
//---------------------------------------------------------
-
+#if 0
static void addMidiOutPorts(Track* t, QMenu* lb, RouteList* r)
{
MidiOutPortList* al = song->midiOutPorts();
@@ -645,6 +645,7 @@ static void addMidiInPorts(Track* t, QMenu* lb, RouteList* r)
}
}
}
+#endif
//---------------------------------------------------------
// addSyntiPorts
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index 2ae02fee..6e06ef80 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -1358,9 +1358,10 @@ void Song::stopRolling()
start = AL::tempomap.frame2tick(start);
end = AL::tempomap.frame2tick(end);
}
- iCtrlVal s = cl->lower_bound(start);
- iCtrlVal e = cl->lower_bound(end);
- cl->erase(s, e);
+ iCtrlVal s = cl->lowerBound(start);
+ iCtrlVal e = cl->lowerBound(end);
+ while (s != e)
+ cl->erase(s++);
hasEvents = true;
break;
}
@@ -2210,7 +2211,7 @@ void Song::addControllerVal(Track* t, Ctrl* c, const Pos& p, CVal val)
// current value may have changed
unsigned ctime = t->timeType() == AL::FRAMES ? pos[0].frame() : pos[0].tick();
CVal cval = c->value(ctime);
- if (c->schedVal().i != cval.i) {
+ if (c->curVal().i != cval.i) {
if (t->isMidiTrack()) {
if (t->type() == Track::MIDI_CHANNEL) {
MidiChannel* mc = (MidiChannel*)t;
@@ -2218,12 +2219,7 @@ void Song::addControllerVal(Track* t, Ctrl* c, const Pos& p, CVal val)
mc->playMidiEvent(&ev);
}
}
- else {
- // non midi controller are current once set
- c->setCurVal(cval);
- }
- c->setSchedVal(cval);
- // t->emitControllerChanged(c->id());
+ c->setCurVal(cval);
}
}
t->emitControllerChanged(c->id()); //moved this out here, otherwise canvas is not updated
@@ -2270,7 +2266,7 @@ void Song::setControllerVal(Track* t, Ctrl* c, CVal val)
pipe->plugin(pluginIndex)->setParam(ctrlIndex, val.f);
}
}
- c->setSchedVal(val);
+ c->setCurVal(val);
if (t->autoWrite()) {
unsigned time = t->timeType() == AL::FRAMES ? pos[0].frame() : pos[0].tick();
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index 88cb3f9b..2463b3ec 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -329,7 +329,7 @@ bool Track::readProperties(QDomNode node)
else { //???
Ctrl* d = icl->second;
for (iCtrlVal i = l->begin(); i != l->end(); ++i)
- d->insert(std::pair<const unsigned, CVal> (i->first, i->second));
+ d->insert(i.key(), i.value());
d->setCurVal(l->curVal());
d->setDefault(l->getDefault());
delete l;
diff --git a/muse/muse/track.h b/muse/muse/track.h
index 3eb248ef..b5511486 100644
--- a/muse/muse/track.h
+++ b/muse/muse/track.h
@@ -206,7 +206,7 @@ class Track : public QObject {
void setHwCtrlState(int ctrl, int val);
// current value:
- CVal ctrlVal(int id) { return getController(id)->schedVal(); }
+ CVal ctrlVal(int id) { return getController(id)->curVal(); }
// editor interface:
bool addControllerVal(int id, unsigned pos, CVal);