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/ardour | |
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/ardour')
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 35 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 21 |
2 files changed, 43 insertions, 13 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 1090f30307..a4b89a5841 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -111,8 +111,6 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee boost::shared_ptr<Plugin::ScalePoints> get_scale_points(uint32_t port_index) const; - static uint32_t midi_event_type() { return _midi_event_type; } - void set_insert_info(const PluginInsert* insert); int set_state (const XMLNode& node, int version); @@ -124,8 +122,6 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee bool has_editor () const; bool has_message_output () const; - uint32_t atom_eventTransfer() const; - void write_from_ui(uint32_t index, uint32_t protocol, uint32_t size, @@ -147,14 +143,26 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee static URIMap _uri_map; - static uint32_t _midi_event_type; - static uint32_t _chunk_type; - static uint32_t _sequence_type; - static uint32_t _event_transfer_type; - static uint32_t _path_type; - static uint32_t _log_Error; - static uint32_t _log_Warning; - static uint32_t _log_Note; + struct URIDs { + uint32_t atom_Chunk; + uint32_t atom_Path; + uint32_t atom_Sequence; + uint32_t atom_eventTransfer; + uint32_t log_Error; + uint32_t log_Note; + uint32_t log_Warning; + uint32_t midi_MidiEvent; + uint32_t time_Position; + uint32_t time_bar; + uint32_t time_barBeat; + uint32_t time_beatUnit; + uint32_t time_beatsPerBar; + uint32_t time_beatsPerMinute; + uint32_t time_frame; + uint32_t time_speed; + }; + + static URIDs urids; private: struct Impl; @@ -171,6 +179,9 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee float* _bpm_control_port; ///< Special input set by ardour float* _freewheel_control_port; ///< Special input set by ardour float* _latency_control_port; ///< Special output set by ardour + uint32_t _position_seq_port_idx; ///< Index of Sequence port for position + framepos_t _next_cycle_start; ///< Expected start frame of next run cycle + double _next_cycle_speed; ///< Expected start frame of next run cycle PBD::ID _insert_id; friend const void* lv2plugin_get_port_value(const char* port_symbol, diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 65e488d9a5..bedc825288 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -180,6 +180,19 @@ class TempoMetric { void set_frame (framepos_t f) { _frame = f; } void set_start (const Timecode::BBT_Time& t) { _start = t; } + void set_metric (const MetricSection* section) { + const MeterSection* meter; + const TempoSection* tempo; + if ((meter = dynamic_cast<const MeterSection*>(section))) { + set_meter(*meter); + } else if ((tempo = dynamic_cast<const TempoSection*>(section))) { + set_tempo(*tempo); + } + + set_frame(section->frame()); + set_start(section->start()); + } + const Meter& meter() const { return *_meter; } const Tempo& tempo() const { return *_tempo; } framepos_t frame() const { return _frame; } @@ -298,7 +311,13 @@ class TempoMap : public PBD::StatefulDestructible void clear (); TempoMetric metric_at (Timecode::BBT_Time bbt) const; - TempoMetric metric_at (framepos_t) const; + + /** Return the TempoMetric at frame @p t, and point @p last to the latest + * metric change <= t, if it is non-NULL. + */ + TempoMetric metric_at (framepos_t, Metrics::const_iterator* last=NULL) const; + + Metrics::const_iterator metrics_end() { return metrics.end(); } void change_existing_tempo_at (framepos_t, double bpm, double note_type); void change_initial_tempo (double bpm, double note_type); |