summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_port.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/audio_port.cc')
-rw-r--r--libs/ardour/audio_port.cc15
1 files changed, 11 insertions, 4 deletions
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());
}