summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_port.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-02-11 00:58:24 +0000
committerCarl Hetherington <carl@carlh.net>2009-02-11 00:58:24 +0000
commitd469cc3e3a536fceedbfc41e52ad3d7d178f7b0d (patch)
tree5cee0af05edc00f5b19116727b1aebfd3bc52719 /libs/ardour/midi_port.cc
parentfe4e98a72987f197239a025413bfddb4c29b8ba8 (diff)
Remove internal ports.
git-svn-id: svn://localhost/ardour2/branches/3.0@4525 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_port.cc')
-rw-r--r--libs/ardour/midi_port.cc88
1 files changed, 27 insertions, 61 deletions
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index ead5f5aeac..5695179863 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -25,13 +25,13 @@
using namespace ARDOUR;
using namespace std;
-MidiPort::MidiPort (const std::string& name, Flags flags, bool ext, nframes_t capacity)
- : Port (name, DataType::MIDI, flags, ext)
+MidiPort::MidiPort (const std::string& name, Flags flags)
+ : Port (name, DataType::MIDI, flags)
, _has_been_mixed_down (false)
{
// FIXME: size kludge (see BufferSet::ensure_buffers)
// Jack needs to tell us this
- _buffer = new MidiBuffer (capacity * 32);
+ _buffer = new MidiBuffer (1024 * 32);
}
MidiPort::~MidiPort()
@@ -43,13 +43,11 @@ MidiPort::~MidiPort()
void
MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
{
- if (external ()) {
- _buffer->clear ();
- assert (_buffer->size () == 0);
-
- if (sends_output ()) {
- jack_midi_clear_buffer (jack_port_get_buffer (_jack_port, nframes));
- }
+ _buffer->clear ();
+ assert (_buffer->size () == 0);
+
+ if (sends_output ()) {
+ jack_midi_clear_buffer (jack_port_get_buffer (_jack_port, nframes));
}
}
@@ -62,41 +60,26 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
if (receives_input ()) {
- if (external ()) {
+ void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
+ const nframes_t event_count = jack_midi_get_event_count(jack_buffer);
- void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
- const nframes_t event_count = jack_midi_get_event_count(jack_buffer);
-
- assert (event_count < _buffer->capacity());
-
- jack_midi_event_t ev;
-
- for (nframes_t i = 0; i < event_count; ++i) {
-
- jack_midi_event_get (&ev, jack_buffer, i);
-
- // i guess this should do but i leave it off to test the rest first.
- //if (ev.time > offset && ev.time < offset+nframes)
- _buffer->push_back (ev);
- }
-
- if (nframes) {
- _has_been_mixed_down = true;
- }
-
- if (!_connections.empty()) {
- mixdown (nframes, offset, false);
- }
-
- } else {
+ assert (event_count < _buffer->capacity());
- if (_connections.empty()) {
- _buffer->silence (nframes, offset);
- } else {
- mixdown (nframes, offset, true);
- }
+ jack_midi_event_t ev;
+
+ for (nframes_t i = 0; i < event_count; ++i) {
+
+ jack_midi_event_get (&ev, jack_buffer, i);
+
+ // i guess this should do but i leave it off to test the rest first.
+ //if (ev.time > offset && ev.time < offset+nframes)
+ _buffer->push_back (ev);
}
-
+
+ if (nframes) {
+ _has_been_mixed_down = true;
+ }
+
} else {
_buffer->silence (nframes, offset);
}
@@ -114,7 +97,7 @@ MidiPort::cycle_end (nframes_t nframes, nframes_t offset)
{
#if 0
- if (external () && sends_output ()) {
+ if (sends_output ()) {
/* FIXME: offset */
// We're an output - copy events from source buffer to Jack buffer
@@ -142,7 +125,7 @@ MidiPort::flush_buffers (nframes_t nframes, nframes_t offset)
{
/* FIXME: offset */
- if (external () && sends_output ()) {
+ if (sends_output ()) {
void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
@@ -158,20 +141,3 @@ MidiPort::flush_buffers (nframes_t nframes, nframes_t offset)
}
}
-void
-MidiPort::mixdown (nframes_t cnt, nframes_t offset, bool first_overwrite)
-{
- set<Port*>::const_iterator p = _connections.begin();
-
- if (first_overwrite) {
- _buffer->read_from ((dynamic_cast<MidiPort*>(*p))->get_midi_buffer (cnt, offset), cnt, offset);
- ++p;
- }
-
- // XXX DAVE: this is just a guess
-
- for (; p != _connections.end(); ++p) {
- _buffer->merge (*_buffer, (dynamic_cast<MidiPort*>(*p))->get_midi_buffer (cnt, offset));
- }
-}
-