Various plugins were missing the PLUGIN_EXPORT declaration with their
PluginDescriptor instantiations and lmms_plugin_main implementation
which made some plugins not show up with latest Win32 build.
(cherry picked from commit f85898ba6e)
It's not a good idea to allocate the buffer for VST chunk data on the
stack as chunks might become quite big (several megabytes) and thus
could cause a stack overflow. Fix this by using new/delete.
Until now, Mixer not only was responsible for rendering audio buffers
but also managed writing them to audio backend (through a FIFO) and
handled various quality related parameters.
All this functionality has been moved into the new AudioOutputContext
class. It glues together AudioBackend (formerly called AudioDevice),
global quality settings and the Mixer.
The AudioOutputContext class creates a FifoWriter which calls
Mixer::renderNextBuffer() and writes the output into the BufferFifo of
the AudioOutputContext it belongs to. The BufferFifo is read by the
according AudioBackend which belongs to the AudioOutputContext as well.
The AudioOutputContext also handles resampling in case the AudioBackend
wants the buffers in a different samplerate.
During this rewrite the Mixer class and the according source files have
been renamed from "mixer" to "Mixer". This results in small changes
all over LMMS' code base.
VstPlugin creates a temporary file for exchanging data chunks of VST
plugins with the remote process. After calling QFile::write(...) data
has not neccessarily been written due to QFile's internal write buffer.
Therefore explicitely call QFile::flush() so all data is guaranteed
to be written.
Fixes problems with plugins which save small data chunks.
There's no need to call plugin dispatcher in hostCallback. It makes
plugins like Garritan Personal Orchestra 4 lock up. After removing
these calls the affected plugins work.
Most files and most of the core classes and their methods have been
renamed to match new coding style conventions:
391 files changed, 25400 insertions(+), 25598 deletions(-)
Furthermore splitted some files where model and view classes were
declared or implemented together in the same file.
Should be tested thoroughly as I might have missed renaming some virtual
methods or SIGNAL/SLOT parameters.
If libraries are being used from somewhere other than
/usr/include or /usr/local/include, building vst_remote would fail.
Now it checks CMAKE_INSTALL_PREFIX/include.
* cleaned up code and improved coding style
* removed old SINGLE_SOURCE_COMPILE macro relicts
* use QString::toUtf8() instead of QString::toAscii() wherever possible
QString::toStdString() is not aware of locale specific characters (it
just converts to ASCII). Therefore added new macro QSTR_TO_STDSTR which
converts a QString to std::string with UTF8 characters.
Use this new macro in LMMS VST Support Layer and ZynAddSubFX plugin.
This fixes for example VST plugins not being loaded when the path to
the DLL contains non-ASCII (e.g. cyrillic) characters.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Commit 4ad5add745 introduced a typo which
lead to compilation failure. This commit fixes it.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Added a typedef for VstMidiEventList so actual type does not have
to be hard-coded each time in the code.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Don't process MIDI events in GUI thread as this might corrupt MIDI
event array if both GUI and processing thread access it. Fixes
possible crashes.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Locking the plugin is now achieved by calling RemoteVstPlugin::lock()
and RemoteVstPlugin::unlock().
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Different threading models aren't used anymore as SplittedThreadingModel
after all recent improvements works fine for all plugins tested so far.
It even shows that a lot more VST plugins are running now properly.
Therefore all support for TraditionalThreadingModel has been removed
which greatly simplifies code and makes it much more maintainable.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
When saving or restoring settings, prefer chunks over parameters.
This fixes some problems with plugins which get confused e.g. if you
restore individual parameters rather than the whole chunk.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
O_BINARY flag is not supported on Linux, therefore define it to 0.
Fixes compilation failure on Linux.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
When writing chunk to file or read it back from file, open file with
O_BINARY flag. Otherwise on win32 for example line endings (\n) are
converted (\r\n) and with real binary data this screws up things.
Thanks to Oleg Sharonov for pointing this out.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
When input/output count changes, always print new number of inputs and
outputs as debugg message.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Reset m_inputs and m_outputs to NULL after deleting the memory they're
pointing to. Fixes possible crash if new input or output count is 0
and the count changes again later.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Some plugins call host callback from within their main function,
causing RemoteVstPlugin::m_plugin not to be set yet. Therefore
explicitely set RemoteVstPlugin::m_plugin if it's NULL. Makes plugins
by Wallander Instruments (and possibly others as well) work.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Plugin dispatcher was called without any protection from various threads
leading to regular crashes or deadlocks within the plugin. The plugin
dispatching is now encapsulated into one central function which protects
the dispatcher by a mutex.
Furthermore improved handling of audioMasterIdle and
audioMasterUpdateDisplay in host callback by posting a message to GUI
thread asking for idle processing instead of directly calling plugin
dispatcher.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Saving and restoring chunks from/to plugin seems to work now after a
few tweaks regarding memory-allocation and threading (according
functions need to be called from withing GUI thread). However needs the
new code some testing (especially whether it breaks previously working
plugins).
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Check for m_plugin being NULL in RemoteVstPlugin::inputCount(),
RemoteVstPlugin::outputCount() and RemoteVstPlugin::pluginVersion().
Makes various VST's load properly now.
Thanks to Oleg Sharonov for pointing this out.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Proteus VX requires SplittedThreading model in order to run properly.
Issues with actually working UI interaction still need to be worked
out although it rather looks like a bug in WINE.
Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
With newer versions of wineg++ (1.1) errorneously adds the suffix ".exe"
to the target binary. This causes "make install" to fail. Therefore
rename remote_vst_plugin.exe if it exists.
Removed obsolete warning about setting realtime. It's neither important
nor will calling printf()/fprintf() in a RemotePlugin print anything in
LMMS' console output.
Some VST plugins save their state as chunks rather than parameters.
According code to save/restore those chunks has been taken from FST 1.9.
However restore currently is disabled as it mostly fails for whatever
reason.
For some reason, building remote_vst_plugin.cpp with recent
wineg++/gcc-multilib on 64 bit platforms causes undefined symbols:
remote_vst_plugin-JzpHs6.o: In function `std::list<VstMidiEvent, std::allocator<VstMidiEvent> >::_M_insert(std::_List_iterator<VstMidiEvent>, VstMidiEvent const&)':
remote_vst_plugin.cpp:(.text._ZNSt4listI12VstMidiEventSaIS0_EE9_M_insertESt14_List_iteratorIS0_ERKS0_[std::list<VstMidiEvent, std::allocator<VstMidiEvent> >::_M_insert(std::_List_iterator<VstMidiEvent>, VstMidiEvent const&)]+0x35): undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
Replacing std::list with std::vector for queueing MIDI events seems to
fix this issue. Consider this as a workaround rather than constructive fix.
Up to now changes of samplerate or tempo only have been tracked by the
VeSTige plugin while e.g. the VstEffect didn't forward such changes to the
RemotePlugin. Moving according code from VeSTige to VstPlugin base class
fixes this issue.
Most of the MDA VST plugins require the SplittedThreading model in order
to run properly. All plugins whose unique ID starts with "mda" will be
driven with the SplittedThreading model.