Remove unused per-port buffer offset

This commit is contained in:
Robin Gareus 2017-10-29 18:44:06 +01:00
parent 4f03b7c101
commit db674ac8b6
8 changed files with 12 additions and 48 deletions

View File

@ -93,7 +93,6 @@ public:
std::string pretty_name () const { return _pretty_name_prefix; }
virtual void silence (samplecnt_t);
void increment_port_buffer_offset (pframes_t offset);
int ensure_io (ChanCount cnt, bool clear, void *src);

View File

@ -67,8 +67,6 @@ class LIBARDOUR_API IOProcessor : public Processor
void silence (samplecnt_t nframes, samplepos_t start_sample);
void disconnect ();
void increment_port_buffer_offset (pframes_t);
virtual bool feeds (boost::shared_ptr<Route> other) const;
PBD::Signal2<void,IOProcessor*,bool> AutomationPlaybackChanged;

View File

@ -139,8 +139,6 @@ public:
_global_port_buffer_offset += n;
}
virtual void increment_port_buffer_offset (pframes_t n);
virtual XMLNode& get_state (void) const;
virtual int set_state (const XMLNode&, int version);
@ -158,7 +156,6 @@ protected:
static pframes_t _cycle_nframes; /* access only from process() tree */
static pframes_t _global_port_buffer_offset; /* access only from process() tree */
samplecnt_t _port_buffer_offset; /* access only from process() tree */
LatencyRange _private_playback_latency;
LatencyRange _private_capture_latency;

View File

@ -133,9 +133,9 @@ AudioPort::get_audio_buffer (pframes_t nframes)
assert (_port_handle);
if (!externally_connected ()) {
_buffer->set_data ((Sample *) port_engine.get_buffer (_port_handle, _cycle_nframes) +
_global_port_buffer_offset + _port_buffer_offset, nframes);
_global_port_buffer_offset, nframes);
} else {
_buffer->set_data (&_data[_global_port_buffer_offset + _port_buffer_offset], nframes);
_buffer->set_data (&_data[_global_port_buffer_offset], nframes);
}
return *_buffer;
}

View File

@ -130,18 +130,6 @@ IO::disconnect_check (boost::shared_ptr<Port> a, boost::shared_ptr<Port> b)
}
}
void
IO::increment_port_buffer_offset (pframes_t offset)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
if (_direction == Output) {
for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
i->increment_port_buffer_offset (offset);
}
}
}
void
IO::silence (samplecnt_t nframes)
{

View File

@ -230,14 +230,6 @@ IOProcessor::silence (samplecnt_t nframes, samplepos_t /* start_sample */)
}
}
void
IOProcessor::increment_port_buffer_offset (pframes_t offset)
{
if (_own_output && _output) {
_output->increment_port_buffer_offset (offset);
}
}
ChanCount
IOProcessor::natural_output_streams() const
{

View File

@ -141,17 +141,16 @@ MidiPort::get_midi_buffer (pframes_t nframes)
timestamp = floor (timestamp * _speed_ratio);
/* check that the event is in the acceptable time range */
if ((timestamp < (_global_port_buffer_offset + _port_buffer_offset)) ||
(timestamp >= (_global_port_buffer_offset + _port_buffer_offset + nframes))) {
if ((timestamp < (_global_port_buffer_offset)) ||
(timestamp >= (_global_port_buffer_offset + nframes))) {
// XXX this is normal after a split cycles:
// The engine buffer contains the data for the complete cycle, but
// only the part after _global_port_buffer_offset is needed.
#ifndef NDEBUG
cerr << "Dropping incoming MIDI at time " << timestamp << "; offset="
<< _global_port_buffer_offset << " limit="
<< (_global_port_buffer_offset + _port_buffer_offset + nframes)
<< (_global_port_buffer_offset + nframes)
<< " = (" << _global_port_buffer_offset
<< " + " << _port_buffer_offset
<< " + " << nframes
<< ")\n";
#endif
@ -159,7 +158,7 @@ MidiPort::get_midi_buffer (pframes_t nframes)
}
/* adjust timestamp to match current cycle */
timestamp -= _global_port_buffer_offset + _port_buffer_offset;
timestamp -= _global_port_buffer_offset;
assert (timestamp >= 0 && timestamp < nframes);
if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) {
@ -275,8 +274,8 @@ MidiPort::flush_buffers (pframes_t nframes)
const Session* s = AudioEngine::instance()->session();
const samplepos_t now = (s ? s->transport_sample() : 0);
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("MidiPort %8 %1 pop event @ %2 (global %4, within %5 gpbo %6 pbo %7 sz %3 ", _buffer, ev.time(), ev.size(),
now + ev.time(), nframes, _global_port_buffer_offset, _port_buffer_offset, name()));
DEBUG_STR_APPEND(a, string_compose ("MidiPort %7 %1 pop event @ %2 (global %4, within %5 gpbo %6 sz %3 ", _buffer, ev.time(), ev.size(),
now + ev.time(), nframes, _global_port_buffer_offset, name()));
for (size_t i=0; i < ev.size(); ++i) {
DEBUG_STR_APPEND(a,hex);
DEBUG_STR_APPEND(a,"0x");
@ -291,16 +290,15 @@ MidiPort::flush_buffers (pframes_t nframes)
assert (ev.time() < (nframes + _global_port_buffer_offset));
if (ev.time() >= _global_port_buffer_offset) {
pframes_t tme = floor ((ev.time() + _port_buffer_offset) / _speed_ratio);
pframes_t tme = floor (ev.time() / _speed_ratio);
if (port_engine.midi_event_put (port_buffer, tme, ev.buffer(), ev.size()) != 0) {
cerr << "write failed, dropped event, time "
<< ev.time() << " + " << _port_buffer_offset
<< ev.time()
<< " > " << _global_port_buffer_offset << endl;
}
} else {
cerr << "drop flushed event on the floor, time " << ev.time()
<< " too early for " << _global_port_buffer_offset
<< " + " << _port_buffer_offset;
<< " too early for " << _global_port_buffer_offset;
for (size_t xx = 0; xx < ev.size(); ++xx) {
cerr << ' ' << hex << (int) ev.buffer()[xx];
}

View File

@ -55,8 +55,7 @@ const uint32_t Port::_resampler_quality = 12;
/** @param n Port short name */
Port::Port (std::string const & n, DataType t, PortFlags f)
: _port_buffer_offset (0)
, _name (n)
: _name (n)
, _flags (f)
, _last_monitor (false)
{
@ -342,13 +341,6 @@ Port::reset ()
void
Port::cycle_start (pframes_t)
{
_port_buffer_offset = 0;
}
void
Port::increment_port_buffer_offset (pframes_t nframes)
{
_port_buffer_offset += nframes;
}
void