diff --git a/ChangeLog b/ChangeLog index ebf2bcfdc..85bc608d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ 2006-08-10 Danny McRae + * 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: diff --git a/include/config_mgr.h b/include/config_mgr.h index d99b6a35a..8f112c6c0 100644 --- a/include/config_mgr.h +++ b/include/config_mgr.h @@ -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 > stringPairVector; typedef QMap settingsMap; diff --git a/include/setup_dialog.h b/include/setup_dialog.h index 6c8ab907b..fb0200853 100644 --- a/include/setup_dialog.h +++ b/include/setup_dialog.h @@ -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; diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 1f1b1783e..06c819a5e 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -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" ); diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index 7e1fef98e..f67b2b689 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -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(); diff --git a/src/lib/ladspa_manager.cpp b/src/lib/ladspa_manager.cpp index f37151c72..83e2e121e 100644 --- a/src/lib/ladspa_manager.cpp +++ b/src/lib/ladspa_manager.cpp @@ -50,6 +50,7 @@ #include +#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 )