13
0

fix erroneous API changes related to ::reset_write_sources() introduced in midilen branch

This restores peak file building after capture
This commit is contained in:
Paul Davis 2024-11-06 18:59:33 -07:00
parent ed1ab8622e
commit 2ad12280f6
7 changed files with 30 additions and 16 deletions

View File

@ -74,7 +74,7 @@ public:
std::string steal_write_source_name ();
int use_new_write_source (DataType, uint32_t n = 0);
void reset_write_sources ();
void reset_write_sources (bool mark_write_complete);
AlignStyle alignment_style () const { return _alignment_style; }
void set_align_style (AlignStyle, bool force = false);

View File

@ -1982,7 +1982,7 @@ public:
ARDOUR::CueMarkers pending_source_markers; // source markers created while recording
private:
void reset_write_sources ();
void reset_write_sources (bool mark_write_complete);
SourceMap sources;
int load_sources (const XMLNode& node);

View File

@ -145,7 +145,7 @@ public:
void ensure_input_monitoring (bool);
std::list<std::shared_ptr<Source> > & last_capture_sources ();
std::string steal_write_source_name ();
void reset_write_sources ();
void reset_write_sources (bool mark_write_complete);
float playback_buffer_load () const;
float capture_buffer_load () const;
int do_refill ();

View File

@ -123,7 +123,7 @@ DiskWriter::set_write_source_name (string const & str)
{
_write_source_name = str;
reset_write_sources ();
reset_write_sources (false);
return true;
}
@ -390,7 +390,7 @@ DiskWriter::set_state (const XMLNode& node, int version)
node.get_property (X_("record-safe"), rec_safe);
_record_safe.store (rec_safe);
reset_write_sources ();
reset_write_sources (false);
return 0;
}
@ -1072,7 +1072,7 @@ DiskWriter::do_flush (RunContext ctxt, bool force_flush)
}
void
DiskWriter::reset_write_sources ()
DiskWriter::reset_write_sources (bool mark_write_complete)
{
std::shared_ptr<ChannelList const> c = channels.reader();
uint32_t n = 0;
@ -1085,6 +1085,16 @@ DiskWriter::reset_write_sources ()
for (auto const chan : *c) {
if (mark_write_complete) {
Source::WriterLock lock(chan->write_source->mutex());
/* we're iterating over channels, so we know this is an
audio source and the duration argument makes no
difference
*/
chan->write_source->mark_streaming_write_completed (lock, timecnt_t());
chan->write_source->done_with_peakfile_writes ();
}
if (chan->write_source) {
if (chan->write_source->removable()) {
@ -1173,6 +1183,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
ChannelList::const_iterator chan;
std::shared_ptr<ChannelList const> c = channels.reader();
uint32_t n = 0;
bool mark_write_completed = false;
finish_capture (c);
@ -1315,8 +1326,10 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
_track.use_captured_sources (audio_srcs, capture_info);
_track.use_captured_sources (midi_srcs, capture_info);
mark_write_completed = true;
out:
reset_write_sources ();
reset_write_sources (mark_write_completed);
for (vector<CaptureInfo*>::iterator ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
delete *ci;
@ -1429,6 +1442,7 @@ bool
DiskWriter::configure_io (ChanCount in, ChanCount out)
{
bool changed = false;
{
std::shared_ptr<ChannelList const> c = channels.reader();
if (in.n_audio() != c->size()) {
@ -1445,7 +1459,7 @@ DiskWriter::configure_io (ChanCount in, ChanCount out)
}
if (record_enabled() || changed) {
reset_write_sources ();
reset_write_sources (false);
}
return true;
@ -1460,7 +1474,7 @@ DiskWriter::use_playlist (DataType dt, std::shared_ptr<Playlist> playlist)
return -1;
}
if (reset_ws) {
reset_write_sources ();
reset_write_sources (false);
}
return 0;
}

View File

@ -2412,7 +2412,7 @@ Session::set_sample_rate (samplecnt_t frames_per_second)
sync_time_vars();
clear_clicks ();
reset_write_sources ();
reset_write_sources (false);
DiskReader::alloc_loop_declick (nominal_sample_rate());
Location* loc = _locations->auto_loop_location ();
@ -6124,7 +6124,7 @@ Session::reset_native_file_format ()
if (tr) {
/* don't save state as we do this, there's no point */
_state_of_the_state = StateOfTheState (_state_of_the_state | InCleanup);
tr->reset_write_sources ();
tr->reset_write_sources (false);
_state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup);
}
}

View File

@ -2687,14 +2687,14 @@ Session::get_sources_as_xml ()
}
void
Session::reset_write_sources ()
Session::reset_write_sources (bool mark_write_complete)
{
std::shared_ptr<RouteList const> rl = routes.reader();
for (auto const& i : *rl) {
std::shared_ptr<Track> tr = std::dynamic_pointer_cast<Track> (i);
if (tr) {
_state_of_the_state = StateOfTheState (_state_of_the_state | InCleanup);
tr->reset_write_sources ();
tr->reset_write_sources (mark_write_complete);
_state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup);
}
}
@ -5442,7 +5442,7 @@ Session::save_as (SaveAs& saveas)
/* ensure that all existing tracks reset their current capture source paths
*/
reset_write_sources ();
reset_write_sources (true);
/* creating new write sources marks the session as
dirty. If the new session is empty, then

View File

@ -592,9 +592,9 @@ Track::steal_write_source_name()
}
void
Track::reset_write_sources ()
Track::reset_write_sources (bool mark_write_complete)
{
_disk_writer->reset_write_sources ();
_disk_writer->reset_write_sources (mark_write_complete);
}
float