summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_port.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-10 21:20:59 +0000
committerDavid Robillard <d@drobilla.net>2008-01-10 21:20:59 +0000
commitbb457bb960c5bd7ed538f9d31477293415739f68 (patch)
tree84324a63b87c03589cd165b9e474296eaebb4772 /libs/ardour/midi_port.cc
parent73dd9d37e7d715e0d78c0e51569968f9494dac7f (diff)
Merge libs/ardour and gtk2_ardour with 2.0-ongoing R2837.
git-svn-id: svn://localhost/ardour2/trunk@2883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_port.cc')
-rw-r--r--libs/ardour/midi_port.cc33
1 files changed, 12 insertions, 21 deletions
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index 7590c42e0b..3e8dea4f62 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -26,23 +26,23 @@
using namespace ARDOUR;
using namespace std;
-MidiPort::MidiPort (const std::string& name, Flags flags, bool external, nframes_t bufsize)
+MidiPort::MidiPort (const std::string& name, Flags flags, bool external, nframes_t capacity)
: Port (name, flags)
, BaseMidiPort (name, flags)
, PortFacade (name, flags)
{
- set_name (name);
-
- _buffer = new MidiBuffer (bufsize);
+ _buffer = new MidiBuffer (capacity);
- cout << "MIDI port " << name << " external: " << external << endl;
-
- if (!external) {
- _ext_port = 0;
- } else {
+ if (external) {
+ /* external ports use the same buffer for the jack port (_ext_port)
+ * and internal ports (this) */
_ext_port = new JackMidiPort (name, flags, _buffer);
+ } else {
+ /* internal ports just have a single buffer, no jack port */
+ _ext_port = 0;
}
+ set_name (name);
reset ();
}
@@ -70,7 +70,6 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
/* caller must hold process lock */
if (_ext_port) {
- // cout << "external\n";
_ext_port->cycle_start (nframes, offset);
}
@@ -78,11 +77,9 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
if (_ext_port) {
- // cout << "external in\n";
-
- _buffer->read_from (dynamic_cast<BaseMidiPort*>(_ext_port)->get_midi_buffer(), nframes, offset);
-
- // cout << "read " << _buffer->size() << " events." << endl;
+ BaseMidiPort* mprt = dynamic_cast<BaseMidiPort*>(_ext_port);
+ assert(mprt);
+ assert(&mprt->get_midi_buffer() == _buffer);
if (!_connections.empty()) {
(*_mixdown) (_connections, _buffer, nframes, offset, false);
@@ -90,8 +87,6 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
} else {
- // cout << "internal in\n";
-
if (_connections.empty()) {
_buffer->silence (nframes, offset);
} else {
@@ -101,10 +96,6 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
} else {
- // cout << "out\n";
-
_buffer->silence (nframes, offset);
}
-
- // cout << endl;
}