-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Implement sendNote for VST, and also add a SendNote example #212
Conversation
distrho/src/DistrhoPluginVST.cpp
Outdated
fMidiCount(0), | ||
fWriterIndex(0) | ||
{ | ||
fMidiStorage = new ShortMessage[kMidiStorageCapacity]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't this part of the class variables but allocated on the constructor?
do we pointer swap at some point? if not, there is no reason to allocate things twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on purpose, to avoid a large block in the middle of object layout.
I'm pretty sure it's a recommended practice regarding caching, especially that this buffer is not going to be touched very regularly.
Generally nice, thanks. I have a ringbuffer class made for carla that I can place here under permissive license. Also, an idea that was mentioned on IRC was to allow UI to send any MIDI event, not just notes. |
Agreed yes, I have thought about writing it in this perspective.
Possibly yes, here the lock isn't going even to be touched if nothing happens, I think it's quite light.
Yeah I can do this one I guess. Using JACK's own ringbuffer? |
Not a bad idea, but when a new format comes along (VST3 or AU) we will have to deal with this again, so I think it is better to have a common shared approach. |
I will do this, but I'm divided right now about where I preferably move the MIDI queue. |
Good question. Since this is only used for plugin formats that do instance-access then it is fine to go into plugin internal header yes. It is more related to the DSP side (receiving data) rather than UI. |
Thanks for the changes. |
What do you think of the GCC variable size array extension, aka. silent allocas? In the JACK client, this dynamic stack array gives a little trouble.
|
We should limit the use of them, but okay for cases where it is known the size to be small |
Regarding JACK, I've bounded the MIDI buffer to the limit Do you think it would be wise to split the travis build into jobs, to improve the readability? |
Looking into this again. |
Signed-off-by: falkTX <falktx@falktx.com>
I imported the example plugin just now, will leave the PR open for reference regarding the other bits for JACK and VST2 sendNote support. The example is slightly tweaked to behave more like a typical software piano UI. |
Functionality now implemented on develop branch through the use of ringbuffer. |
This implements note input from the editor, following a discussion in an older PR with @pdesaulniers.
It will enqueue the MIDI data into a FIFO buffer, which is protected by a mutex, and accessed by DSP with try-lock.
The buffer will be cleared when the plugin activates.
It uses
extra/Mutex
and forces the VST client to require pthread on non-Windows.A test program is provided with UI and synthesizer.
cc @rghvdberg