X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fpanner.cc;h=59e4e2e977952841f98d7d68601899483597f184;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=1cb5e310aa36fc5a62106389c29eb45dcd7b0a10;hpb=d116af22db3c0e0cf6aeff6194a689d8bfad7c8c;p=ardour.git diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 1cb5e310aa..59e4e2e977 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -17,153 +17,119 @@ */ -#include "ardour/audio_buffer.h" #include "ardour/buffer_set.h" +#include "ardour/debug.h" #include "ardour/panner.h" #include "ardour/pannable.h" -#include "ardour/session.h" -#include "ardour/utils.h" + +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; Panner::Panner (boost::shared_ptr p) - : _pannable (p) - , _mono (0) + : _frozen (0) { + // boost_debug_shared_ptr_mark_interesting (this, "panner"); + _pannable = p; } Panner::~Panner () { -} - -void -Panner::set_bypassed (bool yn) -{ - if (yn != _bypassed) { - _bypassed = yn; - StateChanged (); - } -} - -void -Panner::set_mono (bool yn) -{ - if (yn != _mono) { - _mono = yn; - StateChanged (); - } -} - -int -Panner::set_state (const XMLNode& node, int version) -{ - const XMLProperty* prop; - XMLNodeConstIterator iter; - - if ((prop = node.property (X_("mono")))) { - set_mono (string_is_affirmative (prop->value())); - } - - if ((prop = node.property (X_("bypassed"))) != 0) { - set_bypassed (string_is_affirmative (prop->value())); - } - - return 0; + DEBUG_TRACE(PBD::DEBUG::Destruction, string_compose ("panner @ %1 destructor, pannable is %2 @ %3\n", this, _pannable, &_pannable)); } XMLNode& Panner::get_state () { - XMLNode* node = new XMLNode (X_("Panner")); - - node->add_property (X_("mono"), (_mono ? "yes" : "no")); - node->add_property (X_("bypassed"), (bypassed() ? "yes" : "no")); - - return *node; + return *(new XMLNode (X_("Panner"))); } void Panner::distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes) { - uint32_t which = 0; + uint32_t which = 0; for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) { - if (_mono) { - /* we're in mono mode, so just pan the input to all outputs equally (XXX should we scale?) */ - for (BufferSet::audio_iterator o = obufs.audio_begin(); o != obufs.audio_end(); ++o) { - mix_buffers_with_gain ((*o).data(), (*src).data(), nframes, gain_coeff); - } - } else { - /* normal mode, call the `real' distribute method */ - distribute_one (*src, obufs, gain_coeff, nframes, which); - } - } + distribute_one (*src, obufs, gain_coeff, nframes, which); + } } void Panner::distribute_automated (BufferSet& ibufs, BufferSet& obufs, framepos_t start, framepos_t end, pframes_t nframes, pan_t** buffers) { - uint32_t which = 0; + uint32_t which = 0; for (BufferSet::audio_iterator src = ibufs.audio_begin(); src != ibufs.audio_end(); ++src, ++which) { - if (_mono) { - /* we're in mono mode, so just pan the input to all outputs equally (XXX should we scale?) */ - for (BufferSet::audio_iterator o = obufs.audio_begin(); o != obufs.audio_end(); ++o) { - mix_buffers_with_gain ((*o).data(), (*src).data(), nframes, 1.0); - } - } else { - /* normal mode, call the `real' distribute method */ - distribute_one_automated (*src, obufs, start, end, nframes, buffers, which); - } - } + distribute_one_automated (*src, obufs, start, end, nframes, buffers, which); + } } void Panner::set_automation_style (AutoStyle style) { - _pannable->set_automation_style (style); + _pannable->set_automation_style (style); } void Panner::set_automation_state (AutoState state) { - _pannable->set_automation_state (state); + _pannable->set_automation_state (state); } AutoState Panner::automation_state () const { - return _pannable->automation_state(); + return _pannable->automation_state(); } AutoStyle Panner::automation_style () const { - return _pannable->automation_style (); + return _pannable->automation_style (); } bool Panner::touching () const { - return _pannable->touching (); + return _pannable->touching (); } -set +set Panner::what_can_be_automated() const { - return _pannable->what_can_be_automated (); + return _pannable->what_can_be_automated (); } string Panner::describe_parameter (Evoral::Parameter p) { - return _pannable->describe_parameter (p); + return _pannable->describe_parameter (p); +} + +string +Panner::value_as_string (boost::shared_ptr ac) const +{ + return _pannable->value_as_string (ac); +} + +int +Panner::set_state (XMLNode const &, int) +{ + return 0; +} + +void +Panner::freeze () +{ + _frozen++; } -string -Panner::value_as_string (boost::shared_ptr ac) const +void +Panner::thaw () { - return _pannable->value_as_string (ac); + if (_frozen > 0.0) { + _frozen--; + } }