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;
private:
AudioBuffer* _buffer;
+ static nframes_t _port_offset;
};
} // namespace ARDOUR
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;
}
return _connecting_blocked;
}
-
/** @return Port short name */
std::string name () const {
return _name;
jack_port_t* _jack_port; ///< JACK port
- static nframes_t _port_offset;
static nframes_t _buffer_size;
static bool _connecting_blocked;
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))
{
/* 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 */
/* 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 */
into our MidiBuffer
*/
- nframes_t off = offset + _port_offset;
-
for (nframes_t i = 0; i < event_count; ++i) {
jack_midi_event_t ev;
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";
}
}
// 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;
}
}
}
using namespace ARDOUR;
AudioEngine* Port::_engine = 0;
-nframes_t Port::_port_offset = 0;
nframes_t Port::_buffer_size = 0;
bool Port::_connecting_blocked = false;
#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"
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) {