Regions get their own tempo and meter

This defaults to the usual 120bpm 4/4 but is also not used anywhere yet
This commit is contained in:
Paul Davis
2025-08-08 15:41:32 -06:00
parent f66207f2a2
commit 20269df975
2 changed files with 20 additions and 2 deletions

View File

@@ -29,6 +29,7 @@
#include "temporal/domain_swap.h"
#include "temporal/timeline.h"
#include "temporal/range.h"
#include "temporal/tempo.h"
#include "pbd/undo.h"
#include "pbd/signals.h"
@@ -541,6 +542,9 @@ public:
}
}
Temporal::Tempo tempo() const { return _tempo; }
Temporal::Meter meter() const { return _meter; }
protected:
virtual XMLNode& state () const;
@@ -593,6 +597,9 @@ protected:
uint32_t _fx_tail;
RegionFxList _plugins;
Temporal::Tempo _tempo;
Temporal::Meter _meter;
PBD::Property<bool> _sync_marked;
PBD::Property<bool> _left_of_split;
PBD::Property<bool> _right_of_split;

View File

@@ -228,7 +228,9 @@ Region::register_properties ()
}
#define REGION_DEFAULT_STATE(s,l) \
_sync_marked (Properties::sync_marked, false) \
_tempo (120, 4) \
, _meter (4, 4) \
, _sync_marked (Properties::sync_marked, false) \
, _left_of_split (Properties::left_of_split, false) \
, _right_of_split (Properties::right_of_split, false) \
, _valid_transients (Properties::valid_transients, false) \
@@ -259,7 +261,9 @@ Region::register_properties ()
, _contents (Properties::contents, false)
#define REGION_COPY_STATE(other) \
_sync_marked (Properties::sync_marked, other->_sync_marked) \
_tempo (other->_tempo) \
, _meter (other->_meter) \
, _sync_marked (Properties::sync_marked, other->_sync_marked) \
, _left_of_split (Properties::left_of_split, other->_left_of_split) \
, _right_of_split (Properties::right_of_split, other->_right_of_split) \
, _valid_transients (Properties::valid_transients, other->_valid_transients) \
@@ -1420,6 +1424,9 @@ Region::state () const
node->set_property ("id", id ());
node->set_property ("type", _type);
node->add_child_nocopy (_tempo.get_state());
node->add_child_nocopy (_meter.get_state());
std::string fe;
switch (_first_edit) {
@@ -1619,6 +1626,10 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
}
_plugins.push_back (rfx);
changed = true;
} else if (child->name() == Temporal::Tempo::xml_node_name) {
_tempo.set_state (*child, version);
} else if (child->name() == Temporal::Meter::xml_node_name) {
_meter.set_state (*child, version);
}
}
lm.release ();