Remove unused per-port buffer offset
authorRobin Gareus <robin@gareus.org>
Sun, 29 Oct 2017 17:44:06 +0000 (18:44 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 29 Oct 2017 19:04:11 +0000 (20:04 +0100)
libs/ardour/ardour/io.h
libs/ardour/ardour/io_processor.h
libs/ardour/ardour/port.h
libs/ardour/audio_port.cc
libs/ardour/io.cc
libs/ardour/io_processor.cc
libs/ardour/midi_port.cc
libs/ardour/port.cc

index 48f3653c2b9e002320a1e10ac51b93c46efa42b8..1b85fa78baaa25221db087a120ed41637b067009 100644 (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);
 
index 7dcbb630ab56f63e2ce38b5ef946856e484d55d0..c59addffb2bdbba6d038264f738ded5b838d2f14 100644 (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;
index 18d56dd8df3ffcd1c0c2366d56e418f1b1ff1796..7284f2d9aaaab3f40eaf26123352981621c57b86 100644 (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;
index a9d41afce268bda665cadae55325a0b5d5b21cfc..797c8383ee4cb50432039382952390c0e1fe7003 100644 (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;
 }
index 3628ec9b48ff92be87bcb2f08d82a36d6aa1c534..7eb85477d705a122f814afabfe5dd6ac0af21103 100644 (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)
 {
index a7e13fecb411395b8dc6d99e5c9e817bacb4b3b7..9a162e3f8bc6f6b7121b76f50530f5ba48bd817e 100644 (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
 {
index 24dc9945354197f1908126942dc0e13304f22f2d..1aaa25ad7028a205b714222aec0e7a59c497215a 100644 (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];
                                }
index 3ae3063b299265f5563878a922e6bdea278a4696..ec67e9c0af76e866eedb3ecdaf51de6dd57d2ba9 100644 (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