summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-13 02:13:12 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-13 02:13:12 +0000
commit3364fda3decc12360bd15faa9210ede0a47ba1fc (patch)
tree5ef20f031dfa7352a08ac0599a13ec1ad3ce2c87 /libs
parent8502e50377c4e19ebb0f2d070cb5b415dc695901 (diff)
Move _port_offset up to AudioPort, as MidiPort does not use it.
git-svn-id: svn://localhost/ardour2/branches/3.0@7614 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/audio_port.h11
-rw-r--r--libs/ardour/ardour/port.h10
-rw-r--r--libs/ardour/audio_port.cc2
-rw-r--r--libs/ardour/audioengine.cc4
-rw-r--r--libs/ardour/midi_port.cc18
-rw-r--r--libs/ardour/port.cc1
-rw-r--r--libs/ardour/session_process.cc4
7 files changed, 23 insertions, 27 deletions
diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h
index 0c08795819..895cae99a6 100644
--- a/libs/ardour/ardour/audio_port.h
+++ b/libs/ardour/ardour/audio_port.h
@@ -47,6 +47,16 @@ class AudioPort : public Port
AudioBuffer& get_audio_buffer (nframes_t nframes, nframes_t offset = 0);
+ static nframes_t port_offset() { return _port_offset; }
+
+ static void set_port_offset (nframes_t off) {
+ _port_offset = off;
+ }
+
+ static void increment_port_offset (nframes_t n) {
+ _port_offset += n;
+ }
+
protected:
friend class AudioEngine;
@@ -55,6 +65,7 @@ class AudioPort : public Port
private:
AudioBuffer* _buffer;
+ static nframes_t _port_offset;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index 3a677d293f..8b2b3dcbd3 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -45,14 +45,6 @@ public:
virtual ~Port ();
- static nframes_t port_offset() { return _port_offset; }
-
- static void set_port_offset (nframes_t off) {
- _port_offset = off;
- }
- static void increment_port_offset (nframes_t n) {
- _port_offset += n;
- }
static void set_buffer_size (nframes_t sz) {
_buffer_size = sz;
}
@@ -63,7 +55,6 @@ public:
return _connecting_blocked;
}
-
/** @return Port short name */
std::string name () const {
return _name;
@@ -135,7 +126,6 @@ protected:
jack_port_t* _jack_port; ///< JACK port
- static nframes_t _port_offset;
static nframes_t _buffer_size;
static bool _connecting_blocked;
diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc
index 71ec7c6289..c7e920dfb6 100644
--- a/libs/ardour/audio_port.cc
+++ b/libs/ardour/audio_port.cc
@@ -25,6 +25,8 @@
using namespace ARDOUR;
using namespace std;
+nframes_t AudioPort::_port_offset = 0;
+
AudioPort::AudioPort (const std::string& name, Flags flags)
: Port (name, DataType::AUDIO, flags)
, _buffer (new AudioBuffer (0))
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 3453deea5c..301b3e3ce2 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -401,7 +401,7 @@ AudioEngine::split_cycle (nframes_t offset)
{
/* caller must hold process lock */
- Port::increment_port_offset (offset);
+ AudioPort::increment_port_offset (offset);
/* tell all Ports that we're going to start a new (split) cycle */
@@ -484,7 +484,7 @@ AudioEngine::process_callback (nframes_t nframes)
/* tell all relevant objects that we're starting a new cycle */
Delivery::CycleStart (nframes);
- Port::set_port_offset (0);
+ AudioPort::set_port_offset (0);
InternalReturn::CycleStart (nframes);
/* tell all Ports that we're starting a new cycle */
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index 807fd5ba0d..1e5cecfb10 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -67,8 +67,6 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
into our MidiBuffer
*/
- nframes_t off = offset + _port_offset;
-
for (nframes_t i = 0; i < event_count; ++i) {
jack_midi_event_t ev;
@@ -80,10 +78,10 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
continue;
}
- if (ev.time >= off && ev.time < off+nframes) {
+ if (ev.time > offset && ev.time < (offset + nframes)) {
_buffer->push_back (ev);
} else {
- cerr << "Dropping incoming MIDI at time " << ev.time << "; offset=" << off << " limit=" << (off + nframes) << "\n";
+ cerr << "Dropping incoming MIDI at time " << ev.time << "; offset=" << offset << " limit=" << (offset + nframes) << "\n";
}
}
@@ -139,18 +137,14 @@ MidiPort::flush_buffers (nframes_t nframes, nframes64_t time, nframes_t offset)
// event times are in frames, relative to cycle start
- // XXX split cycle start or cycle start?
-
- assert(ev.time() < (nframes+offset+_port_offset));
+ assert (ev.time() < (nframes + offset));
- if (ev.time() >= offset + _port_offset) {
+ if (ev.time() >= offset) {
if (jack_midi_event_write (jack_buffer, (jack_nframes_t) ev.time(), ev.buffer(), ev.size()) != 0) {
- cerr << "write failed, drop flushed note off on the floor, time " << ev.time() << " > " << offset << " + " << _port_offset
- << endl;
+ cerr << "write failed, drop flushed note off on the floor, time " << ev.time() << " > " << offset << endl;
}
} else {
- cerr << "drop flushed note off on the floor, time " << ev.time() << " > " << offset << " + " << _port_offset
- << endl;
+ cerr << "drop flushed event on the floor, time " << ev.time() << " < " << offset << endl;
}
}
}
diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc
index 8bf08a7dff..efdd297f5e 100644
--- a/libs/ardour/port.cc
+++ b/libs/ardour/port.cc
@@ -34,7 +34,6 @@ using namespace std;
using namespace ARDOUR;
AudioEngine* Port::_engine = 0;
-nframes_t Port::_port_offset = 0;
nframes_t Port::_buffer_size = 0;
bool Port::_connecting_blocked = false;
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 6889e714fd..596f656fbc 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -37,7 +37,7 @@
#include "ardour/slave.h"
#include "ardour/timestamps.h"
#include "ardour/graph.h"
-#include "ardour/port.h"
+#include "ardour/audio_port.h"
#include "midi++/manager.h"
#include "midi++/mmc.h"
@@ -884,7 +884,7 @@ Session::maybe_sync_start (nframes_t& nframes)
no_roll (sync_offset);
nframes -= sync_offset;
- Port::increment_port_offset (sync_offset);
+ AudioPort::increment_port_offset (sync_offset);
waiting_for_sync_offset = false;
if (nframes == 0) {