summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/automation_event.h10
-rw-r--r--libs/ardour/ardour/midi_track.h6
-rw-r--r--libs/ardour/ardour/parameter.h22
-rw-r--r--libs/ardour/ardour/types.h5
-rw-r--r--libs/ardour/automatable.cc1
-rw-r--r--libs/ardour/automation_control.cc1
-rw-r--r--libs/ardour/automation_event.cc34
-rw-r--r--libs/ardour/enums.cc12
-rw-r--r--libs/ardour/midi_track.cc18
9 files changed, 100 insertions, 9 deletions
diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h
index 8a9b110714..ac8ce70ff1 100644
--- a/libs/ardour/ardour/automation_event.h
+++ b/libs/ardour/ardour/automation_event.h
@@ -229,6 +229,15 @@ class AutomationList : public PBD::StatefulDestructible
Curve& curve() { return *_curve; }
const Curve& curve() const { return *_curve; }
+ enum InterpolationStyle {
+ Discrete,
+ Linear,
+ Curved
+ };
+
+ InterpolationStyle interpolation() const { return _interpolation; }
+ void set_interpolation(InterpolationStyle style) { _interpolation = style; }
+
protected:
/** Called by unlocked_eval() to handle cases of 3 or more control points.
@@ -247,6 +256,7 @@ class AutomationList : public PBD::StatefulDestructible
mutable SearchCache _search_cache;
Parameter _parameter;
+ InterpolationStyle _interpolation;
EventList _events;
mutable Glib::Mutex _lock;
int8_t _frozen;
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index aea032f725..2317cd0549 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -57,7 +57,7 @@ public:
int use_diskstream (string name);
int use_diskstream (const PBD::ID& id);
- int set_mode (TrackMode m);
+ //int set_mode (TrackMode m);
void set_latency_delay (nframes_t);
@@ -85,6 +85,9 @@ public:
MidiTrack* _route;
};
+ NoteMode note_mode() const { return _note_mode; }
+ void set_note_mode (NoteMode m) { _note_mode = m; }
+
protected:
XMLNode& state (bool full);
@@ -101,6 +104,7 @@ private:
void set_state_part_three ();
MidiRingBuffer _immediate_events;
+ NoteMode _note_mode;
};
} /* namespace ARDOUR*/
diff --git a/libs/ardour/ardour/parameter.h b/libs/ardour/ardour/parameter.h
index 42159a2bbb..803bd889cb 100644
--- a/libs/ardour/ardour/parameter.h
+++ b/libs/ardour/ardour/parameter.h
@@ -127,6 +127,28 @@ public:
}
}
+ /* The below properties are only used for CC right now, but unchanging properties
+ * of parameters (rather than changing parameters of automation lists themselves)
+ * should be moved here */
+
+ inline double min() const {
+ if (_type == MidiCCAutomation)
+ return 0.0;
+ else
+ return DBL_MIN;
+ }
+
+ inline double max() const {
+ if (_type == MidiCCAutomation)
+ return 127.0;
+ else
+ return DBL_MAX;
+ }
+
+ inline bool is_integer() const {
+ return (_type == MidiCCAutomation);
+ }
+
private:
// default copy constructor is ok
AutomationType _type;
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index cfb9dd49b0..ab54b6c26c 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -143,6 +143,11 @@ namespace ARDOUR {
Destructive
};
+ enum NoteMode {
+ Note,
+ Percussion
+ };
+
struct BBT_Time {
uint32_t bars;
uint32_t beats;
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 885034056d..dfdcf82cab 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -463,3 +463,4 @@ Automatable::control_factory(boost::shared_ptr<AutomationList> list)
return boost::shared_ptr<AutomationControl>(new AutomationControl(_session, list));
}
}
+
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index 73d5819bc4..4885a6fed9 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -35,7 +35,6 @@ AutomationControl::AutomationControl(Session& session, boost::shared_ptr<Automat
, _list(list)
, _user_value(list->default_value())
{
- cerr << "Created AutomationControl " << name << "(" << list->parameter().to_string() << ")" << endl;
}
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index 2bb987ad24..a024391980 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -28,6 +28,7 @@
#include <ardour/automation_event.h>
#include <ardour/curve.h>
#include <pbd/stacktrace.h>
+#include <pbd/enumwriter.h>
#include "i18n.h"
@@ -56,6 +57,7 @@ static void dumpit (const AutomationList& al, string prefix = "")
AutomationList::AutomationList (Parameter id, double min_val, double max_val, double default_val)
: _parameter(id)
+ , _interpolation(Linear)
, _curve(new Curve(*this))
{
_parameter = id;
@@ -81,6 +83,7 @@ AutomationList::AutomationList (Parameter id, double min_val, double max_val, do
AutomationList::AutomationList (const AutomationList& other)
: _parameter(other._parameter)
+ , _interpolation(Linear)
, _curve(new Curve(*this))
{
_frozen = 0;
@@ -108,6 +111,7 @@ AutomationList::AutomationList (const AutomationList& other)
AutomationList::AutomationList (const AutomationList& other, double start, double end)
: _parameter(other._parameter)
+ , _interpolation(Linear)
, _curve(new Curve(*this))
{
_frozen = 0;
@@ -146,7 +150,8 @@ AutomationList::AutomationList (const AutomationList& other, double start, doubl
* in or below the <AutomationList> node. It is used if \a id is non-null.
*/
AutomationList::AutomationList (const XMLNode& node, Parameter id)
- : _curve(new Curve(*this))
+ : _interpolation(Linear)
+ , _curve(new Curve(*this))
{
_frozen = 0;
_changed_when_thawed = false;
@@ -925,6 +930,9 @@ AutomationList::unlocked_eval (double x) const
upos = _events.back()->when;
uval = _events.back()->value;
+ if (_interpolation == Discrete)
+ return lval;
+
/* linear interpolation betweeen the two points
*/
@@ -953,6 +961,22 @@ AutomationList::multipoint_eval (double x) const
double upos, lpos;
double uval, lval;
double fraction;
+
+ /* "Stepped" lookup (no interpolation) */
+ /* FIXME: no cache. significant? */
+ if (_interpolation == Discrete) {
+ const ControlEvent cp (x, 0);
+ TimeComparator cmp;
+ EventList::const_iterator i = lower_bound (_events.begin(), _events.end(), &cp, cmp);
+
+ // shouldn't have made it to multipoint_eval
+ assert(i != _events.end());
+
+ if (i == _events.begin() || (*i)->when == x)
+ return (*i)->value;
+ else
+ return (*(--i))->value;
+ }
/* Only do the range lookup if x is in a different range than last time
* this was called (or if the lookup cache has been marked "dirty" (left<0) */
@@ -1279,6 +1303,8 @@ AutomationList::state (bool full)
root->add_property ("max_yval", buf);
snprintf (buf, sizeof (buf), "%.12g", _max_xval);
root->add_property ("max_xval", buf);
+
+ root->add_property ("interpolation-style", enum_2_string (_interpolation));
if (full) {
root->add_property ("state", auto_state_to_string (_state));
@@ -1438,6 +1464,12 @@ AutomationList::set_state (const XMLNode& node)
warning << "Legacy session: automation list has no automation-id property.";
}
+ if ((prop = node.property (X_("interpolation-style"))) != 0) {
+ _interpolation = (InterpolationStyle)string_2_enum(prop->value(), _interpolation);
+ } else {
+ _interpolation = Linear;
+ }
+
if ((prop = node.property (X_("default"))) != 0){
_default_value = atof (prop->value().c_str());
} else {
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index 5a65135f75..faa74860f9 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -28,6 +28,7 @@
#include <ardour/route_group.h>
#include <ardour/panner.h>
#include <ardour/track.h>
+#include <ardour/midi_track.h>
using namespace std;
using namespace PBD;
@@ -44,6 +45,7 @@ setup_enum_writer ()
AlignStyle _AlignStyle;
MeterPoint _MeterPoint;
TrackMode _TrackMode;
+ NoteMode _NoteMode;
MeterFalloff _MeterFalloff;
MeterHold _MeterHold;
EditMode _EditMode;
@@ -81,6 +83,7 @@ setup_enum_writer ()
RouteGroup::Flag _RouteGroup_Flag;
Region::Flag _Region_Flag;
Track::FreezeState _Track_FreezeState;
+ AutomationList::InterpolationStyle _AutomationList_InterpolationStyle;
#define REGISTER(e) enum_writer->register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_BITS(e) enum_writer->register_bits (typeid(e).name(), i, s); i.clear(); s.clear()
@@ -132,6 +135,10 @@ setup_enum_writer ()
REGISTER_ENUM (Normal);
REGISTER_ENUM (Destructive);
REGISTER (_TrackMode);
+
+ REGISTER_ENUM (Note);
+ REGISTER_ENUM (Percussion);
+ REGISTER (_NoteMode);
REGISTER_ENUM (MeterFalloffOff);
REGISTER_ENUM (MeterFalloffSlowest);
@@ -361,4 +368,9 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Track, UnFrozen);
REGISTER (_Track_FreezeState);
+ REGISTER_CLASS_ENUM (AutomationList, Discrete);
+ REGISTER_CLASS_ENUM (AutomationList, Linear);
+ REGISTER_CLASS_ENUM (AutomationList, Curved);
+ REGISTER (_AutomationList_InterpolationStyle);
+
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 6e52bb19c0..f714bf47f9 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -161,10 +161,15 @@ MidiTrack::_set_state (const XMLNode& node, bool call_base)
return -1;
}
- if ((prop = node.property (X_("mode"))) != 0) {
- _mode = TrackMode (string_2_enum (prop->value(), _mode));
+ // No destructive MIDI tracks (yet?)
+ _mode = Normal;
+
+ if ((prop = node.property (X_("note-mode"))) != 0) {
+ _note_mode = NoteMode (string_2_enum (prop->value(), _note_mode));
+ cerr << "NOTE MODE: " << prop->value() << " -> " << _note_mode << endl;
} else {
- _mode = Normal;
+ cerr << "NO NOTE MODE" << endl;
+ _note_mode = Note;
}
if ((prop = node.property ("diskstream-id")) == 0) {
@@ -245,7 +250,7 @@ MidiTrack::state(bool full_state)
align_node->add_property (X_("style"), enum_2_string (as));
root.add_child_nocopy (*align_node);
- root.add_property (X_("mode"), enum_2_string (_mode));
+ root.add_property (X_("note-mode"), enum_2_string (_note_mode));
/* we don't return diskstream state because we don't
own the diskstream exclusively. control of the diskstream
@@ -682,7 +687,7 @@ MidiTrack::unfreeze ()
_freeze_record.state = UnFrozen;
FreezeChange (); /* EMIT SIGNAL */
}
-
+#if 0
int
MidiTrack::set_mode (TrackMode m)
{
@@ -701,7 +706,8 @@ MidiTrack::set_mode (TrackMode m)
return 0;
}
-
+#endif
+
/** \return true on success, false on failure (no buffer space left)
*/
bool