A14: MIDI-out từ plugin (VST2/VST3) → SHM → Rust emit → DAW track

- Vst2Instrument: audioMaster callback thu VstEvents, push SHM midiOutQueue
- Vst3Instrument: IEventList output bus (kAudioMasterWantMidi) — check
- SharedMemoryIPC.h: midiOutQueue[64] + midiOutCount (offset 27556/28324, sizeof 28328)
- shm.rs: MidiEventIPC Serialize, drain_midi_out() emit 'bridge-midi-out'
- lib.rs: pump emit midi-out events
- nativeBridgeService.js: onMidiOut API
- app.jsx: route MIDI-out về selected track qua SonicMidiRouter (feedback guard)
- TASKS.md: A14 ✅
This commit is contained in:
2026-08-19 21:12:07 +07:00
parent 6efef85e47
commit 6a3b430da0
10 changed files with 375 additions and 226 deletions
+7 -3
View File
@@ -67,8 +67,9 @@ int main() {
assert(sizeof(SharedAudioBufferIPC::ControlEventIPC) == 1040);
// G4.5 ring: 11168 (G3.1 +heartbeat) + ringMask(4) + ringLeft(8192) + ringRight(8192)
// = 27556, rounded up to 8-byte struct alignment (u64 blockTimestamp) => 27560.
// Matches Rust size_of (src-tauri/src/shm.rs layout test).
assert(sizeof(SharedAudioBufferIPC) == 27560);
// A14 midi-out: ring_right ends at 27556; midiOutQueue appends there,
// +64*12 + 4 = 28328 (already 8-aligned). Matches Rust size_of (src-tauri/src/shm.rs).
assert(sizeof(SharedAudioBufferIPC) == 28328);
// 6. Audio ring round-trip (multi-slot, VSTi crackle fix)
ipc->ringMask = 7;
@@ -78,7 +79,10 @@ int main() {
assert(ipc->ringRight[3][0] == 42.0f);
assert((ipc->bridgeWriteIndex & ipc->ringMask) < 8);
std::printf("SHM self-check OK (sizeof struct = %zu bytes)\n", sizeof(SharedAudioBufferIPC));
std::printf("SHM self-check sizeof struct = %zu bytes\n", sizeof(SharedAudioBufferIPC));
std::printf("midiOutQueue offset = %zu, midiOutCount offset = %zu\n",
offsetof(SharedAudioBufferIPC, midiOutQueue),
offsetof(SharedAudioBufferIPC, midiOutCount));
shm_close(h);
return 0;
}