X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Faudio_port.cc;h=e2bb20dbe958c20753422e202e0d74cf8a911fa8;hb=55bd8ff4d8b64d0780f7184636f41b9f2d2e2707;hp=e01f4a89e6b58ef2a88ba22d959ac7442ff4d590;hpb=d155f32039570e9e0cde11b42e395ca2bcc89ffd;p=ardour.git diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index e01f4a89e6..e2bb20dbe9 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -20,15 +20,18 @@ #include "pbd/stacktrace.h" -#include "ardour/audio_port.h" +#include "ardour/audio_buffer.h" #include "ardour/audioengine.h" +#include "ardour/audio_port.h" #include "ardour/data_type.h" -#include "ardour/audio_buffer.h" +#include "ardour/port_engine.h" using namespace ARDOUR; using namespace std; -AudioPort::AudioPort (const std::string& name, Flags flags) +#define port_engine AudioEngine::instance()->port_engine() + +AudioPort::AudioPort (const std::string& name, PortFlags flags) : Port (name, DataType::AUDIO, flags) , _buffer (new AudioBuffer (0)) { @@ -56,10 +59,9 @@ void AudioPort::cycle_end (pframes_t nframes) { if (sends_output() && !_buffer->written()) { - /* we can't use nframes here because the current buffer capacity may - be shorter than the full buffer size if we split the cycle. - */ - _buffer->silence (_buffer->capacity()); + if (_buffer->capacity() >= nframes) { + _buffer->silence (nframes); + } } } @@ -72,14 +74,18 @@ AudioBuffer& AudioPort::get_audio_buffer (pframes_t nframes) { /* caller must hold process lock */ - _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, _cycle_nframes) + - _global_port_buffer_offset + _port_buffer_offset, nframes); + _buffer->set_data ((Sample *) port_engine.get_buffer (_port_handle, _cycle_nframes) + + _global_port_buffer_offset + _port_buffer_offset, nframes); return *_buffer; } -size_t -AudioPort::raw_buffer_size (pframes_t nframes) const +Sample* +AudioPort::engine_get_whole_audio_buffer () { - return nframes * sizeof (Sample); + /* caller must hold process lock */ + return (Sample *) port_engine.get_buffer (_port_handle, _cycle_nframes); } + + +