X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fprocessor.cc;h=39c3d68ad7941d8ac35a852e057cd2f0486521f6;hb=81bff2edee31ad64693d5be3c06558714ea92722;hp=215e71dc9046ad775ae40e4e49dfbe661a0a8b4e;hpb=b1cccf0d7dfb5352646bbac864d6b166da9400b2;p=ardour.git diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 215e71dc90..39c3d68ad7 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -28,6 +28,7 @@ #include "ardour/automatable.h" #include "ardour/chan_count.h" +#include "ardour/debug.h" #include "ardour/processor.h" #include "ardour/types.h" @@ -67,6 +68,11 @@ Processor::Processor(Session& session, const string& name) , _window_proxy (0) , _pinmgr_proxy (0) , _owner (0) + , _input_latency (0) + , _output_latency (0) + , _capture_offset (0) + , _playback_offset (0) + , _loop_location (0) { } @@ -85,13 +91,23 @@ Processor::Processor (const Processor& other) , _window_proxy (0) , _pinmgr_proxy (0) , _owner (0) + , _input_latency (0) + , _output_latency (0) + , _capture_offset (0) + , _playback_offset (0) + , _loop_location (other._loop_location) { } +Processor::~Processor () +{ + DEBUG_TRACE (DEBUG::Destruction, string_compose ("processor %1 destructor\n", _name)); +} + XMLNode& Processor::get_state (void) { - return state (true); + return state (); } /* NODE STRUCTURE @@ -109,7 +125,7 @@ Processor::get_state (void) */ XMLNode& -Processor::state (bool full_state) +Processor::state () { XMLNode* node = new XMLNode (state_node_name); @@ -121,7 +137,7 @@ Processor::state (bool full_state) node->add_child_copy (*_extra_xml); } - if (full_state) { + if (!skip_saving_automation) { XMLNode& automation = Automatable::get_automation_xml_state(); if (!automation.children().empty() || !automation.properties().empty()) { node->add_child_nocopy (automation); @@ -227,7 +243,7 @@ Processor::set_state (const XMLNode& node, int version) } } - bool const a = string_is_affirmative (prop->value ()) && !_session.get_bypass_all_loaded_plugins(); + bool const a = string_to (prop->value ()) && !_session.get_bypass_all_loaded_plugins(); if (_active != a) { if (a) { activate (); @@ -259,6 +275,34 @@ Processor::configure_io (ChanCount in, ChanCount out) return true; } +bool +Processor::map_loop_range (samplepos_t& start, samplepos_t& end) const +{ + if (!_loop_location) { + return false; + } + if (start >= end) { + /* no backwards looping */ + return false; + } + + const samplepos_t loop_end = _loop_location->end (); + if (start < loop_end) { + return false; + } + + const samplepos_t loop_start = _loop_location->start (); + const samplecnt_t looplen = loop_end - loop_start; + const sampleoffset_t start_off = (start - loop_start) % looplen; + const samplepos_t start_pos = loop_start + start_off; + + assert (start >= start_pos); + end -= start - start_pos; + start = start_pos; + assert (end > start); + return true; +} + void Processor::set_display_to_user (bool yn) { @@ -271,12 +315,6 @@ Processor::set_pre_fader (bool p) _pre_fader = p; } -void -Processor::set_ui (void* p) -{ - _ui_pointer = p; -} - void Processor::set_owner (SessionObject* o) {