Compare commits

...

2 Commits

Author SHA1 Message Date
efdc47bc74 fix MidiRegion::merge() to allow final events of a region to be part of the newly merged result 2022-10-27 17:35:56 -06:00
bd33971346 triggers/graph: fix location of calls to TempoMap::fetch()
This ensures that RT graph threads have the correct tempo map,
and thus run triggers correctly when timestretch is required.
2022-10-27 16:33:46 -06:00
2 changed files with 9 additions and 10 deletions

View File

@ -227,6 +227,8 @@ Graph::prep ()
g_atomic_int_inc (&_trigger_queue_size); g_atomic_int_inc (&_trigger_queue_size);
_trigger_queue.push_back (i.get ()); _trigger_queue.push_back (i.get ());
} }
Temporal::TempoMap::fetch();
} }
void void
@ -323,8 +325,6 @@ Graph::run_one ()
/* update the thread-local tempo map ptr */ /* update the thread-local tempo map ptr */
Temporal::TempoMap::fetch ();
if (g_atomic_int_get (&_terminate)) { if (g_atomic_int_get (&_terminate)) {
return; return;
} }
@ -337,6 +337,8 @@ Graph::run_one ()
_trigger_queue.pop_front (to_run); _trigger_queue.pop_front (to_run);
} }
Temporal::TempoMap::fetch ();
/* Process the graph-node */ /* Process the graph-node */
g_atomic_int_dec_and_test (&_trigger_queue_size); g_atomic_int_dec_and_test (&_trigger_queue_size);
to_run->run (_graph_chain); to_run->run (_graph_chain);
@ -366,9 +368,6 @@ Graph::helper_thread ()
pt->get_buffers (); pt->get_buffers ();
/* just in case we need the thread local tempo map ptr before anything else */
Temporal::TempoMap::fetch ();
while (!g_atomic_int_get (&_terminate)) { while (!g_atomic_int_get (&_terminate)) {
run_one (); run_one ();
} }
@ -402,7 +401,6 @@ Graph::main_thread ()
/* Wait for initial process callback */ /* Wait for initial process callback */
again: again:
_callback_start_sem.wait (); _callback_start_sem.wait ();
Temporal::TempoMap::fetch ();
DEBUG_TRACE (DEBUG::ProcessThreads, "main thread is awake\n"); DEBUG_TRACE (DEBUG::ProcessThreads, "main thread is awake\n");

View File

@ -564,15 +564,16 @@ MidiRegion::merge (boost::shared_ptr<MidiRegion const> other_region)
for (Evoral::Sequence<Temporal::Beats>::const_iterator e = other->begin(); e != other->end(); ++e) { for (Evoral::Sequence<Temporal::Beats>::const_iterator e = other->begin(); e != other->end(); ++e) {
std::cerr << "event " << *e << " @ " << e->time().str() << " vs " << other_region_start.str() << " .. " << other_region_end.str() << " other = " << other << std::endl;
if (e->time() < other_region_start) { if (e->time() < other_region_start) {
continue; continue;
} }
/* other_region_end is an exclusive end, not inclusive */ /* other_region_end is an inclusive end, not
* exclusive, since we allow simultaneous MIDI events
* (given appropriate semantic sorting)
*/
if (e->time() >= other_region_end) { if (e->time() > other_region_end) {
break; break;
} }