diff options
author | David Robillard <d@drobilla.net> | 2012-11-17 18:41:19 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-11-17 18:41:19 +0000 |
commit | 4c5ef5318edb4e1cdc76288860c27358155efe17 (patch) | |
tree | b799988e6b5ef0a105d9c89fa9399c35b6b604e2 /libs/ardour/tempo.cc | |
parent | dd78c6ed719c717a892e47e8b4ef5702ced7eb8d (diff) |
Sent precise transport information to LV2 plugins via events.
We send the full transport state (frame position, BBT time, transport speed,
meter) to the plugin:
* At the start of a cycle whenever a relocate or transport speed change has
occurred
* On every occurrence of a meter change within a cycle
This means the plugin gets a sample accurate meter/tempo map, even if the meter
changes in the middle of a cycle. However, this is not quite right yet: things
can get wonky if the tempo map is edited while rolling, since this code will
not detect the change and fail to update the plugin at the start of the cycle.
Other changes:
* Factor out TempoMetric::set_metric() and simplify some tempo functions
* Clean up LV2 URID stuff
git-svn-id: svn://localhost/ardour2/branches/3.0@13513 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r-- | libs/ardour/tempo.cc | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 80091e7eec..0bb2fea0cf 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1031,12 +1031,10 @@ TempoMap::_extend_map (TempoSection* tempo, MeterSection* meter, } TempoMetric -TempoMap::metric_at (framepos_t frame) const +TempoMap::metric_at (framepos_t frame, Metrics::const_iterator* last) const { Glib::Threads::RWLock::ReaderLock lm (lock); TempoMetric m (first_meter(), first_tempo()); - const Meter* meter; - const Tempo* tempo; /* at this point, we are *guaranteed* to have m.meter and m.tempo pointing at something, because we insert the default tempo and meter during @@ -1051,14 +1049,11 @@ TempoMap::metric_at (framepos_t frame) const break; } - if ((tempo = dynamic_cast<const TempoSection*>(*i)) != 0) { - m.set_tempo (*tempo); - } else if ((meter = dynamic_cast<const MeterSection*>(*i)) != 0) { - m.set_meter (*meter); - } + m.set_metric(*i); - m.set_frame ((*i)->frame ()); - m.set_start ((*i)->start ()); + if (last) { + *last = i; + } } return m; @@ -1069,8 +1064,6 @@ TempoMap::metric_at (BBT_Time bbt) const { Glib::Threads::RWLock::ReaderLock lm (lock); TempoMetric m (first_meter(), first_tempo()); - const Meter* meter; - const Tempo* tempo; /* at this point, we are *guaranteed* to have m.meter and m.tempo pointing at something, because we insert the default tempo and meter during @@ -1087,14 +1080,7 @@ TempoMap::metric_at (BBT_Time bbt) const break; } - if ((tempo = dynamic_cast<const TempoSection*>(*i)) != 0) { - m.set_tempo (*tempo); - } else if ((meter = dynamic_cast<const MeterSection*>(*i)) != 0) { - m.set_meter (*meter); - } - - m.set_frame ((*i)->frame ()); - m.set_start (section_start); + m.set_metric (*i); } return m; |