various adjustments so that a MidiPlaylist gets re-rendered whenever it changes.
This may still be missing a few changes (i.e. they do not cause re-rendering)
This commit is contained in:
parent
6128d1759c
commit
b83ef09947
@ -1101,8 +1101,6 @@ MidiRegionView::apply_diff (bool as_subcommand, bool was_copy)
|
|||||||
|
|
||||||
if (commit) {
|
if (commit) {
|
||||||
trackview.editor().commit_reversible_command ();
|
trackview.editor().commit_reversible_command ();
|
||||||
/* XXX the GUI should NOT be responsible for causing this call tree */
|
|
||||||
midi_view()->midi_track()->region_edited (_region);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,6 @@ protected:
|
|||||||
|
|
||||||
void resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time);
|
void resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time);
|
||||||
|
|
||||||
void playlist_changed (const PBD::PropertyChange&);
|
|
||||||
int use_playlist (DataType, boost::shared_ptr<Playlist>);
|
int use_playlist (DataType, boost::shared_ptr<Playlist>);
|
||||||
void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool);
|
void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool);
|
||||||
|
|
||||||
|
@ -162,6 +162,7 @@ class LIBARDOUR_API MidiRegion : public Region
|
|||||||
void update_length_beats (const int32_t sub_num);
|
void update_length_beats (const int32_t sub_num);
|
||||||
|
|
||||||
void model_changed ();
|
void model_changed ();
|
||||||
|
void model_contents_changed ();
|
||||||
void model_shifted (double qn_distance);
|
void model_shifted (double qn_distance);
|
||||||
void model_automation_state_changed (Evoral::Parameter const &);
|
void model_automation_state_changed (Evoral::Parameter const &);
|
||||||
|
|
||||||
@ -171,6 +172,7 @@ class LIBARDOUR_API MidiRegion : public Region
|
|||||||
std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading
|
std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading
|
||||||
PBD::ScopedConnection _model_connection;
|
PBD::ScopedConnection _model_connection;
|
||||||
PBD::ScopedConnection _model_shift_connection;
|
PBD::ScopedConnection _model_shift_connection;
|
||||||
|
PBD::ScopedConnection _model_changed_connection;
|
||||||
PBD::ScopedConnection _source_connection;
|
PBD::ScopedConnection _source_connection;
|
||||||
PBD::ScopedConnection _model_contents_connection;
|
PBD::ScopedConnection _model_contents_connection;
|
||||||
bool _ignore_shift;
|
bool _ignore_shift;
|
||||||
|
@ -139,6 +139,8 @@ public:
|
|||||||
void realtime_handle_transport_stopped ();
|
void realtime_handle_transport_stopped ();
|
||||||
void region_edited (boost::shared_ptr<Region>);
|
void region_edited (boost::shared_ptr<Region>);
|
||||||
|
|
||||||
|
int use_playlist (DataType, boost::shared_ptr<Playlist>);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
XMLNode& state (bool save_template);
|
XMLNode& state (bool save_template);
|
||||||
@ -174,6 +176,9 @@ private:
|
|||||||
/** Update automation controls to reflect any changes in buffers. */
|
/** Update automation controls to reflect any changes in buffers. */
|
||||||
void update_controls (BufferSet const& bufs);
|
void update_controls (BufferSet const& bufs);
|
||||||
void restore_controls ();
|
void restore_controls ();
|
||||||
|
|
||||||
|
void playlist_contents_changed ();
|
||||||
|
PBD::ScopedConnection playlist_content_change_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ARDOUR*/
|
} /* namespace ARDOUR*/
|
||||||
|
@ -204,12 +204,6 @@ DiskReader::adjust_buffering ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
DiskReader::playlist_changed (const PropertyChange&)
|
|
||||||
{
|
|
||||||
playlist_modified ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DiskReader::playlist_modified ()
|
DiskReader::playlist_modified ()
|
||||||
{
|
{
|
||||||
@ -237,6 +231,8 @@ DiskReader::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist)
|
|||||||
take care of the buffer refill.
|
take care of the buffer refill.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
cerr << "DR " << _track->name() << " using playlist, loading ? " << _session.loading() << endl;
|
||||||
|
|
||||||
if (!overwrite_queued && (prior_playlist || _session.loading())) {
|
if (!overwrite_queued && (prior_playlist || _session.loading())) {
|
||||||
_session.request_overwrite_buffer (_track);
|
_session.request_overwrite_buffer (_track);
|
||||||
overwrite_queued = true;
|
overwrite_queued = true;
|
||||||
@ -258,7 +254,6 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
|
|||||||
if (run_must_resolve) {
|
if (run_must_resolve) {
|
||||||
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (_track);
|
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (_track);
|
||||||
if (mt) {
|
if (mt) {
|
||||||
cerr << _track->name() << " resolving " << _tracker.on() << " notes @ " << start_sample << endl;
|
|
||||||
resolve_tracker (mt->immediate_events(), start_sample);
|
resolve_tracker (mt->immediate_events(), start_sample);
|
||||||
}
|
}
|
||||||
run_must_resolve = false;
|
run_must_resolve = false;
|
||||||
@ -532,8 +527,8 @@ DiskReader::overwrite_existing_buffers ()
|
|||||||
midi_playlist()->render (0);
|
midi_playlist()->render (0);
|
||||||
minsert.update();
|
minsert.update();
|
||||||
assert (midi_playlist()->rendered());
|
assert (midi_playlist()->rendered());
|
||||||
//cerr << "Reading " << name() << " took " << minsert.elapsed() << " microseconds, final size = " << midi_playlist()->rendered()->size() << endl;
|
// cerr << "Reading " << name() << " took " << minsert.elapsed() << " microseconds, final size = " << midi_playlist()->rendered()->size() << endl;
|
||||||
//midi_playlist()->rendered()->dump (100);
|
// midi_playlist()->rendered()->dump (100);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_atomic_int_set (&_pending_overwrite, 0);
|
g_atomic_int_set (&_pending_overwrite, 0);
|
||||||
|
@ -416,7 +416,7 @@ MidiPlaylist::render (MidiChannelFilter* filter)
|
|||||||
|
|
||||||
Playlist::RegionReadLock rl (this);
|
Playlist::RegionReadLock rl (this);
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::MidiPlaylistIO, "---- MidiPlaylist::dump-----\n");
|
DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("---- MidiPlaylist::render (regions: %1)-----\n", regions.size()));
|
||||||
|
|
||||||
std::vector< boost::shared_ptr<Region> > regs;
|
std::vector< boost::shared_ptr<Region> > regs;
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ MidiPlaylist::render (MidiChannelFilter* filter)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("dump from %1 at %2\n", mr->name()));
|
DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("render from %1\n", mr->name()));
|
||||||
mr->render (*tgt, 0, _note_mode, filter);
|
mr->render (*tgt, 0, _note_mode, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ MidiRegion::render (Evoral::EventSink<samplepos_t>& dst,
|
|||||||
dst, // destination buffer
|
dst, // destination buffer
|
||||||
_position - _start, // start position of the source in session samples
|
_position - _start, // start position of the source in session samples
|
||||||
_start + internal_offset, // where to start reading in the source
|
_start + internal_offset, // where to start reading in the source
|
||||||
max_samplecnt,
|
_start + internal_offset + _length,
|
||||||
0,
|
0,
|
||||||
cursor,
|
cursor,
|
||||||
0,
|
0,
|
||||||
@ -670,7 +670,16 @@ MidiRegion::model_changed ()
|
|||||||
);
|
);
|
||||||
|
|
||||||
model()->ContentsShifted.connect_same_thread (_model_shift_connection, boost::bind (&MidiRegion::model_shifted, this, _1));
|
model()->ContentsShifted.connect_same_thread (_model_shift_connection, boost::bind (&MidiRegion::model_shifted, this, _1));
|
||||||
|
model()->ContentsChanged.connect_same_thread (_model_changed_connection, boost::bind (&MidiRegion::model_contents_changed, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegion::model_contents_changed ()
|
||||||
|
{
|
||||||
|
std::cerr << "MIDI Region " << name() << " contents changed\n";
|
||||||
|
send_change (Properties::contents);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiRegion::model_shifted (double qn_distance)
|
MidiRegion::model_shifted (double qn_distance)
|
||||||
{
|
{
|
||||||
@ -685,6 +694,7 @@ MidiRegion::model_shifted (double qn_distance)
|
|||||||
_start = new_start;
|
_start = new_start;
|
||||||
what_changed.add (Properties::start);
|
what_changed.add (Properties::start);
|
||||||
what_changed.add (Properties::start_beats);
|
what_changed.add (Properties::start_beats);
|
||||||
|
what_changed.add (Properties::contents);
|
||||||
send_change (what_changed);
|
send_change (what_changed);
|
||||||
} else {
|
} else {
|
||||||
_ignore_shift = false;
|
_ignore_shift = false;
|
||||||
|
@ -873,9 +873,7 @@ MidiTrack::realtime_handle_transport_stopped ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiTrack::region_edited(boost::shared_ptr<Region> region)
|
MidiTrack::playlist_contents_changed ()
|
||||||
|
|
||||||
{
|
{
|
||||||
cerr << "MIDI region " << region->name() << " edited, queue reload\n";
|
|
||||||
_session.request_overwrite_buffer (boost::dynamic_pointer_cast<Track> (shared_from_this()));
|
|
||||||
}
|
}
|
||||||
|
@ -1772,14 +1772,18 @@ Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<
|
|||||||
our_interests.add (Properties::muted);
|
our_interests.add (Properties::muted);
|
||||||
our_interests.add (Properties::layer);
|
our_interests.add (Properties::layer);
|
||||||
our_interests.add (Properties::opaque);
|
our_interests.add (Properties::opaque);
|
||||||
|
our_interests.add (Properties::contents);
|
||||||
|
|
||||||
bounds.add (Properties::start);
|
bounds.add (Properties::start);
|
||||||
bounds.add (Properties::position);
|
bounds.add (Properties::position);
|
||||||
bounds.add (Properties::length);
|
bounds.add (Properties::length);
|
||||||
|
|
||||||
|
bool send_contents = false;
|
||||||
|
|
||||||
if (what_changed.contains (bounds)) {
|
if (what_changed.contains (bounds)) {
|
||||||
region_bounds_changed (what_changed, region);
|
region_bounds_changed (what_changed, region);
|
||||||
save = !(_splicing || _nudging);
|
save = !(_splicing || _nudging);
|
||||||
|
send_contents = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (what_changed.contains (Properties::position) && !what_changed.contains (Properties::length)) {
|
if (what_changed.contains (Properties::position) && !what_changed.contains (Properties::length)) {
|
||||||
@ -1788,8 +1792,6 @@ Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<
|
|||||||
notify_region_end_trimmed (region);
|
notify_region_end_trimmed (region);
|
||||||
} else if (what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) {
|
} else if (what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) {
|
||||||
notify_region_start_trimmed (region);
|
notify_region_start_trimmed (region);
|
||||||
} else if (what_changed.contains (Properties::start)) {
|
|
||||||
notify_contents_changed ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't notify about layer changes, since we are the only object that can initiate
|
/* don't notify about layer changes, since we are the only object that can initiate
|
||||||
@ -1800,6 +1802,10 @@ Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<
|
|||||||
save = true;
|
save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (send_contents || save) {
|
||||||
|
notify_contents_changed ();
|
||||||
|
}
|
||||||
|
|
||||||
mark_session_dirty ();
|
mark_session_dirty ();
|
||||||
|
|
||||||
return save;
|
return save;
|
||||||
|
Loading…
Reference in New Issue
Block a user