configurable ladspa path

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@300 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Danny McRae
2006-08-10 18:29:30 +00:00
parent 2000733293
commit f006481333
6 changed files with 140 additions and 7 deletions

View File

@@ -1,4 +1,12 @@
2006-08-10 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
* include/config_mgr.h:
* include/setup_dialog.h:
* src/core/config_mgr.cpp:
* src/core/setup_dialog.cpp:
* src/lib/ladspa_manager.cpp:
-added ladspa search path to user configuration
-made ladspa loader ignore all files not ending in "so"
* include/effect.h:
* src/core/effect.cpp:
* src/widgets/ladspa_control.cpp:

View File

@@ -50,6 +50,8 @@
#endif
#include "ladspa_manager.h"
class QLineEdit;
class QLabel;
@@ -157,6 +159,13 @@ public:
return( m_flDir );
}
#ifdef LADSPA_SUPPORT
const QString & ladspaDir( void ) const
{
return( m_ladDir );
}
#endif
const QString & value( const QString & _class,
const QString & _attribute ) const;
void setValue( const QString & _class, const QString & _attribute,
@@ -171,6 +180,7 @@ public slots:
void setVSTDir( const QString & _vd );
void setArtworkDir( const QString & _ad );
void setFLDir( const QString & _fd );
void setLADSPADir( const QString & _fd );
protected slots:
@@ -209,6 +219,9 @@ private:
QString m_pluginDir;
QString m_vstDir;
QString m_flDir;
#ifdef LADSPA_SUPPORT
QString m_ladDir;
#endif
typedef vvector<QPair<QString, QString> > stringPairVector;
typedef QMap<QString, stringPairVector> settingsMap;

View File

@@ -43,6 +43,7 @@
#include "audio_device.h"
#include "midi_client.h"
#include "ladspa_manager.h"
class QComboBox;
@@ -83,6 +84,7 @@ private slots:
void setVSTDir( const QString & _vd );
void setArtworkDir( const QString & _ad );
void setFLDir( const QString & _fd );
void setLADSPADir( const QString & _fd );
// audio settings widget
void audioInterfaceChanged( const QString & _driver );
@@ -104,6 +106,7 @@ private slots:
void openVSTDir( void );
void openArtworkDir( void );
void openFLDir( void );
void openLADSPADir( void );
void toggleDisableChActInd( bool _disabled );
@@ -129,12 +132,17 @@ private:
QLineEdit * m_vdLineEdit;
QLineEdit * m_adLineEdit;
QLineEdit * m_fdLineEdit;
#ifdef LADSPA_SUPPORT
QLineEdit * m_ladLineEdit;
#endif
QString m_workingDir;
QString m_vstDir;
QString m_artworkDir;
QString m_flDir;
#ifdef LADSPA_SUPPORT
QString m_ladDir;
#endif
bool m_disableChActInd;
bool m_manualChPiano;

View File

@@ -566,6 +566,16 @@ void configManager::setFLDir( const QString & _fd )
void configManager::setLADSPADir( const QString & _fd )
{
#ifdef LADSPA_SUPPORT
m_ladDir = _fd;
#endif
}
void configManager::accept( void )
{
if( m_workingDir.right( 1 ) != "/" )
@@ -835,6 +845,9 @@ bool configManager::loadConfigFile( void )
m_workingDir = value( "paths", "workingdir" );
m_vstDir = value( "paths", "vstdir" );
m_flDir = value( "paths", "fldir" );
#ifdef LADSPA_SUPPORT
m_ladDir = value( "paths", "laddir" );
#endif
if( m_vstDir == "" )
{
@@ -846,6 +859,13 @@ bool configManager::loadConfigFile( void )
m_flDir = QDir::home().absolutePath();
}
#ifdef LADSPA_SUPPORT
if( m_ladDir == "" )
{
m_ladDir = "/usr/lib/ladspa/:/usr/local/lib/ladspa/";
}
#endif
if( root.isElement() )
{
QString cfg_file_ver = root.toElement().attribute( "version" );
@@ -892,6 +912,9 @@ void configManager::saveConfigFile( void )
setValue( "paths", "workingdir", m_workingDir );
setValue( "paths", "vstdir", m_vstDir );
setValue( "paths", "fldir", m_flDir );
#ifdef LADSPA_SUPPORT
setValue( "paths", "laddir", m_ladDir );
#endif
QDomDocument doc( "lmms-config-file" );

View File

@@ -63,6 +63,7 @@
#include "debug.h"
#include "tooltip.h"
#include "led_checkbox.h"
#include "ladspa_manager.h"
// platform-specific audio-interface-classes
@@ -79,7 +80,6 @@
#include "midi_dummy.h"
inline void labelWidget( QWidget * _w, const QString & _txt )
{
QLabel * title = new QLabel( _txt, _w );
@@ -117,6 +117,9 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
m_vstDir( configManager::inst()->vstDir() ),
m_artworkDir( configManager::inst()->artworkDir() ),
m_flDir( configManager::inst()->flDir() ),
#ifdef LADSPA_SUPPORT
m_ladDir( configManager::inst()->ladspaDir() ),
#endif
m_disableChActInd( configManager::inst()->value( "ui",
"disablechannelactivityindicators" ).toInt() ),
m_manualChPiano( configManager::inst()->value( "ui",
@@ -140,8 +143,11 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
m_tabBar->setFixedWidth( 72 );
QWidget * ws = new QWidget( settings );
#ifdef LADSPA_SUPPORT
ws->setFixedSize( 360, 356 );
#else
ws->setFixedSize( 360, 300 );
#endif
QWidget * general = new QWidget( ws );
general->setFixedSize( 360, 240 );
QVBoxLayout * gen_layout = new QVBoxLayout( general );
@@ -256,7 +262,11 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
QWidget * directories = new QWidget( ws );
#ifdef LADSPA_SUPPORT
directories->setFixedSize( 360, 316 );
#else
directories->setFixedSize( 360, 260 );
#endif
QVBoxLayout * dir_layout = new QVBoxLayout( directories );
dir_layout->setSpacing( 0 );
dir_layout->setMargin( 0 );
@@ -337,6 +347,26 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
fldir_select_btn->move( 320, 20 );
connect( fldir_select_btn, SIGNAL( clicked() ), this,
SLOT( openFLDir() ) );
#ifdef LADSPA_SUPPORT
// LADSPA-dir
tabWidget * lad_tw = new tabWidget( tr(
"LADSPA plugin directories" ).toUpper(),
directories );
lad_tw->setFixedHeight( 56 );
m_ladLineEdit = new QLineEdit( m_ladDir, lad_tw );
m_ladLineEdit->setGeometry( 10, 20, 300, 16 );
connect( m_ladLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setLADSPADir( const QString & ) ) );
QPushButton * laddir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", lad_tw );
laddir_select_btn->setFixedSize( 24, 24 );
laddir_select_btn->move( 320, 20 );
connect( laddir_select_btn, SIGNAL( clicked() ), this,
SLOT( openLADSPADir() ) );
#endif
dir_layout->addWidget( lmms_wd_tw );
@@ -346,6 +376,10 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
dir_layout->addWidget( artwork_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( fl_tw );
#ifdef LADSPA_SUPPORT
dir_layout->addSpacing( 10 );
dir_layout->addWidget( lad_tw );
#endif
dir_layout->addStretch();
@@ -657,6 +691,9 @@ void setupDialog::accept( void )
configManager::inst()->setVSTDir( m_vstDir );
configManager::inst()->setArtworkDir( m_artworkDir );
configManager::inst()->setFLDir( m_flDir );
#ifdef LADSPA_SUPPORT
configManager::inst()->setLADSPADir( m_ladDir );
#endif
// tell all audio-settings-widget to save their settings
for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin();
@@ -908,6 +945,35 @@ void setupDialog::openFLDir( void )
void setupDialog::openLADSPADir( void )
{
#ifdef LADSPA_SUPPORT
#ifdef QT4
QString new_dir = QFileDialog::getExistingDirectory( this,
tr( "Choose LADSPA plugin directory" ),
m_ladDir );
#else
QString new_dir = QFileDialog::getExistingDirectory( m_ladDir, 0, 0,
tr( "Choose LADSPA plugin directory" ), TRUE );
#endif
if( new_dir != QString::null )
{
if( m_ladLineEdit->text() == "" )
{
m_ladLineEdit->setText( new_dir );
}
else
{
m_ladLineEdit->setText( m_ladLineEdit->text() + ":" +
new_dir );
}
}
#endif
}
void setupDialog::setFLDir( const QString & _fd )
{
m_flDir = _fd;
@@ -916,6 +982,16 @@ void setupDialog::setFLDir( const QString & _fd )
void setupDialog::setLADSPADir( const QString & _fd )
{
#ifdef LADSPA_SUPPORT
m_ladDir = _fd;
#endif
}
void setupDialog::audioInterfaceChanged( const QString & _iface )
{
for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin();

View File

@@ -50,6 +50,7 @@
#include <math.h>
#include "config_mgr.h"
@@ -60,15 +61,14 @@ ladspaManager::ladspaManager( engine * _engine )
#ifdef QT4
QStringList ladspaDirectories = QString( getenv( "LADSPA_PATH" ) ).
split( ':' );
ladspaDirectories += configManager::inst()->ladspaDir().split( ':' );
#else
QStringList ladspaDirectories = QStringList::split( ':',
QString( getenv( "LADSPA_PATH" ) ) );
ladspaDirectories += QStringList::split( ':',
configManager::inst()->ladspaDir() );
#endif
//*********DELETE THIS*********
ladspaDirectories.push_back( "/usr/lib/ladspa" );
//*********DELETE THIS*********
// set default-directory if nothing is specified...
if( ladspaDirectories.isEmpty() )
{
@@ -99,6 +99,11 @@ ladspaManager::ladspaManager( engine * _engine )
#else
const QFileInfo & f = **file;
#endif
if( !f.isFile() || f.fileName().right(2) != "so" )
{
continue;
}
QLibrary plugin_lib( f.absoluteFilePath() );
if( plugin_lib.load() == TRUE )