summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-05 13:36:38 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-05 13:36:38 +0000
commit5e3ca4db5cc356385e520643cfd279f393db4b51 (patch)
tree2ea31a74d34e37e33bc5b126a5e7f1b58753b4f0 /libs
parente7a2b99f3d4f7afe73a30ac85e770e228785c1be (diff)
Support cut / copy / paste of MIDI automation.
git-svn-id: svn://localhost/ardour2/branches/3.0@7545 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/beats_frames_converter.h8
-rw-r--r--libs/ardour/beats_frames_converter.cc8
-rw-r--r--libs/evoral/evoral/TimeConverter.hpp12
-rw-r--r--libs/evoral/src/ControlList.cpp8
4 files changed, 24 insertions, 12 deletions
diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_frames_converter.h
index 9db4448ebb..b1e44adbef 100644
--- a/libs/ardour/ardour/beats_frames_converter.h
+++ b/libs/ardour/ardour/beats_frames_converter.h
@@ -32,19 +32,15 @@ class TempoMap;
class BeatsFramesConverter : public Evoral::TimeConverter<double,sframes_t> {
public:
BeatsFramesConverter(const TempoMap& tempo_map, sframes_t origin)
- : _tempo_map(tempo_map)
- , _origin(origin)
+ : Evoral::TimeConverter<double, sframes_t> (origin)
+ , _tempo_map(tempo_map)
{}
sframes_t to(double beats) const;
double from(sframes_t frames) const;
- sframes_t origin() const { return _origin; }
- void set_origin(sframes_t origin) { _origin = origin; }
-
private:
const TempoMap& _tempo_map;
- sframes_t _origin;
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/beats_frames_converter.cc b/libs/ardour/beats_frames_converter.cc
index f93e5e7224..9d3b8ae4c6 100644
--- a/libs/ardour/beats_frames_converter.cc
+++ b/libs/ardour/beats_frames_converter.cc
@@ -28,10 +28,10 @@ sframes_t
BeatsFramesConverter::to(double beats) const
{
// FIXME: assumes tempo never changes after origin
- const Tempo& tempo = _tempo_map.tempo_at(_origin);
+ const Tempo& tempo = _tempo_map.tempo_at (_origin_b);
const double frames_per_beat = tempo.frames_per_beat(
_tempo_map.frame_rate(),
- _tempo_map.meter_at(_origin));
+ _tempo_map.meter_at (_origin_b));
return lrint(beats * frames_per_beat);
}
@@ -40,10 +40,10 @@ double
BeatsFramesConverter::from(sframes_t frames) const
{
// FIXME: assumes tempo never changes after origin
- const Tempo& tempo = _tempo_map.tempo_at(_origin);
+ const Tempo& tempo = _tempo_map.tempo_at (_origin_b);
const double frames_per_beat = tempo.frames_per_beat(
_tempo_map.frame_rate(),
- _tempo_map.meter_at(_origin));
+ _tempo_map.meter_at (_origin_b));
return frames / frames_per_beat;
}
diff --git a/libs/evoral/evoral/TimeConverter.hpp b/libs/evoral/evoral/TimeConverter.hpp
index 9c53d0370c..25371a18bf 100644
--- a/libs/evoral/evoral/TimeConverter.hpp
+++ b/libs/evoral/evoral/TimeConverter.hpp
@@ -29,6 +29,7 @@ namespace Evoral {
template<typename A, typename B>
class TimeConverter {
public:
+ TimeConverter (B ob = 0) : _origin_b (ob) {}
virtual ~TimeConverter() {}
/** Convert A time to B time (A to B) */
@@ -36,6 +37,17 @@ public:
/** Convert B time to A time (A from B) */
virtual A from(B b) const = 0;
+
+ B origin_b () const {
+ return _origin_b;
+ }
+
+ void set_origin_b (B o) {
+ _origin_b = o;
+ }
+
+protected:
+ B _origin_b;
};
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 880198dc53..72b032e0cf 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -1145,7 +1145,10 @@ ControlList::cut (iterator start, iterator end)
return nal;
}
-/** @param op 0 = cut, 1 = copy, 2 = clear */
+/** @param start Start position in model coordinates.
+ * @param end End position in model coordinates.
+ * @param op 0 = cut, 1 = copy, 2 = clear.
+ */
boost::shared_ptr<ControlList>
ControlList::cut_copy_clear (double start, double end, int op)
{
@@ -1247,9 +1250,10 @@ ControlList::copy (double start, double end)
void
ControlList::clear (double start, double end)
{
- (void) cut_copy_clear (start, end, 2);
+ cut_copy_clear (start, end, 2);
}
+/** @param pos Position in model coordinates */
bool
ControlList::paste (ControlList& alist, double pos, float /*times*/)
{