X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Faudio_port.cc;h=1a6c30dcf25b5e6b07c66a27257603d59ad1d76c;hb=244098cb400da1666147363d6959eeee3f6595bf;hp=44e0298f1d7325a59eabd05b91bc23d825a0a879;hpb=ea64e46594c834f0d1aa583eb087f4c9da1c72c2;p=ardour.git diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index 44e0298f1d..1a6c30dcf2 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -30,6 +30,7 @@ using namespace ARDOUR; using namespace std; +#define ENGINE AudioEngine::instance() #define port_engine AudioEngine::instance()->port_engine() AudioPort::AudioPort (const std::string& name, PortFlags flags) @@ -121,12 +122,18 @@ AudioPort::get_audio_buffer (pframes_t nframes) { /* caller must hold process lock */ assert (_port_handle); + + Sample* addr; + if (!externally_connected ()) { - _buffer->set_data ((Sample *) port_engine.get_buffer (_port_handle, _cycle_nframes) + - _global_port_buffer_offset, nframes); + addr = (Sample *) port_engine.get_buffer (_port_handle, nframes); } else { - _buffer->set_data (&_data[_global_port_buffer_offset], nframes); + /* _data was read and resampled as necessary in ::cycle_start */ + addr = &_data[_global_port_buffer_offset]; } + + _buffer->set_data (addr, nframes); + return *_buffer; } @@ -135,5 +142,5 @@ AudioPort::engine_get_whole_audio_buffer () { /* caller must hold process lock */ assert (_port_handle); - return (Sample *) port_engine.get_buffer (_port_handle, _cycle_nframes); + return (Sample *) port_engine.get_buffer (_port_handle, ENGINE->samples_per_cycle()); }