diff options
author | Robin Gareus <robin@gareus.org> | 2016-10-23 22:25:40 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-10-23 22:25:40 +0200 |
commit | 57d1f68cd6ef3b55fd43462b92dbed91b7c250ac (patch) | |
tree | e1168cc7b4bc0532728b2fa3b9b5504e7151b2aa /libs/ardour/async_midi_port.cc | |
parent | 7e861bd12e345073c8e86bf08bbc0f103be323c7 (diff) |
Introduce "virtual" async MIDI ports
This allows to flush an async MIDI port's ringbuffer at cycle-start,
to makes its data available as "input/source" during process(), while
collecting data in the background for the next cycle.
This facilitates virtual MIDI Ports for eg. Control Surface Pads:
output from a surface, input to Ardour channels.
Diffstat (limited to 'libs/ardour/async_midi_port.cc')
-rw-r--r-- | libs/ardour/async_midi_port.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/ardour/async_midi_port.cc b/libs/ardour/async_midi_port.cc index eee585fd96..388aaf1935 100644 --- a/libs/ardour/async_midi_port.cc +++ b/libs/ardour/async_midi_port.cc @@ -46,6 +46,7 @@ AsyncMIDIPort::AsyncMIDIPort (string const & name, PortFlags flags) , MIDI::Port (name, MIDI::Port::Flags (0)) , _currently_in_cycle (false) , _last_write_timestamp (0) + , _flush_at_cycle_start (false) , have_timer (false) , output_fifo (2048) , input_fifo (1024) @@ -119,6 +120,9 @@ AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes) if (ARDOUR::Port::sends_output()) { flush_output_fifo (nframes); + if (_flush_at_cycle_start) { + flush_buffers (nframes); + } } /* copy incoming data from the port buffer into the input FIFO @@ -152,7 +156,7 @@ AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes) void AsyncMIDIPort::cycle_end (MIDI::pframes_t nframes) { - if (ARDOUR::Port::sends_output()) { + if (ARDOUR::Port::sends_output() && !_flush_at_cycle_start) { /* move any additional data from output FIFO into the port buffer. */ |