#include "ardour/mute_master.h"
#include "ardour/session.h"
#include "ardour/source.h"
+#include "ardour/tempo.h"
#include "ardour/track.h"
#include "ardour/types.h"
Diskstream::Flag _Diskstream_Flag;
Location::Flags _Location_Flags;
PositionLockStyle _PositionLockStyle;
+ TempoSection::Type _TempoSection_Type;
Track::FreezeState _Track_FreezeState;
AutomationList::InterpolationStyle _AutomationList_InterpolationStyle;
AnyTime::Type _AnyTime_Type;
REGISTER_CLASS_ENUM (Location, IsSkip);
REGISTER_BITS (_Location_Flags);
+ REGISTER_CLASS_ENUM (TempoSection, Ramp);
+ REGISTER_CLASS_ENUM (TempoSection, Constant);
+ REGISTER (_TempoSection_Type);
+
REGISTER_CLASS_ENUM (Track, NoFreeze);
REGISTER_CLASS_ENUM (Track, Frozen);
REGISTER_CLASS_ENUM (Track, UnFrozen);
#include <unistd.h>
#include <glibmm/threads.h>
+
+#include "pbd/enumwriter.h"
#include "pbd/xml++.h"
#include "evoral/Beats.hpp"
+
#include "ardour/debug.h"
#include "ardour/lmath.h"
#include "ardour/tempo.h"
set_beat (beat);
}
} else {
- error << _("TempoSection XML node has no \"start\" property") << endmsg;
+ warning << _("TempoSection XML node has no \"start\" property") << endmsg;
}
if ((prop = node.property ("tempo-type")) == 0) {
_type = Constant;
} else {
- if (strstr(prop->value().c_str(),"Constant")) {
- _type = Constant;
- } else {
- _type = Ramp;
- }
+ _type = Type (string_2_enum (prop->value(), _type));
}
}
// root->add_property ("bar-offset", buf);
snprintf (buf, sizeof (buf), "%s", movable()?"yes":"no");
root->add_property ("movable", buf);
-
- snprintf (buf, sizeof (buf), "%s", _type == Constant?"Constant":"Ramp");
- root->add_property ("tempo-type", buf);
+ root->add_property ("tempo-type", enum_2_string (_type));
return *root;
}
pair<double, BBT_Time> corrected = make_pair (m->beat(), m->bbt());
corrected.second.beats = 1;
corrected.second.ticks = 0;
- corrected.first = bbt_to_beats_unlocked (corrected.second);
+ corrected.first = bbt_to_beats_locked (corrected.second);
warning << string_compose (_("Meter changes can only be positioned on the first beat of a bar. Moving from %1 to %2"),
m->bbt(), corrected.second) << endmsg;
m->set_beat (corrected);
MeterSection& first (first_meter());
if (ms.beat() != first.beat()) {
remove_meter_locked (ms);
- add_meter_locked (meter, bbt_to_beats_unlocked (where), where, true);
+ add_meter_locked (meter, bbt_to_beats_locked (where), where, true);
} else {
/* cannot move the first meter section */
*static_cast<Meter*>(&first) = meter;
warning << string_compose (_("tempo map asked for BBT time at frame %1\n"), frame) << endmsg;
return;
}
- bbt = beats_to_bbt_unlocked (beat_at_frame (frame));
+ bbt = beats_to_bbt_locked (beat_at_frame (frame));
}
double
TempoMap::bbt_to_beats (Timecode::BBT_Time bbt)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return bbt_to_beats_unlocked (bbt);
+ return bbt_to_beats_locked (bbt);
}
double
-TempoMap::bbt_to_beats_unlocked (Timecode::BBT_Time bbt)
+TempoMap::bbt_to_beats_locked (Timecode::BBT_Time bbt)
{
/* CALLER HOLDS READ LOCK */
TempoMap::beats_to_bbt (double beats)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
- return beats_to_bbt_unlocked (beats);
+ return beats_to_bbt_locked (beats);
}
Timecode::BBT_Time
-TempoMap::beats_to_bbt_unlocked (double beats)
+TempoMap::beats_to_bbt_locked (double beats)
{
/* CALLER HOLDS READ LOCK */
}
Glib::Threads::RWLock::ReaderLock lm (lock);
- framepos_t const ret = frame_at_beat (bbt_to_beats_unlocked (bbt));
+ framepos_t const ret = frame_at_beat (bbt_to_beats_locked (bbt));
return ret;
}
double const beat_at_framepos = beat_at_frame (frame);
- BBT_Time bbt (beats_to_bbt_unlocked (beat_at_framepos));
+ BBT_Time bbt (beats_to_bbt_locked (beat_at_framepos));
switch (type) {
case Bar:
framecnt_t const pos = frame_at_beat (cnt);
MeterSection const meter = meter_section_at (pos);
Tempo const tempo = tempo_at (pos);
- BBT_Time const bbt = beats_to_bbt_unlocked ((double) cnt);
+ BBT_Time const bbt = beats_to_bbt_locked ((double) cnt);
points.push_back (BBTPoint (meter, tempo, pos, bbt.bars, bbt.beats));
++cnt;
ms->set_beat (start);
}
if ((t = dynamic_cast<TempoSection*>(prev)) != 0) {
- pair<double, BBT_Time> start = make_pair (t->beat(), beats_to_bbt_unlocked (t->beat()));
+ pair<double, BBT_Time> start = make_pair (t->beat(), beats_to_bbt_locked (t->beat()));
ms->set_beat (start);
}
ms->set_frame (prev->frame());