manual post-conflict-resolution cleanups (library edition)

This commit is contained in:
Paul Davis 2021-07-16 14:11:30 -06:00
parent bf50d27b68
commit d772ea3fdf
5 changed files with 31 additions and 27 deletions

View file

@ -165,9 +165,6 @@ public:
std::pair<timepos_t, timepos_t> get_extent_with_endspace() const;
layer_t top_layer() const;
EditMode get_edit_mode() const { return _edit_mode; }
void set_edit_mode (EditMode);
/* Editing operations */
void add_region (boost::shared_ptr<Region>, timepos_t const & position, float times = 1, bool auto_partition = false);
@ -235,7 +232,7 @@ public:
bool region_is_shuffle_constrained (boost::shared_ptr<Region>);
bool has_region_at (timepos_t const &) const;
samplepos_t find_prev_region_start (samplepos_t sample);
timepos_t find_prev_region_start (timepos_t const & sample);
bool uses_source (boost::shared_ptr<const Source> src, bool shallow = false) const;
void deep_sources (std::set<boost::shared_ptr<Source> >&) const;

View file

@ -219,9 +219,9 @@ DiskWriter::check_record_status (samplepos_t transport_sample, double speed, boo
/* set _capture_start_sample early on to calculate MIDI _accumulated_capture_offset */
Location* loc;
if (_session.config.get_punch_in () && 0 != (loc = _session.locations()->auto_punch_location ())) {
_capture_start_sample = loc->start ();
_capture_start_sample = loc->start_sample ();
} else if (_loop_location) {
_capture_start_sample = _loop_location->start ();
_capture_start_sample = _loop_location->start_sample ();
} else if ((possibly_recording & rec_ready) == rec_ready) {
/* count-in, pre-roll */
_capture_start_sample = _session.transport_sample ();
@ -533,7 +533,7 @@ DiskWriter::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
if (_midi_write_source) {
assert (_capture_start_sample);
timepos_t start (_capture_start_sample);
timepos_t start (_capture_start_sample.get());
if (time_domain() != Temporal::AudioTime) {
start = timepos_t (start.beats());
@ -1171,7 +1171,6 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
finish_capture (c);
/* butler is already stopped, but there may be work to do
to flush remaining data to disk.
*/
@ -1288,7 +1287,12 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
where all the data is already on disk.
*/
_midi_write_source->mark_midi_streaming_write_completed (source_lock, Evoral::Sequence<Temporal::Beats>::ResolveStuckNotes, timecnt_t (total_capture, timepos_t (capture_info.front()->start)).beats());
timecnt_t total_capture (0, timepos_t (capture_info.front()->start));
for (vector<CaptureInfo*>::iterator ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
total_capture += timecnt_t ((*ci)->samples);
}
_midi_write_source->mark_midi_streaming_write_completed (source_lock, Evoral::Sequence<Temporal::Beats>::ResolveStuckNotes, total_capture.beats());
}
_last_capture_sources.insert (_last_capture_sources.end(), audio_srcs.begin(), audio_srcs.end());

View file

@ -1531,7 +1531,7 @@ Locations::ripple (timepos_t const & at, timecnt_t const & distance, bool includ
/* keep session range markers covering entire region if
a ripple "extends" the session.
*/
if (distance > 0 && (*i)->is_session_range()) {
if (distance.positive() && (*i)->is_session_range()) {
/* Don't move start unless it occurs after the ripple point.
*/

View file

@ -1581,13 +1581,14 @@ Playlist::ripple_unlocked (timepos_t const & at, timecnt_t const & distance, Reg
thawlist.add (*i);
(*i)->set_position (new_pos);
changed = true;
}
}
_rippling = false;
return changed;
if (notify) {
notify_contents_changed ();
}
}
void
@ -2039,26 +2040,26 @@ Playlist::find_next_region (timepos_t const & pos, RegionPoint point, int dir)
return ret;
}
samplepos_t
Playlist::find_prev_region_start (samplepos_t sample)
timepos_t
Playlist::find_prev_region_start (timepos_t const & at)
{
RegionReadLock rlock (this);
samplepos_t closest = max_samplepos;
samplepos_t ret = -1;
timecnt_t closest = timecnt_t::max (at.time_domain());
timepos_t ret = timepos_t::max (at.time_domain());;
for (RegionList::reverse_iterator i = regions.rbegin (); i != regions.rend (); ++i) {
boost::shared_ptr<Region> r = (*i);
sampleoffset_t distance;
const samplepos_t first_sample = r->first_sample ();
timecnt_t distance;
const timepos_t first_sample = r->position();
if (first_sample == sample) {
if (first_sample == at) {
/* region at the given position - ignore */
continue;
}
if (first_sample < sample) {
distance = sample - first_sample;
if (first_sample < at) {
distance = first_sample.distance (at);
if (distance < closest) {
ret = first_sample;

View file

@ -943,25 +943,27 @@ PluginInsert::connect_and_run (BufferSet& bufs, samplepos_t start, samplepos_t e
#if 1
/* 2. VST3: events between now and end. */
samplepos_t now = start;
timepos_t start_time (start);
timepos_t now (start_time);
while (true) {
Evoral::ControlEvent next_event (end, 0.0f);
find_next_ac_event (*ci, now, end, next_event);
if (next_event.when >= end) {
timepos_t end_time (end);
Evoral::ControlEvent next_event (end_time, 0.0f);
find_next_ac_event (*ci, now, end_time, next_event);
if (next_event.when >= end_time) {
break;
}
now = next_event.when;
const float val = c.list()->rt_safe_eval (now, valid);
if (valid) {
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->set_parameter (clist->parameter().id(), val, now - start);
(*i)->set_parameter (clist->parameter().id(), val, now.samples() - start);
}
}
}
#endif
#if 1
/* 3. VST3: set value at cycle-end */
val = c.list()->rt_safe_eval (end, valid);
val = c.list()->rt_safe_eval (timepos_t (end), valid);
if (valid) {
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->set_parameter (clist->parameter().id(), val, end - start);