13
0

Merge branch 'ardour'

This commit is contained in:
Paul Davis 2024-07-01 16:32:31 -06:00
commit 270571a8fd
3 changed files with 21 additions and 5 deletions

View File

@ -27,6 +27,8 @@
#endif #endif
#include <cstdio> #include <cstdio>
#include "evoral/midi_util.h"
#include "ardour/audioengine.h" #include "ardour/audioengine.h"
#include "ardour/debug.h" #include "ardour/debug.h"
#include "ardour/session.h" #include "ardour/session.h"
@ -300,8 +302,14 @@ intptr_t Session::vst_callback (
VstEvents* v = (VstEvents*)ptr; VstEvents* v = (VstEvents*)ptr;
for (int n = 0 ; n < v->numEvents; ++n) { for (int n = 0 ; n < v->numEvents; ++n) {
VstMidiEvent *vme = (VstMidiEvent*) (v->events[n]->dump); VstMidiEvent *vme = (VstMidiEvent*) (v->events[n]->dump);
if (vme->type == kVstMidiType) { int size = Evoral::midi_event_size((uint8_t)vme->midiData[0]);
plug->midi_buffer()->push_back(vme->deltaSamples, Evoral::MIDI_EVENT, 3, (uint8_t*)vme->midiData); if (vme->type == kVstMidiType && size > 0) {
plug->midi_buffer()->push_back(
vme->deltaSamples,
Evoral::MIDI_EVENT,
size,
(uint8_t*)vme->midiData
);
} }
} }
} }

View File

@ -647,36 +647,44 @@ VST3PI::vst3_to_midi_buffers (BufferSet& bufs, ChanMapping const& out_map)
data[2] = vst_to_midi (e.polyPressure.pressure); data[2] = vst_to_midi (e.polyPressure.pressure);
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, 3, data); mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, 3, data);
break; break;
case Vst::Event::kLegacyMIDICCOutEvent: case Vst::Event::kLegacyMIDICCOutEvent: {
size_t size = 0;
switch (e.midiCCOut.controlNumber) { switch (e.midiCCOut.controlNumber) {
case Vst::kCtrlPolyPressure: case Vst::kCtrlPolyPressure:
size = 3;
data[0] = MIDI_CMD_NOTE_PRESSURE | e.midiCCOut.channel; data[0] = MIDI_CMD_NOTE_PRESSURE | e.midiCCOut.channel;
data[1] = e.midiCCOut.value; data[1] = e.midiCCOut.value;
data[2] = e.midiCCOut.value2; data[2] = e.midiCCOut.value2;
break; break;
default: /* Control Change */ default: /* Control Change */
size = 3;
data[0] = MIDI_CMD_CONTROL | e.midiCCOut.channel; data[0] = MIDI_CMD_CONTROL | e.midiCCOut.channel;
data[1] = e.midiCCOut.controlNumber; data[1] = e.midiCCOut.controlNumber;
data[2] = e.midiCCOut.value; data[2] = e.midiCCOut.value;
break; break;
case Vst::kCtrlProgramChange: case Vst::kCtrlProgramChange:
size = 2;
data[0] = MIDI_CMD_PGM_CHANGE | e.midiCCOut.channel; data[0] = MIDI_CMD_PGM_CHANGE | e.midiCCOut.channel;
data[1] = e.midiCCOut.value; data[1] = e.midiCCOut.value;
data[2] = e.midiCCOut.value2; data[2] = e.midiCCOut.value2;
break; break;
case Vst::kAfterTouch: case Vst::kAfterTouch:
size = 2;
data[0] = MIDI_CMD_CHANNEL_PRESSURE | e.midiCCOut.channel; data[0] = MIDI_CMD_CHANNEL_PRESSURE | e.midiCCOut.channel;
data[1] = e.midiCCOut.value; data[1] = e.midiCCOut.value;
data[2] = e.midiCCOut.value2; data[2] = e.midiCCOut.value2;
break; break;
case Vst::kPitchBend: case Vst::kPitchBend:
size = 3;
data[0] = MIDI_CMD_BENDER | e.midiCCOut.channel; data[0] = MIDI_CMD_BENDER | e.midiCCOut.channel;
data[1] = e.midiCCOut.value; data[1] = e.midiCCOut.value;
data[2] = e.midiCCOut.value2; data[2] = e.midiCCOut.value2;
break; break;
} }
mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, e.midiCCOut.controlNumber == Vst::kCtrlProgramChange ? 2 : 3, data); mb.push_back (e.sampleOffset, Evoral::MIDI_EVENT, size, data);
break; break;
}
case Vst::Event::kNoteExpressionValueEvent: case Vst::Event::kNoteExpressionValueEvent:
case Vst::Event::kNoteExpressionTextEvent: case Vst::Event::kNoteExpressionTextEvent:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MIDINameDocument PUBLIC "-//MIDI Manufacturers Association//DTD MIDINameDocument 1.0//EN" "http://www.midi.org/dtds/MIDINameDocument10.dtd"> <!DOCTYPE MIDINameDocument PUBLIC "-//MIDI Manufacturers Association//DTD MIDINameDocument 1.0//EN" "http://www.midi.org/dtds/MIDINameDocument10.dtd">
<MIDINameDocument> <MIDINameDocument>
<MasterDeviceNames> <Author>Nikolaos Strikos strikosn@gmail.com</Author>
<Manufacturer>Kurzweil</Manufacturer> <Manufacturer>Kurzweil</Manufacturer>
<Model>K2700</Model> <Model>K2700</Model>
<CustomDeviceMode Name="Mode 1"> <CustomDeviceMode Name="Mode 1">