summaryrefslogtreecommitdiff
path: root/muse2/muse/ctrl.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2012-05-28 14:15:52 +0000
committerFlorian Jung <flo@windfisch.org>2012-05-28 14:15:52 +0000
commitd2a88cfaad5ac385fc3c6212c09ad7fbc38e9454 (patch)
tree387da0b38255003e1a971629ea0de32273ac3d3c /muse2/muse/ctrl.cpp
parent716f5a5b56a3b7ff59004ef0a1af5f98cb2a691c (diff)
merged with release_2_0
Diffstat (limited to 'muse2/muse/ctrl.cpp')
-rw-r--r--muse2/muse/ctrl.cpp49
1 files changed, 47 insertions, 2 deletions
diff --git a/muse2/muse/ctrl.cpp b/muse2/muse/ctrl.cpp
index 9f94e9df..8071491e 100644
--- a/muse2/muse/ctrl.cpp
+++ b/muse2/muse/ctrl.cpp
@@ -34,7 +34,6 @@
#include "globals.h"
#include "ctrl.h"
#include "xml.h"
-#include "audio.h"
namespace MusECore {
@@ -184,7 +183,7 @@ double CtrlList::value(int frame) const
//---------------------------------------------------------
// curVal
-// returns the value at the current audio position
+// returns the static 'manual' value
//---------------------------------------------------------
double CtrlList::curVal() const
{
@@ -193,6 +192,7 @@ double CtrlList::curVal() const
//---------------------------------------------------------
// setCurVal
+// Sets the static 'manual' value
//---------------------------------------------------------
void CtrlList::setCurVal(double val)
{
@@ -201,6 +201,7 @@ void CtrlList::setCurVal(double val)
//---------------------------------------------------------
// add
+// Add, or replace, an event at time frame having value val.
//---------------------------------------------------------
void CtrlList::add(int frame, double val)
@@ -226,6 +227,17 @@ void CtrlList::del(int frame)
}
//---------------------------------------------------------
+// updateCurValues
+// Set the current static 'manual' value (non-automation value)
+// from the automation value at the given time.
+//---------------------------------------------------------
+
+void CtrlList::updateCurValue(int frame)
+{
+ _curVal = value(frame);
+}
+
+//---------------------------------------------------------
// read
//---------------------------------------------------------
@@ -346,5 +358,38 @@ void CtrlListList::add(CtrlList* vl)
{
insert(std::pair<const int, CtrlList*>(vl->id(), vl));
}
+
+//---------------------------------------------------------
+// value
+//---------------------------------------------------------
+
+double CtrlListList::value(int ctrlId, int frame, bool cur_val_only) const
+ {
+ ciCtrlList cl = find(ctrlId);
+ if (cl == end())
+ return 0.0;
+
+ if(cur_val_only)
+ return cl->second->curVal();
+
+ return cl->second->value(frame);
+ }
+
+//---------------------------------------------------------
+// updateCurValues
+// Set the current 'manual' values (non-automation values)
+// from the automation values at the given time.
+// This is typically called right after a track's automation type changes
+// to OFF, so that the manual value becomes the last automation value.
+// There are some interesting advantages to having completely independent
+// 'manual' and automation values, but the jumping around when switching to OFF
+// becomes disconcerting.
+//---------------------------------------------------------
+
+void CtrlListList::updateCurValues(int frame)
+{
+ for(ciCtrlList cl = begin(); cl != end(); ++cl)
+ cl->second->updateCurValue(frame);
+}
} // namespace MusECore