musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.17k stars 2.64k forks source link

Implement VST support for Linux #16799

Open cbjeukendrup opened 1 year ago

cbjeukendrup commented 1 year ago

Task description On Linux, VST support was delayed due to critical issues with it (mainly the GUI not working because we need to provide the plugin with an event loop). The plan is to implement this for 4.1. Contributions from the community are very welcome.

For some context, see:

11689

https://github.com/musescore/MuseScore/issues/11592 https://github.com/musescore/MuseScore/issues/11550 https://github.com/musescore/MuseScore/issues/9481

cbjeukendrup commented 2 months ago

Yesterday I investigated a bit what the problem here actually is. I found this page from the Steinberg documentation: https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Provide+A+Runloop+On+Linux/Index.html

On Linux, there is no global event run loop like on Windows and macOS. For this reason, the plug-in can query for an Linux::IRunLoop which must be provided by the host application in two different ways.

It would of course be great to make use of the runloop provided by Qt. On a first sight, that seems impossible, because for Steinberg's IRunLoop interface we need to implement something with a file descriptor while you usually see nothing like that in Qt's event loop, which is much more high-level. However, I found this class: https://doc.qt.io/qt-6/qsocketnotifier.html That might be exactly what's needed to implement the first two methods of the IRunLoop interface. For the later two methods, I think we can just use a QTimer.

Some resources that might be helpful:

However, I think both of these implementations are far more complicated than what ours will end up being, because we have the possibility to use stuff from Qt.

bmarwell commented 2 months ago

Have you tried talking to someone from the KDE project? They might implement something for you in future versions. Of course, this will not be helpful in the near future, but hopefully in the long run.

cbjeukendrup commented 2 months ago

I don't really think we need support from KDE. What needs to happen is simply that we need to implement some interface from the VST SDK, so that it can use that interface to set up event handling and timers. And my hypothesis is that we already have everything that's needed to implement that interface properly, namely via Qt. Or did you mean they might want to help us implement it in MuseScore? That would be very nice of course, but I think we don't need to actively ask them to spend their time on that.

bmarwell commented 2 months ago

Nah, first one. I understood some platform APIs were missing and I just wanted to mention that reaching out is probably an option. I just wondered it was not mentioned before, that's all. 😃

diedeno commented 2 months ago

But why do you think this has anything to do with KDE?

bmarwell commented 2 months ago

qt and KDE are historically tied together. Sorry if that was not the case anymore.

ThePython10110 commented 2 months ago

For now, if you don't want to build from source with the VST flag, you can use @diedeno's builds, which does the same thing.