libardour: use appropriate method to set AutomationList time domain from ::set_state()
This commit is contained in:
parent
6d154c14b4
commit
b2510c0da2
@ -451,7 +451,7 @@ AutomationList::set_state (const XMLNode& node, int version)
|
||||
Temporal::TimeDomain time_domain;
|
||||
|
||||
if (node.get_property ("time-domain", time_domain)) {
|
||||
set_time_domain (time_domain);
|
||||
set_time_domain_empty (time_domain);
|
||||
}
|
||||
|
||||
if (node.name() == X_("events")) {
|
||||
|
@ -1,82 +0,0 @@
|
||||
/* This file is part of Temporal.
|
||||
* Copyright (C) 2009 David Robillard <http://drobilla.net>
|
||||
* Copyright (C) 2009 Paul Davis
|
||||
*
|
||||
* Temporal is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* Temporal is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __libtemporal_time_converter_h__
|
||||
#define __libtemporal_time_converter_h__
|
||||
|
||||
#include "temporal/timeline.h"
|
||||
#include "temporal/visibility.h"
|
||||
|
||||
namespace Temporal {
|
||||
|
||||
class TempoMap;
|
||||
|
||||
/** A bidirectional converter between two different time units.
|
||||
*
|
||||
* Think of the conversion method names as if they are written in-between
|
||||
* the two template parameters (i.e. "A <name> B").
|
||||
*
|
||||
* _origin_b should be the origin for conversion in the units of B.
|
||||
* That is, there is some point in time _origin, such that:
|
||||
*
|
||||
* to() converts a time _origin + a into an offset from _origin_b in units of B.
|
||||
* from() converts a time _origin + b into an offset from _origin_b in units of A.
|
||||
*/
|
||||
template<typename A, typename B, typename C>
|
||||
class LIBTEMPORAL_TEMPLATE_API TimeConverter {
|
||||
public:
|
||||
TimeConverter () : _origin (0) {}
|
||||
TimeConverter (B ob) : _origin (ob) {}
|
||||
virtual ~TimeConverter();
|
||||
|
||||
/** Convert A time to C time (A to C) */
|
||||
virtual C to(A a) const = 0;
|
||||
|
||||
/** Convert C time to A time (A from C) */
|
||||
virtual A from(C b) const = 0;
|
||||
|
||||
B origin () const {
|
||||
return _origin;
|
||||
}
|
||||
|
||||
void set_origin (B o) {
|
||||
_origin = o;
|
||||
}
|
||||
|
||||
protected:
|
||||
B _origin;
|
||||
};
|
||||
|
||||
class LIBTEMPORAL_API DistanceMeasure
|
||||
{
|
||||
public:
|
||||
DistanceMeasure (timepos_t const & o)
|
||||
: _origin (o) {}
|
||||
|
||||
timepos_t operator() (Temporal::timecnt_t const & duration, Temporal::TimeDomain canonical_domain) const;
|
||||
timepos_t origin() const { return _origin; }
|
||||
void set_origin (timepos_t const &);
|
||||
|
||||
private:
|
||||
timepos_t _origin;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Temporal
|
||||
|
||||
#endif /* __libtemporal_time_converter_h__ */
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 David Robillard <http://drobilla.net>
|
||||
* Copyright (C) 2000-2008 Paul Davis
|
||||
*
|
||||
* Temporal is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* Temporal is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "temporal/beats.h"
|
||||
#include "temporal/types.h"
|
||||
#include "temporal/time_converter.h"
|
||||
#include "temporal/tempo.h"
|
||||
|
||||
namespace Temporal {
|
||||
|
||||
template<typename A, typename B, typename C>
|
||||
TimeConverter<A,B,C>::~TimeConverter()
|
||||
{}
|
||||
|
||||
template class TimeConverter<double, Temporal::samplepos_t,Temporal::samplecnt_t>;
|
||||
template class TimeConverter<Temporal::Beats, Temporal::samplepos_t,Temporal::samplecnt_t>;
|
||||
|
||||
Temporal::timepos_t
|
||||
DistanceMeasure::operator() (Temporal::timecnt_t const & duration, Temporal::TimeDomain canonical_domain) const
|
||||
{
|
||||
return timepos_t (TempoMap::fetch()->full_duration_at (_origin, duration, canonical_domain));
|
||||
}
|
||||
|
||||
void
|
||||
DistanceMeasure::set_origin (timepos_t const & pos)
|
||||
{
|
||||
_origin = pos;
|
||||
}
|
||||
|
||||
} // namespace Temporal
|
Loading…
Reference in New Issue
Block a user