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.
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.
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>
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>
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.
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.