From dc4f730ac95837590e8305f69778d1049e4a545e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 20 Jul 2017 19:05:35 -0400 Subject: initial (incomplete) framework for DiskIOPoint manipulation --- libs/ardour/ardour/route.h | 2 ++ libs/ardour/ardour/track.h | 10 +++++++--- libs/ardour/ardour/types.h | 2 +- libs/ardour/ardour/types_convert.h | 1 + libs/ardour/route.cc | 2 ++ libs/ardour/track.cc | 40 ++++++++++++++++++++++++++++++++++---- 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index f3a0dac4df..c3d46f6175 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -740,6 +740,8 @@ private: framecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, framecnt_t) const; void setup_invisible_processors (); + virtual void setup_invisible_processors_oh_children_of_mine (ProcessorList&) {} + void unpan (); void set_plugin_state_dir (boost::weak_ptr, const std::string&); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 33903c2b91..1bd65a984c 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -185,6 +185,8 @@ class LIBARDOUR_API Track : public Route, public Recordable void adjust_playback_buffering (); void adjust_capture_buffering (); + void set_disk_io_position (DiskIOPoint); + PBD::Signal0 FreezeChange; PBD::Signal0 PlaylistChanged; PBD::Signal0 SpeedChanged; @@ -198,6 +200,7 @@ class LIBARDOUR_API Track : public Route, public Recordable boost::shared_ptr _playlists[DataType::num_types]; MeterPoint _saved_meter_point; + DiskIOPoint _disk_io_point; TrackMode _mode; bool _needs_butler; boost::shared_ptr _monitoring_control; @@ -227,9 +230,9 @@ class LIBARDOUR_API Track : public Route, public Recordable virtual void set_state_part_two () = 0; - FreezeRecord _freeze_record; - XMLNode* pending_state; - bool _destructive; + FreezeRecord _freeze_record; + XMLNode* pending_state; + bool _destructive; void maybe_declick (BufferSet&, framecnt_t, int); @@ -251,6 +254,7 @@ class LIBARDOUR_API Track : public Route, public Recordable private: void parameter_changed (std::string const & p); + void setup_invisible_processors_oh_children_of_mine (ProcessorList&); std::string _diskstream_name; }; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index bf32e85cd0..3999c36aa3 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -195,7 +195,7 @@ namespace ARDOUR { enum DiskIOPoint { DiskIOPreFader, /* after the trim control, but before other processors */ DiskIOPostFader, /* before the main outs, after other processors */ - DiskIOCaustom, /* up to the user. Caveat Emptor! */ + DiskIOCustom, /* up to the user. Caveat Emptor! */ }; enum MeterType { diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index 52cf616c29..ab6fa8353e 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -58,6 +58,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::BufferingPreset) DEFINE_ENUM_CONVERT(ARDOUR::AutoReturnTarget) DEFINE_ENUM_CONVERT(ARDOUR::MeterType) DEFINE_ENUM_CONVERT(ARDOUR::MeterPoint) +DEFINE_ENUM_CONVERT(ARDOUR::DiskIOPoint) DEFINE_ENUM_CONVERT(ARDOUR::NoteMode) DEFINE_ENUM_CONVERT(ARDOUR::ChannelMode) DEFINE_ENUM_CONVERT(ARDOUR::MonitorChoice) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index b7a57fd3f1..d405dd8f08 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -4649,6 +4649,8 @@ Route::setup_invisible_processors () new_processors.push_front (_capturing_processor); } + setup_invisible_processors_oh_children_of_mine (new_processors); + _processors = new_processors; for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index c9f581add2..481da6f22c 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -55,6 +55,7 @@ using namespace PBD; Track::Track (Session& sess, string name, PresentationInfo::Flag flag, TrackMode mode, DataType default_type) : Route (sess, name, flag, default_type) , _saved_meter_point (_meter_point) + , _disk_io_point (DiskIOPreFader) , _mode (mode) , _alignment_choice (Automatic) { @@ -102,10 +103,9 @@ Track::init () use_new_playlist (); - /* ordering here is important, and needs to be generally maintained */ - - add_processor (_disk_writer, PreFader); - add_processor (_disk_reader, PreFader); + /* disk writer and reader processors will be added when Route calls + * setup_invisible_processors_oh_children_of_mine (). + */ boost::shared_ptr rp (boost::dynamic_pointer_cast (shared_from_this())); boost::shared_ptr rt = boost::dynamic_pointer_cast (rp); @@ -162,6 +162,7 @@ Track::state (bool full) root.add_child_nocopy (_record_enable_control->get_state ()); root.set_property (X_("saved-meter-point"), _saved_meter_point); + root.set_property (X_("disk-io-point"), _disk_io_point); root.set_property (X_("alignment-choice"), _alignment_choice); return root; @@ -224,6 +225,10 @@ Track::set_state (const XMLNode& node, int version) _saved_meter_point = _meter_point; } + if (!node.get_property (X_("saved-meter-point"), _disk_io_point)) { + _disk_io_point = DiskIOPreFader; + } + AlignChoice ac; if (node.get_property (X_("alignment-choice"), ac)) { @@ -1512,3 +1517,30 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur pl->set_capture_insertion_in_progress (false); _session.add_command (new StatefulDiffCommand (pl)); } + +#ifdef __clang__ +__attribute__((annotate("realtime"))) +#endif +void +Track::setup_invisible_processors_oh_children_of_mine (ProcessorList& new_processors) +{ + ProcessorList::iterator insert_pos; + + switch (_disk_io_point) { + case DiskIOPreFader: + insert_pos = find (new_processors.begin(), new_processors.end(), _trim); + if (insert_pos != new_processors.end()) { + insert_pos = new_processors.insert (insert_pos, _disk_writer); + new_processors.insert (insert_pos, _disk_reader); + } + break; + case DiskIOPostFader: + insert_pos = find (new_processors.begin(), new_processors.end(), _main_outs); + if (insert_pos != new_processors.end()) { + insert_pos = new_processors.insert (insert_pos, _disk_writer); + new_processors.insert (insert_pos, _disk_reader); + } + case DiskIOCustom: + break; + } +} -- cgit v1.2.3