Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different SysEx messages in the same block all come through as duplicates (VST3) #78

Open
ijijn opened this issue Jun 7, 2023 · 2 comments

Comments

@ijijn
Copy link
Contributor

ijijn commented Jun 7, 2023

Hello NIH-ers!

I've run into a problem case whenever more than one SysEx event is processed during the same block using VST3. Basically, the last event appears duplicated as many times as needed instead of each one having its own data.

In contrast, the CLAP version handles this just fine.

Here's some sample JSON debugging output for comparison, where [xx] is used for unprintable characters...

correct (CLAP):

[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":243,"channel":0,"note":59}}[f7] (98 bytes)
[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":289,"channel":0,"note":8}}[f7] (97 bytes)
[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":312,"channel":0,"note":104}}[f7] (99 bytes)
[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":496,"channel":0,"note":57}}[f7] (98 bytes)

incorrect (VST3):

[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":243,"channel":0,"note":57}}[f7] (98 bytes)
[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":289,"channel":0,"note":57}} (97 bytes)
[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":312,"channel":0,"note":57}}[f7][00] (99 bytes)
[f0]{"SysEx":{"bar":0,"beats":2.0,"samples":44100,"tempo":120.0,"timing":496,"channel":0,"note":57}}[f7] (98 bytes)

Note the truncated trailing [f7] (line 2) and the extra [00] padding (line 3) where the buffer lengths don't match the repeated event. The reported lengths themselves are accurate, however.

Thanks in advance for any thoughts on this 🚀

Iain

@robbert-vdh
Copy link
Owner

robbert-vdh commented Jun 7, 2023

What host did you try this with? It may be an issue with that host. If you check the code here there's nothing that could cause it to read the same buffer multiple times unless the host used the same pointer for each event:

// 0 = kMidiSysEx
let event = event.event.data;
// `NoteEvent::from_midi` prints some tracing if parsing fails, which is
// not necessarily an error
assert!(!event.bytes.is_null());
let sysex_buffer =
std::slice::from_raw_parts(event.bytes, event.size as usize);

And this works just like you'd expect in REAPER 6.79 with multiple SysEx events sent as part of a single process call.

@ijijn
Copy link
Contributor Author

ijijn commented Jun 7, 2023

Ah, thank you for pointing out exactly where in the code this is all going on. As it happens, I'm experiencing this specifically with REAPER (x64) on Windows 11. Hmm, may have to do some further digging to get to the bottom of it ⛏️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants