mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 23:25:43 +01:00
region tempo and meter are optional
This commit is contained in:
parent
8f9018ceda
commit
832683cb01
4 changed files with 23 additions and 14 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include "temporal/domain_swap.h"
|
||||
|
|
@ -544,9 +545,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
Temporal::Tempo tempo() const { return _tempo; }
|
||||
std::optional<Temporal::Tempo> tempo() const { return _tempo; }
|
||||
void set_tempo (Temporal::Tempo const &);
|
||||
Temporal::Meter meter() const { return _meter; }
|
||||
std::optional<Temporal::Meter> meter() const { return _meter; }
|
||||
void set_meter (Temporal::Meter const &);
|
||||
|
||||
protected:
|
||||
|
|
@ -601,8 +602,8 @@ protected:
|
|||
uint32_t _fx_tail;
|
||||
RegionFxList _plugins;
|
||||
|
||||
Temporal::Tempo _tempo;
|
||||
Temporal::Meter _meter;
|
||||
std::optional<Temporal::Tempo> _tempo;
|
||||
std::optional<Temporal::Meter> _meter;
|
||||
|
||||
PBD::Property<bool> _sync_marked;
|
||||
PBD::Property<bool> _left_of_split;
|
||||
|
|
|
|||
|
|
@ -442,9 +442,11 @@ AudioRegion::set_tempo_stuff_from_source ()
|
|||
if (read (data.get(), 0, data_size, 0) == data_size) {
|
||||
double tempo;
|
||||
double beatcount;
|
||||
Temporal::Meter m (4, 4);
|
||||
|
||||
estimate_audio_tempo (shared_from_this(), data.get(), data_size, _session.sample_rate(), tempo, _meter, beatcount);
|
||||
estimate_audio_tempo (shared_from_this(), data.get(), data_size, _session.sample_rate(), tempo, m, beatcount);
|
||||
_tempo = Temporal::Tempo (tempo, 4);
|
||||
_meter = m;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,9 +230,7 @@ Region::register_properties ()
|
|||
}
|
||||
|
||||
#define REGION_DEFAULT_STATE(s,l) \
|
||||
_tempo (120, 4) \
|
||||
, _meter (4, 4) \
|
||||
, _sync_marked (Properties::sync_marked, false) \
|
||||
_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) \
|
||||
|
|
@ -1426,8 +1424,12 @@ 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());
|
||||
if (_tempo) {
|
||||
node->add_child_nocopy (_tempo.value().get_state());
|
||||
}
|
||||
if (_meter) {
|
||||
node->add_child_nocopy (_meter.value().get_state());
|
||||
}
|
||||
|
||||
std::string fe;
|
||||
|
||||
|
|
@ -1629,9 +1631,11 @@ 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);
|
||||
Temporal::Tempo t (*child);
|
||||
_tempo = t;
|
||||
} else if (child->name() == Temporal::Meter::xml_node_name) {
|
||||
_meter.set_state (*child, version);
|
||||
Temporal::Meter m (*child);
|
||||
_meter = m;
|
||||
}
|
||||
}
|
||||
lm.release ();
|
||||
|
|
|
|||
|
|
@ -2646,8 +2646,10 @@ MIDITrigger::get_segment_descriptor () const
|
|||
{
|
||||
SegmentDescriptor sd;
|
||||
|
||||
sd.set_extent (Temporal::Beats(), _region->length().beats());
|
||||
sd.set_tempo (_region->tempo());
|
||||
if (_region->tempo()) {
|
||||
sd.set_extent (Temporal::Beats(), _region->length().beats());
|
||||
sd.set_tempo (_region->tempo().value());
|
||||
}
|
||||
return sd;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue