summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_port.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-14 17:35:33 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-14 17:35:33 +0000
commit07be98b3410ac70b3c4451592fb88def678611ef (patch)
treea4fafdad0a4e67f9f49d4b5b21193bf37d8b2504 /libs/ardour/midi_port.cc
parentbb9cc45cd22af67ac275a5e73accbe14fee664d8 (diff)
(1) silence non-process FIFO message (2) move MIDI state tracking down to the MidiPort level (3) forward port the PRIVATE_JACK pointer "fix" from 2.X
git-svn-id: svn://localhost/ardour2/branches/3.0@5774 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_port.cc')
-rw-r--r--libs/ardour/midi_port.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index 880c1b5474..8dddc39fe3 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -28,6 +28,7 @@ using namespace std;
MidiPort::MidiPort (const std::string& name, Flags flags)
: Port (name, DataType::MIDI, flags)
, _has_been_mixed_down (false)
+ , _resolve_in_process (false)
{
_buffer = new MidiBuffer (raw_buffer_size(0));
}
@@ -108,12 +109,24 @@ MidiPort::cycle_split ()
}
void
-MidiPort::flush_buffers (nframes_t nframes, nframes_t offset)
+MidiPort::flush_buffers (nframes_t nframes, nframes64_t time, nframes_t offset)
{
if (sends_output ()) {
void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
+ // Feed the data through the MidiStateTracker
+ bool did_loop;
+
+ _midi_state_tracker.track (_buffer->begin(), _buffer->end(), did_loop);
+
+ if (did_loop || _resolve_in_process) {
+ /* add necessary note offs */
+ _midi_state_tracker.resolve_notes (*_buffer, time);
+ }
+
+ _resolve_in_process = false;
+
for (MidiBuffer::iterator i = _buffer->begin(); i != _buffer->end(); ++i) {
const Evoral::Event<nframes_t>& ev = *i;
@@ -130,6 +143,12 @@ MidiPort::flush_buffers (nframes_t nframes, nframes_t offset)
}
}
+void
+MidiPort::transport_stopped ()
+{
+ _resolve_in_process = true;
+}
+
size_t
MidiPort::raw_buffer_size (nframes_t nframes) const
{