13
0

Use AsyncMIDIPort API

This commit is contained in:
Robin Gareus 2019-10-18 15:17:54 +02:00
parent eade673771
commit f0d2327af0
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 8 additions and 10 deletions

View File

@ -26,6 +26,7 @@
#include "midi++/mmc.h"
#include "ardour/async_midi_port.h"
#include "ardour/audioengine.h"
#include "ardour/auditioner.h"
#include "ardour/bundle.h"
@ -490,15 +491,12 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
}
/* virtual keyboard */
if ((type == DataType::MIDI || type == DataType::NIL)) {
if (!inputs && (type == DataType::MIDI || type == DataType::NIL)) {
boost::shared_ptr<ARDOUR::Port> ap = boost::dynamic_pointer_cast<ARDOUR::Port> (session->vkbd_output_port());
AudioEngine* ae = AudioEngine::instance();
if (!inputs) {
boost::shared_ptr<Bundle> vm (new Bundle (_("Virtual MIDI"), inputs));
vm->add_channel (
_("Virtual Keyboard"), DataType::MIDI, ae->make_port_name_non_relative (session->vkbd_output_port()->name())
);
program->add_bundle (vm);
}
boost::shared_ptr<Bundle> vm (new Bundle (_("Virtual MIDI"), inputs));
vm->add_channel (_("Virtual Keyboard"), DataType::MIDI, ae->make_port_name_non_relative (ap->name()));
program->add_bundle (vm);
}
/* our sync ports */

View File

@ -92,7 +92,7 @@ VirtualKeyboardWindow::note_on_event_handler (int note)
ev[0] = (MIDI_CMD_NOTE_ON | channel);
ev[1] = note;
ev[2] = _piano_velocity.get_value_as_int ();
boost::dynamic_pointer_cast<ARDOUR::AsyncMIDIPort>(_session->vkbd_output_port())->write (ev, 3, 0);
_session->vkbd_output_port()->write (ev, 3, 0);
}
void
@ -107,5 +107,5 @@ VirtualKeyboardWindow::note_off_event_handler (int note)
ev[0] = (MIDI_CMD_NOTE_OFF | channel);
ev[1] = note;
ev[2] = 0;
boost::dynamic_pointer_cast<ARDOUR::AsyncMIDIPort>(_session->vkbd_output_port())->write (ev, 3, 0);
_session->vkbd_output_port()->write (ev, 3, 0);
}