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)
_src.set_rratio (_cycle_nframes / (double)nframes);
_src.out_data = _data;
_src.process ();
-#ifndef NDEBUG
- if (_src.inp_count != 0 || _src.out_count != 0) {
- printf ("AudioPort::cycle_start x-flow: %d/%d\n", _src.inp_count, _src.out_count);
- }
-#endif
while (_src.out_count > 0) {
*_src.out_data = _src.out_data[-1];
++_src.out_data;
_src.inp_data = _data;
_src.out_data = (float*)port_engine.get_buffer (_port_handle, nframes);
_src.process ();
-#ifndef NDEBUG
- if (_src.inp_count != 0 || _src.out_count != 0) {
- printf ("AudioPort::cycle_end x-flow: %d/%d\n", _src.inp_count, _src.out_count);
- }
-#endif
while (_src.out_count > 0) {
*_src.out_data = _src.out_data[-1];
++_src.out_data;
{
/* 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;
}
{
/* 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());
}