LV2Plugin: do not unconditionally call TempoMap::get_grid

This commit is contained in:
Robin Gareus 2023-07-11 19:15:40 +02:00
parent 8145e92b43
commit 8d97db101e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -2762,11 +2762,6 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
TempoMap::SharedPtr tmap (TempoMap::use());
TempoMetric metric (tmap->metric_at (timepos_t (start0)));
TempoMapPoints tempo_map_points;
tmap->get_grid (tempo_map_points,
samples_to_superclock (start0, TEMPORAL_SAMPLE_RATE),
samples_to_superclock (end, TEMPORAL_SAMPLE_RATE), 0);
if (_freewheel_control_port) {
*_freewheel_control_port = _session.engine().freewheeling() ? 1.f : 0.f;
}
@ -2809,6 +2804,9 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
uint32_t midi_out_index = 0;
uint32_t atom_port_index = 0;
TempoMapPoints tempo_map_points;
bool got_grid = false;
for (uint32_t port_index = 0; port_index < num_ports; ++port_index) {
void* buf = NULL;
uint32_t index = nil_index;
@ -2888,6 +2886,13 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
const uint32_t type = _uri_map.urids.midi_MidiEvent;
const samplepos_t tend = end;
if (!got_grid) {
got_grid = true;
tmap->get_grid (tempo_map_points,
samples_to_superclock (start0, TEMPORAL_SAMPLE_RATE),
samples_to_superclock (end, TEMPORAL_SAMPLE_RATE), 0);
}
/* move to next explicit point
* (if any)
*/