RemotePlugin, VstPlugin: reorganized and partly rewrote program/preset related functions
The code for managing programs/presets of RemotePlugin instances was very confusing, mainly within the VstPlugin and RemoteVstPlugin class. I therefore started to reorganize and rewrite functions.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* RemotePlugin.h - base class providing RPC like mechanisms
|
||||
*
|
||||
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -509,12 +509,8 @@ enum RemoteMessageIDs
|
||||
IdSaveSettingsToFile,
|
||||
IdLoadSettingsFromString,
|
||||
IdLoadSettingsFromFile,
|
||||
IdLoadChunkFromPresetFile,
|
||||
IdRotateProgram,
|
||||
IdLoadPrograms,
|
||||
IdSavePreset,
|
||||
IdSetParameter,
|
||||
IdLoadPresetFromFile,
|
||||
IdSavePresetFile,
|
||||
IdLoadPresetFile,
|
||||
IdDebugMessage,
|
||||
IdUserBase = 64
|
||||
} ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* vestige.cpp - instrument-plugin for hosting VST-instruments
|
||||
*
|
||||
* Copyright (c) 2005-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -398,7 +398,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument,
|
||||
m_rolLPresetButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"stepper-left" ) );
|
||||
connect( m_rolLPresetButton, SIGNAL( clicked() ), this,
|
||||
SLOT( rolrPreset() ) );
|
||||
SLOT( previousProgram() ) );
|
||||
toolTip::add( m_rolLPresetButton, tr( "Previous (-)" ) );
|
||||
|
||||
m_rolLPresetButton->setShortcut( Qt::Key_Minus );
|
||||
@@ -432,7 +432,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument,
|
||||
m_rolRPresetButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"stepper-right" ) );
|
||||
connect( m_rolRPresetButton, SIGNAL( clicked() ), this,
|
||||
SLOT( rollPreset() ) );
|
||||
SLOT( nextProgram() ) );
|
||||
toolTip::add( m_rolRPresetButton, tr( "Next (+)" ) );
|
||||
|
||||
m_rolRPresetButton->setShortcut( Qt::Key_Plus );
|
||||
@@ -501,11 +501,12 @@ void VestigeInstrumentView::updateMenu( void )
|
||||
{
|
||||
|
||||
// get all presets -
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
m_vi->m_plugin->loadPrograms( 1 );
|
||||
if ( m_vi->m_plugin != NULL )
|
||||
{
|
||||
m_vi->m_plugin->loadProgramNames();
|
||||
QWidget::update();
|
||||
|
||||
QString str = m_vi->m_plugin->presetsString();
|
||||
QString str = m_vi->m_plugin->allProgramNames();
|
||||
|
||||
QStringList list1 = str.split("|");
|
||||
|
||||
@@ -600,13 +601,13 @@ void VestigeInstrumentView::openPlugin()
|
||||
|
||||
|
||||
|
||||
void VestigeInstrumentView::openPreset( void )
|
||||
void VestigeInstrumentView::openPreset()
|
||||
{
|
||||
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
m_vi->m_plugin->openPreset( );
|
||||
bool converted;
|
||||
QString str = m_vi->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
QWidget::update();
|
||||
@@ -617,10 +618,11 @@ void VestigeInstrumentView::openPreset( void )
|
||||
|
||||
|
||||
|
||||
void VestigeInstrumentView::savePreset( void )
|
||||
void VestigeInstrumentView::savePreset()
|
||||
{
|
||||
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
if ( m_vi->m_plugin != NULL )
|
||||
{
|
||||
m_vi->m_plugin->savePreset( );
|
||||
/* bool converted;
|
||||
QString str = m_vi->m_plugin->presetString().section("/", 0, 0);
|
||||
@@ -634,13 +636,13 @@ void VestigeInstrumentView::savePreset( void )
|
||||
|
||||
|
||||
|
||||
void VestigeInstrumentView::rollPreset( void )
|
||||
void VestigeInstrumentView::nextProgram()
|
||||
{
|
||||
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
m_vi->m_plugin->rollPreset( 1 );
|
||||
m_vi->m_plugin->rotateProgram( 1 );
|
||||
bool converted;
|
||||
QString str = m_vi->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
QWidget::update();
|
||||
@@ -650,13 +652,13 @@ void VestigeInstrumentView::rollPreset( void )
|
||||
|
||||
|
||||
|
||||
void VestigeInstrumentView::rolrPreset( void )
|
||||
void VestigeInstrumentView::previousProgram()
|
||||
{
|
||||
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
m_vi->m_plugin->rollPreset( -1 );
|
||||
m_vi->m_plugin->rotateProgram( -1 );
|
||||
bool converted;
|
||||
QString str = m_vi->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
QWidget::update();
|
||||
@@ -673,7 +675,7 @@ void VestigeInstrumentView::selPreset( void )
|
||||
if (action)
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
lastPosInMenu = action->data().toInt();
|
||||
m_vi->m_plugin->rollPreset( action->data().toInt() + 2 );
|
||||
m_vi->m_plugin->setProgram( action->data().toInt() );
|
||||
QWidget::update();
|
||||
}
|
||||
}
|
||||
@@ -790,7 +792,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * )
|
||||
p.setFont( pointSize<8>( f ) );
|
||||
p.drawText( 10, 114, tr( "by" ) + " " +
|
||||
m_vi->m_plugin->vendorString() );
|
||||
p.drawText( 10, 225, m_vi->m_plugin->presetString() );
|
||||
p.drawText( 10, 225, m_vi->m_plugin->currentProgramName() );
|
||||
}
|
||||
// m_pluginMutex.unlock();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* vestige.h - instrument VeSTige for hosting VST-plugins
|
||||
*
|
||||
* Copyright (c) 2005-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -145,8 +145,8 @@ protected slots:
|
||||
void managePlugin( void );
|
||||
void openPreset( void );
|
||||
void savePreset( void );
|
||||
void rollPreset( void );
|
||||
void rolrPreset( void );
|
||||
void nextProgram();
|
||||
void previousProgram();
|
||||
void selPreset( void );
|
||||
void toggleGUI( void );
|
||||
void noteOffAll( void );
|
||||
|
||||
@@ -163,9 +163,12 @@ public:
|
||||
// determine product-string of plugin
|
||||
const char * pluginProductString();
|
||||
|
||||
// determine name of plugipn preset
|
||||
// determine name of plugin preset
|
||||
const char * presetName();
|
||||
|
||||
// send name of current program back to host
|
||||
void sendCurrentProgramName();
|
||||
|
||||
// do a complete parameter-dump and post it
|
||||
void getParameterDump();
|
||||
|
||||
@@ -182,13 +185,16 @@ public:
|
||||
void loadChunkFromFile( const std::string & _file, int _len );
|
||||
|
||||
// restore settings chunk of plugin from file
|
||||
void loadChunkFromPresetFile( const std::string & _file );
|
||||
void loadPresetFile( const std::string & _file );
|
||||
|
||||
// restore settings chunk of plugin from file
|
||||
void rotateProgram( int _len );
|
||||
// sets given program index
|
||||
void setProgram( int index );
|
||||
|
||||
// Load names VST of presets/programs
|
||||
void loadPrograms( int _len );
|
||||
// rotate current program by given offset
|
||||
void rotateProgram( int offset );
|
||||
|
||||
// Load names of presets/programs
|
||||
void getProgramNames();
|
||||
|
||||
// Save presets/programs
|
||||
void savePreset( const std::string & _file );
|
||||
@@ -401,29 +407,33 @@ bool RemoteVstPlugin::processMessage( const message & _m )
|
||||
sendMessage( IdLoadSettingsFromFile );
|
||||
break;
|
||||
|
||||
case IdLoadChunkFromPresetFile:
|
||||
loadChunkFromPresetFile( _m.getString( 0 ) );
|
||||
sendMessage( IdLoadChunkFromPresetFile );
|
||||
case IdLoadPresetFile:
|
||||
loadPresetFile( _m.getString( 0 ) );
|
||||
sendMessage( IdLoadPresetFile );
|
||||
break;
|
||||
|
||||
case IdRotateProgram:
|
||||
case IdVstSetProgram:
|
||||
setProgram( _m.getInt( 0 ) );
|
||||
sendMessage( IdVstSetProgram );
|
||||
break;
|
||||
|
||||
case IdVstRotateProgram:
|
||||
rotateProgram( _m.getInt( 0 ) );
|
||||
sendMessage( IdRotateProgram );
|
||||
sendMessage( IdVstRotateProgram );
|
||||
break;
|
||||
|
||||
case IdLoadPrograms:
|
||||
loadPrograms( _m.getInt( 0 ) );
|
||||
sendMessage( IdLoadPrograms );
|
||||
case IdVstProgramNames:
|
||||
getProgramNames();
|
||||
break;
|
||||
|
||||
case IdSavePreset:
|
||||
case IdSavePresetFile:
|
||||
savePreset( _m.getString( 0 ) );
|
||||
sendMessage( IdSavePreset );
|
||||
sendMessage( IdSavePresetFile );
|
||||
break;
|
||||
|
||||
case IdSetParameter:
|
||||
case IdVstSetParameter:
|
||||
m_plugin->setParameter( m_plugin, _m.getInt( 0 ), _m.getFloat( 1 ) );
|
||||
sendMessage( IdSetParameter );
|
||||
sendMessage( IdVstSetParameter );
|
||||
break;
|
||||
|
||||
|
||||
@@ -691,7 +701,6 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
|
||||
#endif
|
||||
|
||||
m_currentSamplePos += bufferSize();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -771,9 +780,10 @@ const char * RemoteVstPlugin::pluginProductString()
|
||||
const char * RemoteVstPlugin::presetName()
|
||||
{
|
||||
static char buf[32];
|
||||
buf[0] = 0;
|
||||
|
||||
m_plugin->dispatcher(m_plugin, effGetProgramName, 0, 0, buf, 0);
|
||||
memset( buf, 0, sizeof( buf ) );
|
||||
|
||||
pluginDispatch( effGetProgramName, 0, 0, buf );
|
||||
|
||||
buf[31] = 0;
|
||||
return buf;
|
||||
@@ -781,6 +791,16 @@ const char * RemoteVstPlugin::presetName()
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::sendCurrentProgramName()
|
||||
{
|
||||
char presName[64];
|
||||
sprintf( presName, " %d/%d: %s", pluginDispatch( effGetProgram ) + 1, m_plugin->numPrograms, presetName() );
|
||||
|
||||
sendMessage( message( IdVstCurrentProgramName ).addString( presName ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::getParameterDump()
|
||||
{
|
||||
char curPresName[30];
|
||||
@@ -869,30 +889,55 @@ void RemoteVstPlugin::saveChunkToFile( const std::string & _file )
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::rotateProgram( int _len )
|
||||
void RemoteVstPlugin::setProgram( int program )
|
||||
{
|
||||
int currProgram;
|
||||
if (isInitialized() == false) return;
|
||||
if (_len <= 1) {
|
||||
currProgram = m_plugin->dispatcher(m_plugin, effGetProgram, 0, 0, 0, 0) + _len;
|
||||
if (currProgram >= m_plugin->numPrograms) currProgram = m_plugin->numPrograms - 1;
|
||||
if (currProgram < 0) currProgram = 0;
|
||||
m_plugin->dispatcher(m_plugin, effSetProgram, 0, currProgram++, 0, 0);
|
||||
} else {
|
||||
m_plugin->dispatcher(m_plugin, effSetProgram, 0, _len - 2, 0, 0);
|
||||
currProgram = _len - 1;
|
||||
if( isInitialized() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char presName[64];
|
||||
sprintf( presName, " %d/%d: %s", currProgram, m_plugin->numPrograms, presetName() );
|
||||
if( program < 0 )
|
||||
{
|
||||
program = 0;
|
||||
}
|
||||
else if( program >= m_plugin->numPrograms )
|
||||
{
|
||||
program = m_plugin->numPrograms - 1;
|
||||
}
|
||||
pluginDispatch( effSetProgram, 0, program );
|
||||
|
||||
sendMessage( message( IdVstPluginPresetString ).addString( presName ) );
|
||||
sendCurrentProgramName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::loadPrograms( int _len )
|
||||
void RemoteVstPlugin::rotateProgram( int offset )
|
||||
{
|
||||
if( isInitialized() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int newProgram = pluginDispatch( effGetProgram ) + offset;
|
||||
|
||||
if( newProgram < 0 )
|
||||
{
|
||||
newProgram = 0;
|
||||
}
|
||||
else if( newProgram >= m_plugin->numPrograms )
|
||||
{
|
||||
newProgram = m_plugin->numPrograms - 1;
|
||||
}
|
||||
pluginDispatch( effSetProgram, 0, newProgram );
|
||||
|
||||
sendCurrentProgramName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::getProgramNames()
|
||||
{
|
||||
char presName[1024+256*30];
|
||||
char curProgName[30];
|
||||
@@ -917,7 +962,7 @@ void RemoteVstPlugin::loadPrograms( int _len )
|
||||
}
|
||||
} else sprintf( presName, "%s", presetName() );
|
||||
|
||||
sendMessage( message( IdVstPluginPresetsString ).addString( presName ) );
|
||||
sendMessage( message( IdVstProgramNames ).addString( presName ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1034,7 +1079,7 @@ void RemoteVstPlugin::savePreset( const std::string & _file )
|
||||
|
||||
|
||||
|
||||
void RemoteVstPlugin::loadChunkFromPresetFile( const std::string & _file )
|
||||
void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
{
|
||||
void * chunk = NULL;
|
||||
unsigned int * pLen = new unsigned int[ 1 ];
|
||||
@@ -1048,7 +1093,7 @@ void RemoteVstPlugin::loadChunkFromPresetFile( const std::string & _file )
|
||||
float * pFloat;
|
||||
|
||||
if (m_plugin->uniqueID != pBank->fxID) {
|
||||
sendMessage( message( IdVstPluginPresetString ).
|
||||
sendMessage( message( IdVstCurrentProgramName ).
|
||||
addString( "Error: Plugin UniqID not match" ) );
|
||||
fclose( stream );
|
||||
delete[] (unsigned int*)pLen;
|
||||
@@ -1106,11 +1151,8 @@ void RemoteVstPlugin::loadChunkFromPresetFile( const std::string & _file )
|
||||
fclose( stream );
|
||||
}
|
||||
}
|
||||
char presName[64];
|
||||
int currProgram = m_plugin->dispatcher(m_plugin, effGetProgram, 0, 0, 0, 0) + 1;
|
||||
sprintf( presName, " %d/%d: %s", currProgram, m_plugin->numPrograms, presetName() );
|
||||
|
||||
sendMessage( message( IdVstPluginPresetString ).addString( presName ) );
|
||||
sendCurrentProgramName();
|
||||
|
||||
delete[] (unsigned int*)pLen;
|
||||
delete[] (sBank*)pBank;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* VstPlugin.cpp - implementation of VstPlugin class
|
||||
*
|
||||
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -88,8 +88,8 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
|
||||
m_version( 0 ),
|
||||
m_vendorString(),
|
||||
m_productString(),
|
||||
m_presetString(),
|
||||
m_presetsString(),
|
||||
m_currentProgramName(),
|
||||
m_allProgramNames(),
|
||||
p_name()
|
||||
{
|
||||
setSplittedChannels( true );
|
||||
@@ -406,12 +406,12 @@ bool VstPlugin::processMessage( const message & _m )
|
||||
m_productString = _m.getQString();
|
||||
break;
|
||||
|
||||
case IdVstPluginPresetString:
|
||||
m_presetString = _m.getQString();
|
||||
case IdVstCurrentProgramName:
|
||||
m_currentProgramName = _m.getQString();
|
||||
break;
|
||||
|
||||
case IdVstPluginPresetsString:
|
||||
m_presetsString = _m.getQString();
|
||||
case IdVstProgramNames:
|
||||
m_allProgramNames = _m.getQString();
|
||||
break;
|
||||
|
||||
case IdVstPluginUniqueID:
|
||||
@@ -457,12 +457,12 @@ void VstPlugin::openPreset( )
|
||||
!ofd.selectedFiles().isEmpty() )
|
||||
{
|
||||
lock();
|
||||
sendMessage( message( IdLoadChunkFromPresetFile ).
|
||||
sendMessage( message( IdLoadPresetFile ).
|
||||
addString(
|
||||
QSTR_TO_STDSTR(
|
||||
QDir::toNativeSeparators( ofd.selectedFiles()[0] ) ) )
|
||||
);
|
||||
waitForMessage( IdLoadChunkFromPresetFile );
|
||||
waitForMessage( IdLoadPresetFile );
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
@@ -470,24 +470,33 @@ void VstPlugin::openPreset( )
|
||||
|
||||
|
||||
|
||||
void VstPlugin::rollPreset( int step )
|
||||
void VstPlugin::setProgram( int index )
|
||||
{
|
||||
lock();
|
||||
sendMessage( message( IdRotateProgram ).
|
||||
addInt( step ) );
|
||||
waitForMessage( IdRotateProgram );
|
||||
sendMessage( message( IdVstSetProgram ).addInt( index ) );
|
||||
waitForMessage( IdVstSetProgram );
|
||||
unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void VstPlugin::loadPrograms( int step )
|
||||
void VstPlugin::rotateProgram( int offset )
|
||||
{
|
||||
lock();
|
||||
sendMessage( message( IdLoadPrograms ).
|
||||
addInt( step ) );
|
||||
waitForMessage( IdLoadPrograms );
|
||||
sendMessage( message( IdVstRotateProgram ).addInt( offset ) );
|
||||
waitForMessage( IdVstRotateProgram );
|
||||
unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void VstPlugin::loadProgramNames()
|
||||
{
|
||||
lock();
|
||||
sendMessage( message( IdVstProgramNames ) );
|
||||
waitForMessage( IdVstProgramNames );
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -496,7 +505,7 @@ void VstPlugin::loadPrograms( int step )
|
||||
|
||||
void VstPlugin::savePreset( )
|
||||
{
|
||||
QString presName = this->presetString() == "" ? tr(": default"): this->presetString();
|
||||
QString presName = currentProgramName().isEmpty() ? tr(": default") : currentProgramName();
|
||||
presName.replace(tr("\""), tr("'")); // QFileDialog unable to handle double quotes properly
|
||||
|
||||
QFileDialog sfd( NULL, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"),
|
||||
@@ -519,12 +528,12 @@ void VstPlugin::savePreset( )
|
||||
fns = fns + tr(".fxb");
|
||||
else fns = fns.left(fns.length() - 4) + (fns.right( 4 )).toLower();
|
||||
lock();
|
||||
sendMessage( message( IdSavePreset ).
|
||||
sendMessage( message( IdSavePresetFile ).
|
||||
addString(
|
||||
QSTR_TO_STDSTR(
|
||||
QDir::toNativeSeparators( fns ) ) )
|
||||
);
|
||||
waitForMessage( IdSavePreset );
|
||||
waitForMessage( IdSavePresetFile );
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
@@ -535,8 +544,8 @@ void VstPlugin::savePreset( )
|
||||
void VstPlugin::setParam( int i, float f )
|
||||
{
|
||||
lock();
|
||||
sendMessage( message( IdSetParameter ).addInt( i ).addFloat( f ) );
|
||||
waitForMessage( IdSetParameter );
|
||||
sendMessage( message( IdVstSetParameter ).addInt( i ).addFloat( f ) );
|
||||
waitForMessage( IdVstSetParameter );
|
||||
unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* VstPlugin.h - declaration of VstPlugin class
|
||||
*
|
||||
* Copyright (c) 2005-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -75,16 +75,18 @@ public:
|
||||
return m_productString;
|
||||
}
|
||||
|
||||
inline const QString & presetString() const
|
||||
inline const QString& currentProgramName() const
|
||||
{
|
||||
return m_presetString;
|
||||
return m_currentProgramName;
|
||||
}
|
||||
|
||||
inline const QString & presetsString() const
|
||||
inline const QString& allProgramNames() const
|
||||
{
|
||||
return m_presetsString;
|
||||
return m_allProgramNames;
|
||||
}
|
||||
|
||||
int currentProgram();
|
||||
|
||||
const QMap<QString, QString> & parameterDump();
|
||||
void setParameterDump( const QMap<QString, QString> & _pdump );
|
||||
|
||||
@@ -114,8 +116,9 @@ public slots:
|
||||
void setTempo( bpm_t _bpm );
|
||||
void updateSampleRate();
|
||||
void openPreset( void );
|
||||
void rollPreset( int step );
|
||||
void loadPrograms( int step );
|
||||
void setProgram( int index );
|
||||
void rotateProgram( int offset );
|
||||
void loadProgramNames();
|
||||
void savePreset( void );
|
||||
void setParam( int i, float f );
|
||||
|
||||
@@ -135,8 +138,8 @@ private:
|
||||
Sint32 m_version;
|
||||
QString m_vendorString;
|
||||
QString m_productString;
|
||||
QString m_presetString;
|
||||
QString m_presetsString;
|
||||
QString m_currentProgramName;
|
||||
QString m_allProgramNames;
|
||||
|
||||
QString p_name;
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@ enum VstRemoteMessageIDs
|
||||
IdVstGetParameterDump,
|
||||
IdVstSetParameterDump,
|
||||
IdVstGetParameterProperties,
|
||||
IdVstProgramNames,
|
||||
IdVstCurrentProgramName,
|
||||
IdVstSetProgram,
|
||||
IdVstRotateProgram,
|
||||
|
||||
// remoteVstPlugin -> vstPlugin
|
||||
IdVstFailedLoadingPlugin,
|
||||
@@ -74,9 +78,9 @@ enum VstRemoteMessageIDs
|
||||
IdVstPluginVersion,
|
||||
IdVstPluginVendorString,
|
||||
IdVstPluginProductString,
|
||||
IdVstPluginPresetString,
|
||||
IdVstPluginPresetsString,
|
||||
IdVstPluginUniqueID,
|
||||
IdVstSetParameter,
|
||||
IdVstParameterCount,
|
||||
IdVstParameterDump,
|
||||
IdVstParameterProperties
|
||||
|
||||
@@ -170,7 +170,7 @@ void VstEffectControls::savePreset( void )
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
m_effect->m_plugin->savePreset( );
|
||||
/* bool converted;
|
||||
QString str = m_vi->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_vi->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
QWidget::update();*/
|
||||
@@ -185,11 +185,12 @@ void VstEffectControls::updateMenu( void )
|
||||
{
|
||||
|
||||
// get all presets -
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
m_effect->m_plugin->loadPrograms( 1 );
|
||||
if ( m_effect->m_plugin != NULL )
|
||||
{
|
||||
m_effect->m_plugin->loadProgramNames();
|
||||
///QWidget::update();
|
||||
|
||||
QString str = m_effect->m_plugin->presetsString();
|
||||
QString str = m_effect->m_plugin->allProgramNames();
|
||||
|
||||
QStringList list1 = str.split("|");
|
||||
|
||||
@@ -223,7 +224,7 @@ void VstEffectControls::openPreset( void )
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
m_effect->m_plugin->openPreset( );
|
||||
bool converted;
|
||||
QString str = m_effect->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_effect->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
//QWidget::update();
|
||||
@@ -238,9 +239,9 @@ void VstEffectControls::rollPreset( void )
|
||||
{
|
||||
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
m_effect->m_plugin->rollPreset( 1 );
|
||||
m_effect->m_plugin->rotateProgram( 1 );
|
||||
bool converted;
|
||||
QString str = m_effect->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_effect->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
//QWidget::update();
|
||||
@@ -254,9 +255,9 @@ void VstEffectControls::rolrPreset( void )
|
||||
{
|
||||
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
m_effect->m_plugin->rollPreset( -1 );
|
||||
m_effect->m_plugin->rotateProgram( -1 );
|
||||
bool converted;
|
||||
QString str = m_effect->m_plugin->presetString().section("/", 0, 0);
|
||||
QString str = m_effect->m_plugin->currentProgramName().section("/", 0, 0);
|
||||
if (str != "")
|
||||
lastPosInMenu = str.toInt(&converted, 10) - 1;
|
||||
//QWidget::update();
|
||||
@@ -273,7 +274,7 @@ void VstEffectControls::selPreset( void )
|
||||
if (action)
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
lastPosInMenu = action->data().toInt();
|
||||
m_effect->m_plugin->rollPreset( lastPosInMenu + 2 );
|
||||
m_effect->m_plugin->setProgram( lastPosInMenu );
|
||||
//QWidget::update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* RemoteZynAddSubFx.cpp - ZynAddSubFx-embedding plugin
|
||||
*
|
||||
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
case IdShowUI:
|
||||
case IdHideUI:
|
||||
case IdLoadSettingsFromFile:
|
||||
case IdLoadPresetFromFile:
|
||||
case IdLoadPresetFile:
|
||||
pthread_mutex_lock( &m_guiMutex );
|
||||
m_guiMessages.push( _m );
|
||||
pthread_mutex_unlock( &m_guiMutex );
|
||||
@@ -221,7 +221,7 @@ void RemoteZynAddSubFx::guiThread()
|
||||
break;
|
||||
}
|
||||
|
||||
case IdLoadPresetFromFile:
|
||||
case IdLoadPresetFile:
|
||||
{
|
||||
LocalZynAddSubFx::loadPreset( m.getString(), ui ?
|
||||
ui->npartcounter->value()-1 : 0 );
|
||||
@@ -232,7 +232,7 @@ void RemoteZynAddSubFx::guiThread()
|
||||
ui->refresh_master_ui();
|
||||
}
|
||||
pthread_mutex_lock( &m_master->mutex );
|
||||
sendMessage( IdLoadPresetFromFile );
|
||||
sendMessage( IdLoadPresetFile );
|
||||
pthread_mutex_unlock( &m_master->mutex );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -290,8 +290,8 @@ void ZynAddSubFxInstrument::loadFile( const QString & _file )
|
||||
{
|
||||
m_remotePlugin->lock();
|
||||
m_remotePlugin->sendMessage(
|
||||
RemotePlugin::message( IdLoadPresetFromFile ).addString( fn ) );
|
||||
m_remotePlugin->waitForMessage( IdLoadPresetFromFile );
|
||||
RemotePlugin::message( IdLoadPresetFile ).addString( fn ) );
|
||||
m_remotePlugin->waitForMessage( IdLoadPresetFile );
|
||||
m_remotePlugin->unlock();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user