Merge branch 'stable-1.2'
# Conflicts:
# .travis/osx..install.sh
# .travis/osx..script.sh
# cmake/linux/package_linux.sh.in
# data/locale/en.ts
# src/core/CMakeLists.txt
# src/core/ProjectRenderer.cpp
# src/gui/FileBrowser.cpp
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "VstEffect.h"
|
||||
|
||||
#include "GuiApplication.h"
|
||||
#include "Song.h"
|
||||
#include "TextFloat.h"
|
||||
#include "VstSubPluginFeatures.h"
|
||||
@@ -122,10 +124,14 @@ bool VstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
|
||||
|
||||
void VstEffect::openPlugin( const QString & _plugin )
|
||||
{
|
||||
TextFloat * tf = TextFloat::displayMessage(
|
||||
VstPlugin::tr( "Loading plugin" ),
|
||||
VstPlugin::tr( "Please wait while loading VST plugin..." ),
|
||||
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
|
||||
TextFloat * tf = NULL;
|
||||
if( gui )
|
||||
{
|
||||
tf = TextFloat::displayMessage(
|
||||
VstPlugin::tr( "Loading plugin" ),
|
||||
VstPlugin::tr( "Please wait while loading VST plugin..." ),
|
||||
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
|
||||
}
|
||||
|
||||
QMutexLocker ml( &m_pluginMutex ); Q_UNUSED( ml );
|
||||
m_plugin = QSharedPointer<VstPlugin>(new VstPlugin( _plugin ));
|
||||
|
||||
@@ -192,7 +192,10 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
|
||||
_ctl->m_selPresetButton->setWhatsThis(
|
||||
tr( "Click here to select presets that are currently loaded in VST." ) );
|
||||
|
||||
_ctl->m_selPresetButton->setMenu(_ctl->menu);
|
||||
QMenu * menu = new QMenu;
|
||||
connect( menu, SIGNAL( aboutToShow() ), _ctl, SLOT( updateMenu() ) );
|
||||
|
||||
_ctl->m_selPresetButton->setMenu(menu);
|
||||
|
||||
_ctl->m_selPresetButton->setMinimumWidth( 16 );
|
||||
_ctl->m_selPresetButton->setMaximumWidth( 16 );
|
||||
|
||||
@@ -39,13 +39,10 @@ VstEffectControls::VstEffectControls( VstEffect * _eff ) :
|
||||
m_effect( _eff ),
|
||||
m_subWindow( NULL ),
|
||||
knobFModel( NULL ),
|
||||
vstKnobs( NULL ),
|
||||
ctrHandle( NULL ),
|
||||
lastPosInMenu (0)
|
||||
// m_presetLabel ( NULL )
|
||||
{
|
||||
menu = new QMenu;
|
||||
connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -72,19 +69,13 @@ void VstEffectControls::loadSettings( const QDomElement & _this )
|
||||
const QMap<QString, QString> & dump = m_effect->m_plugin->parameterDump();
|
||||
paramCount = dump.size();
|
||||
char paramStr[35];
|
||||
vstKnobs = new Knob *[ paramCount ];
|
||||
knobFModel = new FloatModel *[ paramCount ];
|
||||
QStringList s_dumpValues;
|
||||
QWidget * widget = new QWidget();
|
||||
for( int i = 0; i < paramCount; i++ )
|
||||
{
|
||||
sprintf( paramStr, "param%d", i );
|
||||
s_dumpValues = dump[ paramStr ].split( ":" );
|
||||
|
||||
vstKnobs[i] = new Knob( knobBright_26, widget, s_dumpValues.at( 1 ) );
|
||||
vstKnobs[i]->setHintText( s_dumpValues.at( 1 ) + ":", "" );
|
||||
vstKnobs[i]->setLabel( s_dumpValues.at( 1 ).left( 15 ) );
|
||||
|
||||
knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) );
|
||||
knobFModel[i]->loadSettings( _this, paramStr );
|
||||
|
||||
@@ -96,8 +87,6 @@ void VstEffectControls::loadSettings( const QDomElement & _this )
|
||||
}
|
||||
|
||||
connect( knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
|
||||
vstKnobs[i]->setModel( knobFModel[i] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -358,37 +347,35 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls *
|
||||
const QMap<QString, QString> & dump = m_effect->m_plugin->parameterDump();
|
||||
m_vi->paramCount = dump.size();
|
||||
|
||||
bool isVstKnobs = true;
|
||||
vstKnobs = new Knob *[ m_vi->paramCount ];
|
||||
|
||||
|
||||
if (m_vi->vstKnobs == NULL) {
|
||||
m_vi->vstKnobs = new Knob *[ m_vi->paramCount ];
|
||||
isVstKnobs = false;
|
||||
}
|
||||
bool hasKnobModel = true;
|
||||
if (m_vi->knobFModel == NULL) {
|
||||
m_vi->knobFModel = new FloatModel *[ m_vi->paramCount ];
|
||||
hasKnobModel = false;
|
||||
}
|
||||
|
||||
char paramStr[35];
|
||||
QStringList s_dumpValues;
|
||||
|
||||
if (isVstKnobs == false) {
|
||||
for( int i = 0; i < m_vi->paramCount; i++ )
|
||||
for( int i = 0; i < m_vi->paramCount; i++ )
|
||||
{
|
||||
sprintf( paramStr, "param%d", i);
|
||||
s_dumpValues = dump[ paramStr ].split( ":" );
|
||||
|
||||
vstKnobs[ i ] = new Knob( knobBright_26, widget, s_dumpValues.at( 1 ) );
|
||||
vstKnobs[ i ]->setHintText( s_dumpValues.at( 1 ) + ":", "" );
|
||||
vstKnobs[ i ]->setLabel( s_dumpValues.at( 1 ).left( 15 ) );
|
||||
|
||||
if( !hasKnobModel )
|
||||
{
|
||||
sprintf( paramStr, "param%d", i);
|
||||
s_dumpValues = dump[ paramStr ].split( ":" );
|
||||
|
||||
m_vi->vstKnobs[ i ] = new Knob( knobBright_26, widget, s_dumpValues.at( 1 ) );
|
||||
m_vi->vstKnobs[ i ]->setHintText( s_dumpValues.at( 1 ) + ":", "" );
|
||||
m_vi->vstKnobs[ i ]->setLabel( s_dumpValues.at( 1 ).left( 15 ) );
|
||||
|
||||
sprintf( paramStr, "%d", i);
|
||||
m_vi->knobFModel[ i ] = new FloatModel( ( s_dumpValues.at( 2 ) ).toFloat(),
|
||||
0.0f, 1.0f, 0.01f, _eff, tr( paramStr ) );
|
||||
connect( m_vi->knobFModel[ i ], SIGNAL( dataChanged() ), this,
|
||||
SLOT( setParameter() ) );
|
||||
m_vi->vstKnobs[ i ] ->setModel( m_vi->knobFModel[ i ] );
|
||||
}
|
||||
connect( m_vi->knobFModel[ i ], SIGNAL( dataChanged() ), this,
|
||||
SLOT( setParameter() ) );
|
||||
vstKnobs[ i ] ->setModel( m_vi->knobFModel[ i ] );
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
@@ -398,7 +385,7 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls *
|
||||
{
|
||||
if( i < m_vi->paramCount )
|
||||
{
|
||||
l->addWidget( m_vi->vstKnobs[i], lrow, lcolumn, Qt::AlignCenter );
|
||||
l->addWidget( vstKnobs[i], lrow, lcolumn, Qt::AlignCenter );
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -466,12 +453,12 @@ void manageVSTEffectView::displayAutomatedOnly( void )
|
||||
if( !( m_vi2->knobFModel[ i ]->isAutomated() ||
|
||||
m_vi2->knobFModel[ i ]->controllerConnection() ) )
|
||||
{
|
||||
if( m_vi2->vstKnobs[ i ]->isVisible() == true && isAuto )
|
||||
if( vstKnobs[ i ]->isVisible() == true && isAuto )
|
||||
{
|
||||
m_vi2->vstKnobs[ i ]->hide();
|
||||
vstKnobs[ i ]->hide();
|
||||
m_displayAutomatedOnly->setText( "All" );
|
||||
} else {
|
||||
m_vi2->vstKnobs[ i ]->show();
|
||||
vstKnobs[ i ]->show();
|
||||
m_displayAutomatedOnly->setText( "Automated" );
|
||||
}
|
||||
}
|
||||
@@ -502,14 +489,14 @@ manageVSTEffectView::~manageVSTEffectView()
|
||||
for( int i = 0; i < m_vi2->paramCount; i++ )
|
||||
{
|
||||
delete m_vi2->knobFModel[ i ];
|
||||
delete m_vi2->vstKnobs[ i ];
|
||||
delete vstKnobs[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
if( m_vi2->vstKnobs != NULL )
|
||||
if( vstKnobs != NULL )
|
||||
{
|
||||
delete [] m_vi2->vstKnobs;
|
||||
m_vi2->vstKnobs = NULL;
|
||||
delete [] vstKnobs;
|
||||
vstKnobs = NULL;
|
||||
}
|
||||
|
||||
if( m_vi2->knobFModel != NULL )
|
||||
|
||||
@@ -82,12 +82,10 @@ private:
|
||||
VstEffect * m_effect;
|
||||
|
||||
QPushButton * m_selPresetButton;
|
||||
QMenu *menu;
|
||||
|
||||
QMdiSubWindow * m_subWindow;
|
||||
QScrollArea * m_scrollArea;
|
||||
FloatModel ** knobFModel;
|
||||
Knob ** vstKnobs;
|
||||
int paramCount;
|
||||
|
||||
QObject * ctrHandle;
|
||||
@@ -133,6 +131,7 @@ private:
|
||||
QPushButton * m_syncButton;
|
||||
QPushButton * m_displayAutomatedOnly;
|
||||
QPushButton * m_closeButton;
|
||||
Knob ** vstKnobs;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -84,7 +84,6 @@ vestigeInstrument::vestigeInstrument( InstrumentTrack * _instrument_track ) :
|
||||
m_pluginMutex(),
|
||||
m_subWindow( NULL ),
|
||||
m_scrollArea( NULL ),
|
||||
vstKnobs( NULL ),
|
||||
knobFModel( NULL ),
|
||||
p_subWindow( NULL )
|
||||
{
|
||||
@@ -132,19 +131,13 @@ void vestigeInstrument::loadSettings( const QDomElement & _this )
|
||||
const QMap<QString, QString> & dump = m_plugin->parameterDump();
|
||||
paramCount = dump.size();
|
||||
char paramStr[35];
|
||||
vstKnobs = new Knob *[ paramCount ];
|
||||
knobFModel = new FloatModel *[ paramCount ];
|
||||
QStringList s_dumpValues;
|
||||
QWidget * widget = new QWidget();
|
||||
for( int i = 0; i < paramCount; i++ )
|
||||
{
|
||||
sprintf( paramStr, "param%d", i );
|
||||
s_dumpValues = dump[ paramStr ].split( ":" );
|
||||
|
||||
vstKnobs[i] = new Knob( knobBright_26, widget, s_dumpValues.at( 1 ) );
|
||||
vstKnobs[i]->setHintText( s_dumpValues.at( 1 ) + ":", "" );
|
||||
vstKnobs[i]->setLabel( s_dumpValues.at( 1 ).left( 15 ) );
|
||||
|
||||
knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) );
|
||||
knobFModel[i]->loadSettings( _this, paramStr );
|
||||
|
||||
@@ -155,8 +148,6 @@ void vestigeInstrument::loadSettings( const QDomElement & _this )
|
||||
}
|
||||
|
||||
connect( knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
|
||||
vstKnobs[i]->setModel( knobFModel[i] );
|
||||
}
|
||||
}
|
||||
m_pluginMutex.unlock();
|
||||
@@ -267,10 +258,14 @@ void vestigeInstrument::loadFile( const QString & _file )
|
||||
closePlugin();
|
||||
}
|
||||
m_pluginDLL = SampleBuffer::tryToMakeRelative( _file );
|
||||
TextFloat * tf = TextFloat::displayMessage(
|
||||
tr( "Loading plugin" ),
|
||||
tr( "Please wait while loading VST-plugin..." ),
|
||||
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
|
||||
TextFloat * tf = NULL;
|
||||
if( gui )
|
||||
{
|
||||
tf = TextFloat::displayMessage(
|
||||
tr( "Loading plugin" ),
|
||||
tr( "Please wait while loading VST-plugin..." ),
|
||||
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
|
||||
}
|
||||
|
||||
m_pluginMutex.lock();
|
||||
m_plugin = new VstPlugin( m_pluginDLL );
|
||||
@@ -348,16 +343,9 @@ void vestigeInstrument::closePlugin( void )
|
||||
for( int i = 0; i < paramCount; i++ )
|
||||
{
|
||||
delete knobFModel[ i ];
|
||||
delete vstKnobs[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
if( vstKnobs != NULL )
|
||||
{
|
||||
delete [] vstKnobs;
|
||||
vstKnobs = NULL;
|
||||
}
|
||||
|
||||
if( knobFModel != NULL )
|
||||
{
|
||||
delete [] knobFModel;
|
||||
@@ -921,35 +909,34 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume
|
||||
const QMap<QString, QString> & dump = m_vi->m_plugin->parameterDump();
|
||||
m_vi->paramCount = dump.size();
|
||||
|
||||
bool isVstKnobs = true;
|
||||
vstKnobs = new Knob *[ m_vi->paramCount ];
|
||||
|
||||
if (m_vi->vstKnobs == NULL) {
|
||||
m_vi->vstKnobs = new Knob *[ m_vi->paramCount ];
|
||||
isVstKnobs = false;
|
||||
}
|
||||
bool hasKnobModel = true;
|
||||
if (m_vi->knobFModel == NULL) {
|
||||
m_vi->knobFModel = new FloatModel *[ m_vi->paramCount ];
|
||||
hasKnobModel = false;
|
||||
}
|
||||
|
||||
char paramStr[35];
|
||||
QStringList s_dumpValues;
|
||||
|
||||
if (isVstKnobs == false) {
|
||||
for( int i = 0; i < m_vi->paramCount; i++ )
|
||||
for( int i = 0; i < m_vi->paramCount; i++ )
|
||||
{
|
||||
sprintf( paramStr, "param%d", i);
|
||||
s_dumpValues = dump[ paramStr ].split( ":" );
|
||||
|
||||
vstKnobs[ i ] = new Knob( knobBright_26, this, s_dumpValues.at( 1 ) );
|
||||
vstKnobs[ i ]->setHintText( s_dumpValues.at( 1 ) + ":", "" );
|
||||
vstKnobs[ i ]->setLabel( s_dumpValues.at( 1 ).left( 15 ) );
|
||||
|
||||
if( !hasKnobModel )
|
||||
{
|
||||
sprintf( paramStr, "param%d", i);
|
||||
s_dumpValues = dump[ paramStr ].split( ":" );
|
||||
|
||||
m_vi->vstKnobs[ i ] = new Knob( knobBright_26, this, s_dumpValues.at( 1 ) );
|
||||
m_vi->vstKnobs[ i ]->setHintText( s_dumpValues.at( 1 ) + ":", "" );
|
||||
m_vi->vstKnobs[ i ]->setLabel( s_dumpValues.at( 1 ).left( 15 ) );
|
||||
|
||||
sprintf( paramStr, "%d", i);
|
||||
m_vi->knobFModel[ i ] = new FloatModel( (s_dumpValues.at( 2 )).toFloat(),
|
||||
0.0f, 1.0f, 0.01f, castModel<vestigeInstrument>(), tr( paramStr ) );
|
||||
connect( m_vi->knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
m_vi->vstKnobs[i] ->setModel( m_vi->knobFModel[i] );
|
||||
}
|
||||
connect( m_vi->knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
vstKnobs[i] ->setModel( m_vi->knobFModel[i] );
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
@@ -959,7 +946,7 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume
|
||||
{
|
||||
if( i < m_vi->paramCount )
|
||||
{
|
||||
l->addWidget( m_vi->vstKnobs[i], lrow, lcolumn, Qt::AlignCenter );
|
||||
l->addWidget( vstKnobs[i], lrow, lcolumn, Qt::AlignCenter );
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -1025,12 +1012,12 @@ void manageVestigeInstrumentView::displayAutomatedOnly( void )
|
||||
|
||||
if( !( m_vi->knobFModel[ i ]->isAutomated() || m_vi->knobFModel[ i ]->controllerConnection() ) )
|
||||
{
|
||||
if( m_vi->vstKnobs[ i ]->isVisible() == true && isAuto )
|
||||
if( vstKnobs[ i ]->isVisible() == true && isAuto )
|
||||
{
|
||||
m_vi->vstKnobs[ i ]->hide();
|
||||
vstKnobs[ i ]->hide();
|
||||
m_displayAutomatedOnly->setText( "All" );
|
||||
} else {
|
||||
m_vi->vstKnobs[ i ]->show();
|
||||
vstKnobs[ i ]->show();
|
||||
m_displayAutomatedOnly->setText( "Automated" );
|
||||
}
|
||||
}
|
||||
@@ -1045,13 +1032,13 @@ manageVestigeInstrumentView::~manageVestigeInstrumentView()
|
||||
for( int i = 0; i < m_vi->paramCount; i++ )
|
||||
{
|
||||
delete m_vi->knobFModel[ i ];
|
||||
delete m_vi->vstKnobs[ i ];
|
||||
delete vstKnobs[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
if (m_vi->vstKnobs != NULL) {
|
||||
delete []m_vi->vstKnobs;
|
||||
m_vi->vstKnobs = NULL;
|
||||
if (vstKnobs != NULL) {
|
||||
delete []vstKnobs;
|
||||
vstKnobs = NULL;
|
||||
}
|
||||
|
||||
if( m_vi->knobFModel != NULL )
|
||||
|
||||
@@ -87,7 +87,6 @@ private:
|
||||
QString m_pluginDLL;
|
||||
QMdiSubWindow * m_subWindow;
|
||||
QScrollArea * m_scrollArea;
|
||||
Knob ** vstKnobs;
|
||||
FloatModel ** knobFModel;
|
||||
QObject * p_subWindow;
|
||||
int paramCount;
|
||||
@@ -130,6 +129,7 @@ private:
|
||||
QPushButton * m_syncButton;
|
||||
QPushButton * m_displayAutomatedOnly;
|
||||
QPushButton * m_closeButton;
|
||||
Knob ** vstKnobs;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ static VstHostLanguages hlang = LanguageEnglish;
|
||||
static bool EMBED = false;
|
||||
static bool EMBED_X11 = false;
|
||||
static bool EMBED_WIN32 = false;
|
||||
static bool HEADLESS = false;
|
||||
|
||||
class RemoteVstPlugin;
|
||||
|
||||
@@ -237,21 +238,16 @@ public:
|
||||
// has to be called as soon as input- or output-count changes
|
||||
void updateInOutCount();
|
||||
|
||||
inline void lock()
|
||||
{
|
||||
pthread_mutex_lock( &m_pluginLock );
|
||||
}
|
||||
|
||||
inline void unlock()
|
||||
{
|
||||
pthread_mutex_unlock( &m_pluginLock );
|
||||
}
|
||||
|
||||
inline void lockShm()
|
||||
{
|
||||
pthread_mutex_lock( &m_shmLock );
|
||||
}
|
||||
|
||||
inline bool tryLockShm()
|
||||
{
|
||||
return pthread_mutex_trylock( &m_shmLock ) == 0;
|
||||
}
|
||||
|
||||
inline void unlockShm()
|
||||
{
|
||||
pthread_mutex_unlock( &m_shmLock );
|
||||
@@ -318,22 +314,8 @@ private:
|
||||
|
||||
bool load( const std::string & _plugin_file );
|
||||
|
||||
// thread-safe dispatching of plugin
|
||||
int pluginDispatch( int cmd, int param1 = 0, int param2 = 0,
|
||||
void * p = NULL, float f = 0 )
|
||||
{
|
||||
int ret = 0;
|
||||
lock();
|
||||
if( m_plugin )
|
||||
{
|
||||
ret = m_plugin->dispatcher( m_plugin, cmd, param1, param2, p, f );
|
||||
}
|
||||
unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// thread-safe dispatching of plugin
|
||||
int pluginDispatchNoLocking( int cmd, int param1 = 0, int param2 = 0, void * p = NULL, float f = 0 )
|
||||
{
|
||||
if( m_plugin )
|
||||
{
|
||||
@@ -354,9 +336,7 @@ private:
|
||||
int m_windowHeight;
|
||||
|
||||
bool m_initialized;
|
||||
bool m_registeredWindowClass;
|
||||
|
||||
pthread_mutex_t m_pluginLock;
|
||||
bool m_processing;
|
||||
|
||||
std::queue<message> m_messageList;
|
||||
@@ -407,8 +387,6 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) :
|
||||
m_windowWidth( 0 ),
|
||||
m_windowHeight( 0 ),
|
||||
m_initialized( false ),
|
||||
m_registeredWindowClass( false ),
|
||||
m_pluginLock(),
|
||||
m_processing( false ),
|
||||
m_messageList(),
|
||||
m_shouldGiveIdle( false ),
|
||||
@@ -424,7 +402,6 @@ RemoteVstPlugin::RemoteVstPlugin( const char * socketPath ) :
|
||||
m_shmID( -1 ),
|
||||
m_vstSyncData( NULL )
|
||||
{
|
||||
pthread_mutex_init( &m_pluginLock, NULL );
|
||||
pthread_mutex_init( &m_shmLock, NULL );
|
||||
|
||||
__plugin = this;
|
||||
@@ -518,7 +495,6 @@ RemoteVstPlugin::~RemoteVstPlugin()
|
||||
delete[] m_outputs;
|
||||
|
||||
pthread_mutex_destroy( &m_shmLock );
|
||||
pthread_mutex_destroy( &m_pluginLock );
|
||||
}
|
||||
|
||||
|
||||
@@ -623,9 +599,7 @@ 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;
|
||||
|
||||
@@ -660,12 +634,8 @@ void RemoteVstPlugin::init( const std::string & _plugin_file )
|
||||
}
|
||||
|
||||
updateInOutCount();
|
||||
|
||||
// some plugins have to set samplerate during init
|
||||
if( m_vstSyncData->hasSHM )
|
||||
{
|
||||
updateSampleRate();
|
||||
}
|
||||
updateBufferSize();
|
||||
updateSampleRate();
|
||||
|
||||
/* set program to zero */
|
||||
/* i comment this out because it breaks dfx Geometer
|
||||
@@ -718,7 +688,7 @@ static void close_check( int fd )
|
||||
|
||||
void RemoteVstPlugin::initEditor()
|
||||
{
|
||||
if( m_window || !( m_plugin->flags & effFlagsHasEditor ) )
|
||||
if( HEADLESS || m_window || !( m_plugin->flags & effFlagsHasEditor ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -732,27 +702,6 @@ void RemoteVstPlugin::initEditor()
|
||||
}
|
||||
|
||||
|
||||
if( !m_registeredWindowClass )
|
||||
{
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = DefWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInst;
|
||||
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
|
||||
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "LVSL";
|
||||
|
||||
if( !RegisterClass( &wc ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_registeredWindowClass = true;
|
||||
}
|
||||
|
||||
DWORD dwStyle;
|
||||
if (EMBED) {
|
||||
dwStyle = WS_POPUP | WS_SYSMENU | WS_BORDER;
|
||||
@@ -906,13 +855,14 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
|
||||
|
||||
// now we're ready to fetch sound from VST-plugin
|
||||
|
||||
lock();
|
||||
lockShm();
|
||||
if( !tryLockShm() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !isShmValid() )
|
||||
{
|
||||
unlockShm();
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -943,7 +893,6 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
|
||||
#endif
|
||||
|
||||
unlockShm();
|
||||
unlock();
|
||||
|
||||
m_currentSamplePos += bufferSize();
|
||||
}
|
||||
@@ -1050,8 +999,6 @@ void RemoteVstPlugin::sendCurrentProgramName()
|
||||
|
||||
void RemoteVstPlugin::getParameterDump()
|
||||
{
|
||||
lock();
|
||||
|
||||
message m( IdVstParameterDump );
|
||||
m.addInt( m_plugin->numParams );
|
||||
|
||||
@@ -1059,7 +1006,7 @@ void RemoteVstPlugin::getParameterDump()
|
||||
{
|
||||
char paramName[32];
|
||||
memset( paramName, 0, sizeof( paramName ) );
|
||||
pluginDispatchNoLocking( effGetParamName, i, 0, paramName );
|
||||
pluginDispatch( effGetParamName, i, 0, paramName );
|
||||
paramName[sizeof(paramName)-1] = 0;
|
||||
|
||||
m.addInt( i );
|
||||
@@ -1067,8 +1014,6 @@ void RemoteVstPlugin::getParameterDump()
|
||||
m.addFloat( m_plugin->getParameter( m_plugin, i ) );
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
||||
sendMessage( m );
|
||||
}
|
||||
|
||||
@@ -1077,7 +1022,6 @@ void RemoteVstPlugin::getParameterDump()
|
||||
|
||||
void RemoteVstPlugin::setParameterDump( const message & _m )
|
||||
{
|
||||
lock();
|
||||
const int n = _m.getInt( 0 );
|
||||
const int params = ( n > m_plugin->numParams ) ?
|
||||
m_plugin->numParams : n;
|
||||
@@ -1090,7 +1034,6 @@ void RemoteVstPlugin::setParameterDump( const message & _m )
|
||||
item.value = _m.getFloat( ++p );
|
||||
m_plugin->setParameter( m_plugin, item.index, item.value );
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -1243,14 +1186,12 @@ void RemoteVstPlugin::savePreset( const std::string & _file )
|
||||
chunk_size = m_plugin->numParams * sizeof( float );
|
||||
data = new char[ chunk_size ];
|
||||
unsigned int* toUIntArray = reinterpret_cast<unsigned int*>( data );
|
||||
lock();
|
||||
for ( int i = 0; i < m_plugin->numParams; i++ )
|
||||
{
|
||||
float value = m_plugin->getParameter( m_plugin, i );
|
||||
unsigned int * pValue = ( unsigned int * ) &value;
|
||||
toUIntArray[ i ] = endian_swap( *pValue );
|
||||
}
|
||||
unlock();
|
||||
} else chunk_size = (((m_plugin->numParams * sizeof( float )) + 56)*m_plugin->numPrograms);
|
||||
}
|
||||
|
||||
@@ -1296,14 +1237,12 @@ void RemoteVstPlugin::savePreset( const std::string & _file )
|
||||
pluginDispatch( effSetProgram, 0, j );
|
||||
pluginDispatch( effGetProgramName, 0, 0, pBank->prgName );
|
||||
fwrite ( pBank, 1, 56, stream );
|
||||
lock();
|
||||
for ( int i = 0; i < m_plugin->numParams; i++ )
|
||||
{
|
||||
value = m_plugin->getParameter( m_plugin, i );
|
||||
pValue = ( unsigned int * ) &value;
|
||||
toUIntArray[ i ] = endian_swap( *pValue );
|
||||
}
|
||||
unlock();
|
||||
fwrite ( data, 1, chunk_size, stream );
|
||||
}
|
||||
pluginDispatch( effSetProgram, 0, currProgram );
|
||||
@@ -1370,7 +1309,6 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
pluginDispatch( 24, 1, len, chunk );
|
||||
else
|
||||
{
|
||||
lock();
|
||||
unsigned int* toUIntArray = reinterpret_cast<unsigned int*>( chunk );
|
||||
for (int i = 0; i < pBank->numPrograms; i++ )
|
||||
{
|
||||
@@ -1378,7 +1316,6 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
pFloat = ( float* ) &toUInt;
|
||||
m_plugin->setParameter( m_plugin, i, *pFloat );
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
} else {
|
||||
if(pBank->fxMagic != 0x6B427846) {
|
||||
@@ -1389,7 +1326,6 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
int currProgram = pluginDispatch( effGetProgram );
|
||||
chunk = new char[ len = sizeof(float)*m_plugin->numParams ];
|
||||
toUIntArray = reinterpret_cast<unsigned int *>( chunk );
|
||||
lock();
|
||||
for (int i =0; i < numPrograms; i++) {
|
||||
if ( fread (pBank, 1, 56, stream) != 56 )
|
||||
{
|
||||
@@ -1410,7 +1346,6 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
|
||||
m_plugin->setParameter( m_plugin, j, *pFloat );
|
||||
}
|
||||
}
|
||||
unlock();
|
||||
pluginDispatch( effSetProgram, 0, currProgram );
|
||||
fclose( stream );
|
||||
}
|
||||
@@ -1542,7 +1477,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode,
|
||||
// value is 0 for input and != 0 otherwise. note: the
|
||||
// return value is 0 for <true> such that older versions
|
||||
// will always return true.
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
case audioMasterGetTime:
|
||||
SHOW_CALLBACK( "amc: audioMasterGetTime\n" );
|
||||
@@ -2062,6 +1997,29 @@ int main( int _argc, char * * _argv )
|
||||
}
|
||||
#endif
|
||||
|
||||
HMODULE hInst = GetModuleHandle( NULL );
|
||||
if( hInst == NULL )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
WNDCLASS wc;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = DefWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInst;
|
||||
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
|
||||
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = "LVSL";
|
||||
|
||||
if( !RegisterClass( &wc ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef SYNC_WITH_SHM_FIFO
|
||||
int embedMethodIndex = 3;
|
||||
@@ -2073,27 +2031,32 @@ int main( int _argc, char * * _argv )
|
||||
if ( embedMethod == "none" )
|
||||
{
|
||||
cerr << "Starting detached." << endl;
|
||||
EMBED = EMBED_X11 = EMBED_WIN32 = false;
|
||||
EMBED = EMBED_X11 = EMBED_WIN32 = HEADLESS = false;
|
||||
}
|
||||
else if ( embedMethod == "win32" )
|
||||
{
|
||||
cerr << "Starting using Win32-native embedding." << endl;
|
||||
EMBED = EMBED_WIN32 = true; EMBED_X11= false;
|
||||
EMBED = EMBED_WIN32 = true; EMBED_X11 = HEADLESS = false;
|
||||
}
|
||||
else if ( embedMethod == "qt" )
|
||||
{
|
||||
cerr << "Starting using Qt-native embedding." << endl;
|
||||
EMBED = true; EMBED_X11 = EMBED_WIN32 = false;
|
||||
EMBED = true; EMBED_X11 = EMBED_WIN32 = HEADLESS = false;
|
||||
}
|
||||
else if ( embedMethod == "xembed" )
|
||||
{
|
||||
cerr << "Starting using X11Embed protocol." << endl;
|
||||
EMBED = EMBED_X11 = true; EMBED_WIN32 = false;
|
||||
EMBED = EMBED_X11 = true; EMBED_WIN32 = HEADLESS = false;
|
||||
}
|
||||
else if ( embedMethod == "headless" )
|
||||
{
|
||||
cerr << "Starting without UI." << endl;
|
||||
HEADLESS = true; EMBED = EMBED_X11 = EMBED_WIN32 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Unknown embed method " << embedMethod << ". Starting detached instead." << endl;
|
||||
EMBED = EMBED_X11 = EMBED_WIN32 = false;
|
||||
EMBED = EMBED_X11 = EMBED_WIN32 = HEADLESS = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,9 @@ public:
|
||||
VstPlugin::VstPlugin( const QString & _plugin ) :
|
||||
m_plugin( _plugin ),
|
||||
m_pluginWindowID( 0 ),
|
||||
m_embedMethod( ConfigManager::inst()->vstEmbedMethod() ),
|
||||
m_embedMethod( gui
|
||||
? ConfigManager::inst()->vstEmbedMethod()
|
||||
: "headless" ),
|
||||
m_badDllFormat( false ),
|
||||
m_version( 0 ),
|
||||
m_currentProgram()
|
||||
@@ -306,6 +308,7 @@ void VstPlugin::updateSampleRate()
|
||||
lock();
|
||||
sendMessage( message( IdSampleRateInformation ).
|
||||
addInt( Engine::mixer()->processingSampleRate() ) );
|
||||
waitForMessage( IdInformationUpdated, true );
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -574,7 +577,7 @@ void VstPlugin::showUI()
|
||||
{
|
||||
RemotePlugin::showUI();
|
||||
}
|
||||
else
|
||||
else if ( m_embedMethod != "headless" )
|
||||
{
|
||||
if (! pluginWidget()) {
|
||||
createUI( NULL, false );
|
||||
|
||||
@@ -62,18 +62,11 @@ public:
|
||||
waitForMessage( IdInitDone );
|
||||
|
||||
pthread_mutex_init( &m_guiMutex, NULL );
|
||||
pthread_create( &m_guiThreadHandle, NULL, guiThread, this );
|
||||
pthread_create( &m_messageThreadHandle, NULL, messageLoop, this );
|
||||
}
|
||||
|
||||
virtual ~RemoteZynAddSubFx()
|
||||
{
|
||||
m_guiExit = true;
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
Sleep( m_guiSleepTime * 2 );
|
||||
#else
|
||||
usleep( m_guiSleepTime * 2 * 1000 );
|
||||
#endif
|
||||
|
||||
Nio::stop();
|
||||
}
|
||||
|
||||
@@ -87,7 +80,7 @@ public:
|
||||
LocalZynAddSubFx::setBufferSize( bufferSize() );
|
||||
}
|
||||
|
||||
void run()
|
||||
void messageLoop()
|
||||
{
|
||||
message m;
|
||||
while( ( m = receiveMessage() ).id != IdQuit )
|
||||
@@ -96,6 +89,7 @@ public:
|
||||
processMessage( m );
|
||||
pthread_mutex_unlock( &m_master->mutex );
|
||||
}
|
||||
m_guiExit = true;
|
||||
}
|
||||
|
||||
virtual bool processMessage( const message & _m )
|
||||
@@ -151,23 +145,22 @@ public:
|
||||
LocalZynAddSubFx::processAudio( _out );
|
||||
}
|
||||
|
||||
static void * guiThread( void * _arg )
|
||||
static void * messageLoop( void * _arg )
|
||||
{
|
||||
RemoteZynAddSubFx * _this =
|
||||
static_cast<RemoteZynAddSubFx *>( _arg );
|
||||
|
||||
_this->guiThread();
|
||||
_this->messageLoop();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void guiLoop();
|
||||
|
||||
private:
|
||||
void guiThread();
|
||||
|
||||
const int m_guiSleepTime;
|
||||
|
||||
pthread_t m_guiThreadHandle;
|
||||
pthread_t m_messageThreadHandle;
|
||||
pthread_mutex_t m_guiMutex;
|
||||
std::queue<RemotePluginClient::message> m_guiMessages;
|
||||
bool m_guiExit;
|
||||
@@ -177,7 +170,7 @@ private:
|
||||
|
||||
|
||||
|
||||
void RemoteZynAddSubFx::guiThread()
|
||||
void RemoteZynAddSubFx::guiLoop()
|
||||
{
|
||||
int exitProgram = 0;
|
||||
MasterUI * ui = NULL;
|
||||
@@ -292,7 +285,7 @@ int main( int _argc, char * * _argv )
|
||||
RemoteZynAddSubFx * remoteZASF = new RemoteZynAddSubFx( _argv[1] );
|
||||
#endif
|
||||
|
||||
remoteZASF->run();
|
||||
remoteZASF->guiLoop();
|
||||
|
||||
delete remoteZASF;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user