13
0

fix unconditional note resolution during DiskReader::realtime_locate()

When looping, we do not want to resolve notes at the end of the loop via ::realtime_locate() -
::get_midi_playback() has already taken care of this. But when not looping, we need this. So,
add an argument to tell all interested parties whether the locate is for a loop end or not
This commit is contained in:
Paul Davis 2019-11-06 16:00:00 -07:00
parent 9694f89966
commit febaa1ff2d
17 changed files with 26 additions and 25 deletions

View File

@ -84,7 +84,7 @@ public:
void flush_buffers (samplecnt_t nframes); void flush_buffers (samplecnt_t nframes);
void no_outs_cuz_we_no_monitor(bool); void no_outs_cuz_we_no_monitor(bool);
void non_realtime_transport_stop (samplepos_t now, bool flush); void non_realtime_transport_stop (samplepos_t now, bool flush);
void realtime_locate (); void realtime_locate (bool);
BufferSet& output_buffers() { return *_output_buffers; } BufferSet& output_buffers() { return *_output_buffers; }

View File

@ -50,7 +50,7 @@ public:
void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/); void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/);
void realtime_handle_transport_stopped (); void realtime_handle_transport_stopped ();
void realtime_locate (); void realtime_locate (bool);
bool overwrite_existing_buffers (); bool overwrite_existing_buffers ();
void set_pending_overwrite (); void set_pending_overwrite ();

View File

@ -46,7 +46,7 @@ public:
void flush_buffers (pframes_t nframes); void flush_buffers (pframes_t nframes);
void transport_stopped (); void transport_stopped ();
void realtime_locate (); void realtime_locate (bool);
void reset (); void reset ();
void require_resolve (); void require_resolve ();

View File

@ -43,7 +43,7 @@ public:
int init (); int init ();
void realtime_locate (); void realtime_locate (bool);
void non_realtime_locate (samplepos_t); void non_realtime_locate (samplepos_t);
bool can_be_record_enabled (); bool can_be_record_enabled ();

View File

@ -174,7 +174,7 @@ public:
bool write_immediate_event (size_t size, const uint8_t* buf); bool write_immediate_event (size_t size, const uint8_t* buf);
void realtime_handle_transport_stopped (); void realtime_handle_transport_stopped ();
void realtime_locate (); void realtime_locate (bool);
void monitoring_changed (); void monitoring_changed ();
struct UILayoutHint { struct UILayoutHint {

View File

@ -190,7 +190,7 @@ public:
); );
void realtime_handle_transport_stopped (); void realtime_handle_transport_stopped ();
void realtime_locate (); void realtime_locate (bool);
void monitoring_changed (); void monitoring_changed ();
bool load_preset (Plugin::PresetRecord); bool load_preset (Plugin::PresetRecord);

View File

@ -122,7 +122,7 @@ public:
virtual Buffer& get_buffer (pframes_t nframes) = 0; virtual Buffer& get_buffer (pframes_t nframes) = 0;
virtual void flush_buffers (pframes_t /*nframes*/) {} virtual void flush_buffers (pframes_t /*nframes*/) {}
virtual void transport_stopped () {} virtual void transport_stopped () {}
virtual void realtime_locate () {} virtual void realtime_locate (bool for_loop_end) {}
virtual void set_buffer_size (pframes_t) {} virtual void set_buffer_size (pframes_t) {}
bool physically_connected () const; bool physically_connected () const;

View File

@ -115,7 +115,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
virtual ChanCount output_streams() const { return _configured_output; } virtual ChanCount output_streams() const { return _configured_output; }
virtual void realtime_handle_transport_stopped () {} virtual void realtime_handle_transport_stopped () {}
virtual void realtime_locate () {} virtual void realtime_locate (bool) {}
virtual void set_loop (Location *loc) { _loop_location = loc; } virtual void set_loop (Location *loc) { _loop_location = loc; }

View File

@ -159,7 +159,7 @@ public:
void non_realtime_transport_stop (samplepos_t now, bool flush); void non_realtime_transport_stop (samplepos_t now, bool flush);
virtual void realtime_handle_transport_stopped (); virtual void realtime_handle_transport_stopped ();
virtual void realtime_locate () {} virtual void realtime_locate (bool) {}
virtual void non_realtime_locate (samplepos_t); virtual void non_realtime_locate (samplepos_t);
void set_loop (ARDOUR::Location *); void set_loop (ARDOUR::Location *);

View File

@ -1693,7 +1693,7 @@ private:
void force_locate (samplepos_t sample, bool with_roll = false); void force_locate (samplepos_t sample, bool with_roll = false);
void set_transport_speed (double speed, samplepos_t destination_sample, bool abort = false, bool clear_state = false, bool as_default = false); void set_transport_speed (double speed, samplepos_t destination_sample, bool abort = false, bool clear_state = false, bool as_default = false);
void realtime_stop (bool abort, bool clear_state); void realtime_stop (bool abort, bool clear_state);
void realtime_locate (); void realtime_locate (bool);
void non_realtime_start_scrub (); void non_realtime_start_scrub ();
void non_realtime_set_speed (); void non_realtime_set_speed ();
void non_realtime_locate (); void non_realtime_locate ();

View File

@ -520,13 +520,13 @@ Delivery::non_realtime_transport_stop (samplepos_t now, bool flush)
} }
void void
Delivery::realtime_locate () Delivery::realtime_locate (bool for_loop_end)
{ {
if (_output) { if (_output) {
PortSet& ports (_output->ports()); PortSet& ports (_output->ports());
for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) { for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) {
i->realtime_locate (); i->realtime_locate (for_loop_end);
} }
} }
} }

View File

@ -166,8 +166,12 @@ DiskReader::realtime_handle_transport_stopped ()
} }
void void
DiskReader::realtime_locate () DiskReader::realtime_locate (bool for_loop_end)
{ {
if (!for_loop_end) {
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack>(_track);
_tracker.resolve_notes (mt->immediate_events(), 0);
}
} }
float float
@ -1122,14 +1126,13 @@ DiskReader::get_midi_playback (MidiBuffer& dst, samplepos_t start_sample, sample
cnt -= this_read; cnt -= this_read;
effective_start += this_read; effective_start += this_read;
DEBUG_TRACE (DEBUG::MidiDiskIO, string_compose ("%1 MDS events LOOP read %2 range %3 .. %4 cnt now %5\n", _name, events_read, effective_start, effective_end, cnt)); DEBUG_TRACE (DEBUG::MidiDiskIO, string_compose ("%1 MDS events LOOP read %2 cnt now %3\n", _name, events_read, cnt));
if (cnt) { if (cnt) {
/* We re going to have to read across the loop end. Resolve any notes the extend across the loop end. /* We re going to have to read across the loop end. Resolve any notes the extend across the loop end.
* Time is relative to start_sample. * Time is relative to start_sample.
*/ */
_tracker.resolve_notes (*target, (loc->end() - 1) - start_sample); _tracker.resolve_notes (*target, effective_end - start_sample);
} }
} while (cnt); } while (cnt);

View File

@ -357,7 +357,7 @@ MidiPort::transport_stopped ()
} }
void void
MidiPort::realtime_locate () MidiPort::realtime_locate (bool)
{ {
_resolve_required = true; _resolve_required = true;
} }

View File

@ -351,7 +351,7 @@ MidiTrack::no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, sample
} }
void void
MidiTrack::realtime_locate () MidiTrack::realtime_locate (bool for_loop_end)
{ {
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK); Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
@ -360,10 +360,8 @@ MidiTrack::realtime_locate ()
} }
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
(*i)->realtime_locate (); (*i)->realtime_locate (for_loop_end);
} }
_disk_reader->resolve_tracker (_immediate_events, 0);
} }
void void

View File

@ -391,7 +391,7 @@ Plugin::realtime_handle_transport_stopped ()
} }
void void
Plugin::realtime_locate () Plugin::realtime_locate (bool)
{ {
resolve_midi (); resolve_midi ();
} }

View File

@ -3234,10 +3234,10 @@ PluginInsert::realtime_handle_transport_stopped ()
} }
void void
PluginInsert::realtime_locate () PluginInsert::realtime_locate (bool for_loop_end)
{ {
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->realtime_locate (); (*i)->realtime_locate (for_loop_end);
} }
} }

View File

@ -282,7 +282,7 @@ Session::do_locate (samplepos_t target_sample, bool with_roll, bool with_flush,
boost::shared_ptr<RouteList> r = routes.reader (); boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->realtime_locate (); (*i)->realtime_locate (for_loop_end);
} }
} }