VstPlugin, RemoteVstPlugin: update program name via new idle update messages
Introduced new idle update messages for exchanging data periodically but not inferring audio processing.
This commit is contained in:
@@ -438,11 +438,24 @@ bool RemoteVstPlugin::processMessage( const message & _m )
|
||||
break;
|
||||
|
||||
case IdVstSetParameter:
|
||||
lock();
|
||||
m_plugin->setParameter( m_plugin, _m.getInt( 0 ), _m.getFloat( 1 ) );
|
||||
unlock();
|
||||
sendMessage( IdVstSetParameter );
|
||||
break;
|
||||
|
||||
|
||||
case IdVstIdleUpdate:
|
||||
{
|
||||
int newCurrentProgram = pluginDispatch( effGetProgram );
|
||||
if( newCurrentProgram != m_currentProgram )
|
||||
{
|
||||
m_currentProgram = newCurrentProgram;
|
||||
sendCurrentProgramName();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return RemotePluginClient::processMessage( _m );
|
||||
@@ -691,6 +704,8 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
|
||||
memset( m_outputs[i], 0, bufferSize() * sizeof( float ) );
|
||||
}
|
||||
|
||||
lock();
|
||||
|
||||
#ifdef OLD_VST_SDK
|
||||
if( m_plugin->flags & effFlagsCanReplacing )
|
||||
{
|
||||
@@ -706,14 +721,9 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
|
||||
}
|
||||
#endif
|
||||
|
||||
m_currentSamplePos += bufferSize();
|
||||
unlock();
|
||||
|
||||
int newCurrentProgram = pluginDispatch( effGetProgram );
|
||||
if( newCurrentProgram != m_currentProgram )
|
||||
{
|
||||
m_currentProgram = newCurrentProgram;
|
||||
sendCurrentProgramName();
|
||||
}
|
||||
m_currentSamplePos += bufferSize();
|
||||
}
|
||||
|
||||
|
||||
@@ -807,7 +817,7 @@ const char * RemoteVstPlugin::presetName()
|
||||
void RemoteVstPlugin::sendCurrentProgramName()
|
||||
{
|
||||
char presName[64];
|
||||
sprintf( presName, " %d/%d: %s", pluginDispatch( effGetProgram ) + 1, m_plugin->numPrograms, presetName() );
|
||||
sprintf( presName, "%d/%d: %s", pluginDispatch( effGetProgram ) + 1, m_plugin->numPrograms, presetName() );
|
||||
|
||||
sendMessage( message( IdVstCurrentProgramName ).addString( presName ) );
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
|
||||
m_currentProgramName(),
|
||||
m_allProgramNames(),
|
||||
p_name(),
|
||||
m_currentProgram()
|
||||
m_currentProgram(),
|
||||
m_idleTimer()
|
||||
{
|
||||
setSplittedChannels( true );
|
||||
|
||||
@@ -110,6 +111,11 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
|
||||
this, SLOT( setTempo( bpm_t ) ) );
|
||||
connect( engine::getMixer(), SIGNAL( sampleRateChanged() ),
|
||||
this, SLOT( updateSampleRate() ) );
|
||||
|
||||
// update once per second
|
||||
m_idleTimer.start( 1000 );
|
||||
connect( &m_idleTimer, SIGNAL( timeout() ),
|
||||
this, SLOT( idleUpdate() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -574,6 +580,14 @@ void VstPlugin::setParam( int i, float f )
|
||||
|
||||
|
||||
|
||||
void VstPlugin::idleUpdate()
|
||||
{
|
||||
lock();
|
||||
sendMessage( message( IdVstIdleUpdate ) );
|
||||
unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void VstPlugin::loadChunk( const QByteArray & _chunk )
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "mixer.h"
|
||||
@@ -121,6 +122,7 @@ public slots:
|
||||
void loadProgramNames();
|
||||
void savePreset( void );
|
||||
void setParam( int i, float f );
|
||||
void idleUpdate();
|
||||
|
||||
|
||||
private:
|
||||
@@ -147,6 +149,8 @@ private:
|
||||
|
||||
int m_currentProgram;
|
||||
|
||||
QTimer m_idleTimer;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ enum VstRemoteMessageIDs
|
||||
IdVstCurrentProgramName,
|
||||
IdVstSetProgram,
|
||||
IdVstRotateProgram,
|
||||
IdVstIdleUpdate,
|
||||
|
||||
// remoteVstPlugin -> vstPlugin
|
||||
IdVstFailedLoadingPlugin,
|
||||
|
||||
Reference in New Issue
Block a user