diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-03-07 19:06:42 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-03-07 19:06:42 +0000 |
commit | 665f3bea5a7b145636b6d85bb3623013e38f1819 (patch) | |
tree | 56c8e8d1436eef6a4fd8134a89d73d3d5648c0d4 /libs/ardour/audio_port.cc | |
parent | 61cbf95f9973234ccf77f0a321860b783e47d82f (diff) |
fix all manner of wrongness with port buffer offsets
git-svn-id: svn://localhost/ardour2/branches/3.0@9098 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_port.cc')
-rw-r--r-- | libs/ardour/audio_port.cc | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index aad56748c3..f8a1018e29 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -17,6 +17,9 @@ */ #include <cassert> + +#include "pbd/stacktrace.h" + #include "ardour/audio_port.h" #include "ardour/audioengine.h" #include "ardour/data_type.h" @@ -25,8 +28,6 @@ using namespace ARDOUR; using namespace std; -framecnt_t AudioPort::_port_offset = 0; - AudioPort::AudioPort (const std::string& name, Flags flags) : Port (name, DataType::AUDIO, flags) , _buffer (new AudioBuffer (0)) @@ -44,22 +45,7 @@ AudioPort::cycle_start (pframes_t nframes) { /* caller must hold process lock */ - /* get_buffer() must only be run on outputs here in cycle_start(). - - Inputs must be done in the correct processing order, which - requires interleaving with route processing. that will - happen when Port::get_buffer() is called. - */ - if (sends_output()) { - - /* Notice that cycle_start() is always run with the *entire* process cycle frame count, - so we do not bother to apply _port_offset here - we always want the address of the - entire JACK port buffer. We are not collecting data here - just noting the - address where we will write data later in the process cycle. - */ - - _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes), nframes); _buffer->prepare (); } } @@ -67,7 +53,7 @@ AudioPort::cycle_start (pframes_t nframes) void AudioPort::cycle_end (pframes_t nframes) { - if (sends_output() && !_buffer->written()) { + if (sends_output() && !_buffer->written()) { _buffer->silence (nframes); } } @@ -78,24 +64,10 @@ AudioPort::cycle_split () } AudioBuffer& -AudioPort::get_audio_buffer (framecnt_t nframes, framecnt_t offset) +AudioPort::get_audio_buffer (framecnt_t nframes) { /* caller must hold process lock */ - - if (receives_input ()) { - - /* Get a pointer to the audio data @ offset + _port_offset within the JACK port buffer and store - it in our _buffer member. - - Note that offset is expected to be zero in almost all cases. - */ - - _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes) + offset + _port_offset, nframes); - } - - /* output ports set their _buffer data information during ::cycle_start() - */ - + _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes) + _port_offset, nframes); return *_buffer; } |