AlignmentChoise is a Track Property

The DiskWriter uses AlignStyle which is set dynamically
by the Track and may depend on I/O connections.
This commit is contained in:
Robin Gareus
2017-09-22 01:52:37 +02:00
parent 506a29e2d3
commit 7a51d8f768
3 changed files with 14 additions and 49 deletions

View File

@@ -82,10 +82,8 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
int use_new_write_source (DataType, uint32_t n = 0);
void reset_write_sources (bool, bool force = false);
AlignStyle alignment_style() const { return _alignment_style; }
AlignChoice alignment_choice() const { return _alignment_choice; }
AlignStyle alignment_style() const { return _alignment_style; }
void set_align_style (AlignStyle, bool force=false);
void set_align_choice (AlignChoice a, bool force=false);
PBD::Signal0<void> AlignmentStyleChanged;
@@ -180,7 +178,6 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
samplepos_t last_recordable_sample;
int last_possibly_recording;
AlignStyle _alignment_style;
AlignChoice _alignment_choice;
std::string _write_source_name;
boost::shared_ptr<SMFSource> _midi_write_source;

View File

@@ -56,7 +56,6 @@ DiskWriter::DiskWriter (Session& s, string const & str, DiskIOProcessor::Flag f)
, last_recordable_sample (max_samplepos)
, last_possibly_recording (0)
, _alignment_style (ExistingMaterial)
, _alignment_choice (Automatic)
, _num_captured_loops (0)
, _accumulated_capture_offset (0)
, _gui_feed_buffer(AudioEngine::instance()->raw_buffer_size (DataType::MIDI))
@@ -333,36 +332,11 @@ DiskWriter::set_align_style (AlignStyle a, bool force)
}
}
void
DiskWriter::set_align_choice (AlignChoice a, bool force)
{
if (record_enabled() && _session.actively_recording()) {
return;
}
if ((a != _alignment_choice) || force) {
_alignment_choice = a;
switch (_alignment_choice) {
case UseExistingMaterial:
set_align_style (ExistingMaterial);
break;
case UseCaptureTime:
set_align_style (CaptureTime);
break;
default:
error << string_compose (_("programming error: %1"), "DiskWriter: asked to use illegal alignment style") << endmsg;
break;
}
}
}
XMLNode&
DiskWriter::state (bool full)
{
XMLNode& node (DiskIOProcessor::state (full));
node.set_property (X_("type"), X_("diskwriter"));
node.set_property (X_("capture-alignment"), enum_2_string (_alignment_choice));
node.set_property (X_("record-safe"), (_record_safe ? X_("yes" : "no")));
return node;
}
@@ -374,14 +348,6 @@ DiskWriter::set_state (const XMLNode& node, int version)
return -1;
}
AlignChoice ac;
if (node.get_property (X_("capture-alignment"), ac)) {
set_align_choice (ac, true);
} else {
set_align_choice (Automatic, true);
}
if (!node.get_property (X_("record-safe"), _record_safe)) {
_record_safe = false;
}

View File

@@ -97,6 +97,7 @@ Track::init ()
_disk_reader->set_block_size (_session.get_block_size ());
_disk_reader->set_route (boost::dynamic_pointer_cast<Route> (shared_from_this()));
set_align_choice_from_io ();
_disk_writer.reset (new DiskWriter (_session, name(), dflags));
_disk_writer->set_block_size (_session.get_block_size ());
_disk_writer->set_route (boost::dynamic_pointer_cast<Route> (shared_from_this()));
@@ -772,7 +773,7 @@ Track::alignment_style () const
AlignChoice
Track::alignment_choice () const
{
return _disk_writer->alignment_choice ();
return _alignment_choice;
}
samplepos_t
@@ -876,17 +877,18 @@ Track::use_new_playlist (DataType dt)
void
Track::set_align_choice (AlignChoice ac, bool force)
{
switch (ac) {
case Automatic:
_alignment_choice = Automatic;
set_align_choice_from_io ();
return;
default:
break;
}
_disk_writer->set_align_choice (ac, force);
_alignment_choice = ac;
switch (ac) {
case Automatic:
set_align_choice_from_io ();
break;
case UseCaptureTime:
_disk_writer->set_align_style (CaptureTime, force);
break;
case UseExistingMaterial:
_disk_writer->set_align_style (ExistingMaterial, force);
break;
}
}
void