13
0

expose AsyncMIDIPort::shadow_port()

This commit is contained in:
Paul Davis 2016-06-20 13:47:17 -04:00
parent 0c1c7ec642
commit 3669096c05
2 changed files with 8 additions and 8 deletions

View File

@ -76,6 +76,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
typedef boost::function<bool(MidiBuffer&,MidiBuffer&)> MidiFilter;
void set_inbound_filter (MidiFilter);
int add_shadow_port (std::string const &, MidiFilter);
boost::shared_ptr<MidiPort> shadow_port() const { return _shadow_port; }
static void set_process_thread (pthread_t);
static pthread_t get_process_thread () { return _process_thread; }
@ -106,7 +107,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
MidiFilter inbound_midi_filter;
boost::shared_ptr<MidiPort> shadow_port;
boost::shared_ptr<MidiPort> _shadow_port;
MidiFilter shadow_midi_filter;
static pthread_t _process_thread;

View File

@ -150,10 +150,9 @@ AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes)
inbound_midi_filter (mb, mb);
}
if (shadow_port) {
MidiBuffer& shadow_buffer (shadow_port->get_midi_buffer (nframes));
if (shadow_midi_filter (mb, shadow_buffer)) {
shadow_port->flush_buffers (nframes);
if (_shadow_port) {
if (shadow_midi_filter (mb, _shadow_port->get_midi_buffer (nframes))) {
_shadow_port->flush_buffers (nframes);
}
}
}
@ -359,7 +358,7 @@ AsyncMIDIPort::add_shadow_port (string const & name, MidiFilter mf)
return -1;
}
if (shadow_port) {
if (_shadow_port) {
return -2;
}
@ -367,7 +366,7 @@ AsyncMIDIPort::add_shadow_port (string const & name, MidiFilter mf)
/* shadow port is not async. */
if (!(shadow_port = boost::dynamic_pointer_cast<MidiPort> (AudioEngine::instance()->register_output_port (DataType::MIDI, name, false, PortFlags (Shadow|IsTerminal))))) {
if (!(_shadow_port = boost::dynamic_pointer_cast<MidiPort> (AudioEngine::instance()->register_output_port (DataType::MIDI, name, false, PortFlags (Shadow|IsTerminal))))) {
return -3;
}
@ -377,7 +376,7 @@ AsyncMIDIPort::add_shadow_port (string const & name, MidiFilter mf)
*/
LatencyRange latency = private_latency_range (false);
shadow_port->set_private_latency_range (latency, false);
_shadow_port->set_private_latency_range (latency, false);
return 0;
}