mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
Remove unused per-port buffer offset
This commit is contained in:
parent
4f03b7c101
commit
db674ac8b6
8 changed files with 12 additions and 48 deletions
|
|
@ -93,7 +93,6 @@ public:
|
||||||
std::string pretty_name () const { return _pretty_name_prefix; }
|
std::string pretty_name () const { return _pretty_name_prefix; }
|
||||||
|
|
||||||
virtual void silence (samplecnt_t);
|
virtual void silence (samplecnt_t);
|
||||||
void increment_port_buffer_offset (pframes_t offset);
|
|
||||||
|
|
||||||
int ensure_io (ChanCount cnt, bool clear, void *src);
|
int ensure_io (ChanCount cnt, bool clear, void *src);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,6 @@ class LIBARDOUR_API IOProcessor : public Processor
|
||||||
void silence (samplecnt_t nframes, samplepos_t start_sample);
|
void silence (samplecnt_t nframes, samplepos_t start_sample);
|
||||||
void disconnect ();
|
void disconnect ();
|
||||||
|
|
||||||
void increment_port_buffer_offset (pframes_t);
|
|
||||||
|
|
||||||
virtual bool feeds (boost::shared_ptr<Route> other) const;
|
virtual bool feeds (boost::shared_ptr<Route> other) const;
|
||||||
|
|
||||||
PBD::Signal2<void,IOProcessor*,bool> AutomationPlaybackChanged;
|
PBD::Signal2<void,IOProcessor*,bool> AutomationPlaybackChanged;
|
||||||
|
|
|
||||||
|
|
@ -139,8 +139,6 @@ public:
|
||||||
_global_port_buffer_offset += n;
|
_global_port_buffer_offset += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void increment_port_buffer_offset (pframes_t n);
|
|
||||||
|
|
||||||
virtual XMLNode& get_state (void) const;
|
virtual XMLNode& get_state (void) const;
|
||||||
virtual int set_state (const XMLNode&, int version);
|
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 _cycle_nframes; /* access only from process() tree */
|
||||||
|
|
||||||
static pframes_t _global_port_buffer_offset; /* 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_playback_latency;
|
||||||
LatencyRange _private_capture_latency;
|
LatencyRange _private_capture_latency;
|
||||||
|
|
|
||||||
|
|
@ -133,9 +133,9 @@ AudioPort::get_audio_buffer (pframes_t nframes)
|
||||||
assert (_port_handle);
|
assert (_port_handle);
|
||||||
if (!externally_connected ()) {
|
if (!externally_connected ()) {
|
||||||
_buffer->set_data ((Sample *) port_engine.get_buffer (_port_handle, _cycle_nframes) +
|
_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 {
|
} else {
|
||||||
_buffer->set_data (&_data[_global_port_buffer_offset + _port_buffer_offset], nframes);
|
_buffer->set_data (&_data[_global_port_buffer_offset], nframes);
|
||||||
}
|
}
|
||||||
return *_buffer;
|
return *_buffer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
void
|
||||||
IO::silence (samplecnt_t nframes)
|
IO::silence (samplecnt_t nframes)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
ChanCount
|
||||||
IOProcessor::natural_output_streams() const
|
IOProcessor::natural_output_streams() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -141,17 +141,16 @@ MidiPort::get_midi_buffer (pframes_t nframes)
|
||||||
timestamp = floor (timestamp * _speed_ratio);
|
timestamp = floor (timestamp * _speed_ratio);
|
||||||
|
|
||||||
/* check that the event is in the acceptable time range */
|
/* check that the event is in the acceptable time range */
|
||||||
if ((timestamp < (_global_port_buffer_offset + _port_buffer_offset)) ||
|
if ((timestamp < (_global_port_buffer_offset)) ||
|
||||||
(timestamp >= (_global_port_buffer_offset + _port_buffer_offset + nframes))) {
|
(timestamp >= (_global_port_buffer_offset + nframes))) {
|
||||||
// XXX this is normal after a split cycles:
|
// XXX this is normal after a split cycles:
|
||||||
// The engine buffer contains the data for the complete cycle, but
|
// The engine buffer contains the data for the complete cycle, but
|
||||||
// only the part after _global_port_buffer_offset is needed.
|
// only the part after _global_port_buffer_offset is needed.
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cerr << "Dropping incoming MIDI at time " << timestamp << "; offset="
|
cerr << "Dropping incoming MIDI at time " << timestamp << "; offset="
|
||||||
<< _global_port_buffer_offset << " limit="
|
<< _global_port_buffer_offset << " limit="
|
||||||
<< (_global_port_buffer_offset + _port_buffer_offset + nframes)
|
<< (_global_port_buffer_offset + nframes)
|
||||||
<< " = (" << _global_port_buffer_offset
|
<< " = (" << _global_port_buffer_offset
|
||||||
<< " + " << _port_buffer_offset
|
|
||||||
<< " + " << nframes
|
<< " + " << nframes
|
||||||
<< ")\n";
|
<< ")\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -159,7 +158,7 @@ MidiPort::get_midi_buffer (pframes_t nframes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust timestamp to match current cycle */
|
/* adjust timestamp to match current cycle */
|
||||||
timestamp -= _global_port_buffer_offset + _port_buffer_offset;
|
timestamp -= _global_port_buffer_offset;
|
||||||
assert (timestamp >= 0 && timestamp < nframes);
|
assert (timestamp >= 0 && timestamp < nframes);
|
||||||
|
|
||||||
if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) {
|
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 Session* s = AudioEngine::instance()->session();
|
||||||
const samplepos_t now = (s ? s->transport_sample() : 0);
|
const samplepos_t now = (s ? s->transport_sample() : 0);
|
||||||
DEBUG_STR_DECL(a);
|
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(),
|
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, _port_buffer_offset, name()));
|
now + ev.time(), nframes, _global_port_buffer_offset, name()));
|
||||||
for (size_t i=0; i < ev.size(); ++i) {
|
for (size_t i=0; i < ev.size(); ++i) {
|
||||||
DEBUG_STR_APPEND(a,hex);
|
DEBUG_STR_APPEND(a,hex);
|
||||||
DEBUG_STR_APPEND(a,"0x");
|
DEBUG_STR_APPEND(a,"0x");
|
||||||
|
|
@ -291,16 +290,15 @@ MidiPort::flush_buffers (pframes_t nframes)
|
||||||
assert (ev.time() < (nframes + _global_port_buffer_offset));
|
assert (ev.time() < (nframes + _global_port_buffer_offset));
|
||||||
|
|
||||||
if (ev.time() >= _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) {
|
if (port_engine.midi_event_put (port_buffer, tme, ev.buffer(), ev.size()) != 0) {
|
||||||
cerr << "write failed, dropped event, time "
|
cerr << "write failed, dropped event, time "
|
||||||
<< ev.time() << " + " << _port_buffer_offset
|
<< ev.time()
|
||||||
<< " > " << _global_port_buffer_offset << endl;
|
<< " > " << _global_port_buffer_offset << endl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cerr << "drop flushed event on the floor, time " << ev.time()
|
cerr << "drop flushed event on the floor, time " << ev.time()
|
||||||
<< " too early for " << _global_port_buffer_offset
|
<< " too early for " << _global_port_buffer_offset;
|
||||||
<< " + " << _port_buffer_offset;
|
|
||||||
for (size_t xx = 0; xx < ev.size(); ++xx) {
|
for (size_t xx = 0; xx < ev.size(); ++xx) {
|
||||||
cerr << ' ' << hex << (int) ev.buffer()[xx];
|
cerr << ' ' << hex << (int) ev.buffer()[xx];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,7 @@ const uint32_t Port::_resampler_quality = 12;
|
||||||
|
|
||||||
/** @param n Port short name */
|
/** @param n Port short name */
|
||||||
Port::Port (std::string const & n, DataType t, PortFlags f)
|
Port::Port (std::string const & n, DataType t, PortFlags f)
|
||||||
: _port_buffer_offset (0)
|
: _name (n)
|
||||||
, _name (n)
|
|
||||||
, _flags (f)
|
, _flags (f)
|
||||||
, _last_monitor (false)
|
, _last_monitor (false)
|
||||||
{
|
{
|
||||||
|
|
@ -342,13 +341,6 @@ Port::reset ()
|
||||||
void
|
void
|
||||||
Port::cycle_start (pframes_t)
|
Port::cycle_start (pframes_t)
|
||||||
{
|
{
|
||||||
_port_buffer_offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Port::increment_port_buffer_offset (pframes_t nframes)
|
|
||||||
{
|
|
||||||
_port_buffer_offset += nframes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue