Synchronize with remote plugins using local sockets

This commit is contained in:
Javier Serrano Polo
2016-05-28 02:43:57 +02:00
parent a42a3c5346
commit fa7d7a111a
9 changed files with 409 additions and 91 deletions

View File

@@ -56,6 +56,7 @@
#endif
#define USE_WS_PREFIX
#include <windows.h>
#ifdef LMMS_BUILD_WIN32
@@ -121,7 +122,11 @@ DWORD __GuiThreadID = 0;
class RemoteVstPlugin : public RemotePluginClient
{
public:
#ifdef SYNC_WITH_SHM_FIFO
RemoteVstPlugin( key_t _shm_in, key_t _shm_out );
#else
RemoteVstPlugin( const char * socketPath );
#endif
virtual ~RemoteVstPlugin();
virtual bool processMessage( const message & _m );
@@ -332,8 +337,13 @@ private:
#ifdef SYNC_WITH_SHM_FIFO
RemoteVstPlugin::RemoteVstPlugin( key_t _shm_in, key_t _shm_out ) :
RemotePluginClient( _shm_in, _shm_out ),
#else
RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) :
RemotePluginClient( socketPath ),
#endif
m_shortName( "" ),
m_libInst( NULL ),
m_plugin( NULL ),
@@ -1014,7 +1024,7 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file )
if( len > 0 )
{
int fd = open( _file.c_str(), O_WRONLY | O_BINARY );
write( fd, chunk, len );
::write( fd, chunk, len );
close( fd );
}
}
@@ -1331,7 +1341,7 @@ void RemoteVstPlugin::loadChunkFromFile( const std::string & _file, int _len )
}
const int fd = open( _file.c_str(), O_RDONLY | O_BINARY );
read( fd, chunk, _len );
::read( fd, chunk, _len );
close( fd );
pluginDispatch( 24, 0, _len, chunk );
@@ -1853,7 +1863,11 @@ DWORD WINAPI RemoteVstPlugin::guiEventLoop( LPVOID _param )
int main( int _argc, char * * _argv )
{
#ifdef SYNC_WITH_SHM_FIFO
if( _argc < 3 )
#else
if( _argc < 2 )
#endif
{
fprintf( stderr, "not enough arguments\n" );
return -1;
@@ -1886,7 +1900,11 @@ int main( int _argc, char * * _argv )
// constructor automatically will process messages until it receives
// a IdVstLoadPlugin message and processes it
#ifdef SYNC_WITH_SHM_FIFO
__plugin = new RemoteVstPlugin( atoi( _argv[1] ), atoi( _argv[2] ) );
#else
__plugin = new RemoteVstPlugin( _argv[1] );
#endif
if( __plugin->isInitialized() )
{

View File

@@ -80,9 +80,8 @@ public:
VstPlugin::VstPlugin( const QString & _plugin ) :
QObject(),
JournallingObject(),
RemotePlugin(),
JournallingObject(),
m_plugin( _plugin ),
m_pluginWidget( NULL ),
m_pluginWindowID( 0 ),

View File

@@ -37,8 +37,7 @@
#include "communication.h"
class PLUGIN_EXPORT VstPlugin : public QObject, public JournallingObject,
public RemotePlugin
class PLUGIN_EXPORT VstPlugin : public RemotePlugin, public JournallingObject
{
Q_OBJECT
public:

View File

@@ -44,8 +44,13 @@
class RemoteZynAddSubFx : public RemotePluginClient, public LocalZynAddSubFx
{
public:
#ifdef SYNC_WITH_SHM_FIFO
RemoteZynAddSubFx( int _shm_in, int _shm_out ) :
RemotePluginClient( _shm_in, _shm_out ),
#else
RemoteZynAddSubFx( const char * socketPath ) :
RemotePluginClient( socketPath ),
#endif
LocalZynAddSubFx(),
m_guiSleepTime( 100 ),
m_guiExit( false )
@@ -261,7 +266,11 @@ void RemoteZynAddSubFx::guiThread()
int main( int _argc, char * * _argv )
{
#ifdef SYNC_WITH_SHM_FIFO
if( _argc < 3 )
#else
if( _argc < 2 )
#endif
{
fprintf( stderr, "not enough arguments\n" );
return -1;
@@ -276,8 +285,12 @@ int main( int _argc, char * * _argv )
#endif
#ifdef SYNC_WITH_SHM_FIFO
RemoteZynAddSubFx * remoteZASF =
new RemoteZynAddSubFx( atoi( _argv[1] ), atoi( _argv[2] ) );
#else
RemoteZynAddSubFx * remoteZASF = new RemoteZynAddSubFx( _argv[1] );
#endif
remoteZASF->run();

View File

@@ -70,7 +70,6 @@ Plugin::Descriptor PLUGIN_EXPORT zynaddsubfx_plugin_descriptor =
ZynAddSubFxRemotePlugin::ZynAddSubFxRemotePlugin() :
QObject(),
RemotePlugin()
{
init( "RemoteZynAddSubFx", false );

View File

@@ -44,7 +44,7 @@ class Knob;
class LedCheckBox;
class ZynAddSubFxRemotePlugin : public QObject, public RemotePlugin
class ZynAddSubFxRemotePlugin : public RemotePlugin
{
Q_OBJECT
public: