mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-22 06:36:29 +01:00
Support cut / copy / paste of MIDI automation.
git-svn-id: svn://localhost/ardour2/branches/3.0@7545 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e7a2b99f3d
commit
5e3ca4db5c
16 changed files with 169 additions and 67 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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*/)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue