generic powerful effect-framework

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@397 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-09-17 12:45:09 +00:00
parent d8214879d1
commit 9c41572504
62 changed files with 2972 additions and 427 deletions

View File

@@ -25,11 +25,9 @@
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "mixer.h"
#include "audio_device.h"
#include "config_mgr.h"
#endif
#include "audio_port.h"
#include "audio_device.h"
@@ -52,10 +50,8 @@ audioPort::audioPort( const QString & _name, engine * _engine ) :
eng()->getMixer()->framesPerAudioBuffer() );
eng()->getMixer()->addAudioPort( this );
setExtOutputEnabled( TRUE );
#ifdef LADSPA_SUPPORT
m_frames = eng()->getMixer()->framesPerAudioBuffer();
m_effects = new effectChain( eng() );
#endif
}

View File

@@ -1,9 +1,10 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* effect.cpp - class for processing LADSPA effects
* effect.cpp - base-class for effects
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -24,9 +25,6 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtGui/QMessageBox>
@@ -39,10 +37,12 @@
#include "effect.h"
#include "dummy_effect.h"
effect::effect( engine * _engine ) :
engineObject( _engine ),
effect::effect( const plugin::descriptor * _desc, constructionData * _cdata ) :
plugin( _desc, _cdata->eng ),
m_key( _cdata->key ),
m_okay( TRUE ),
m_noRun( FALSE ),
m_running( FALSE ),
@@ -82,8 +82,22 @@ void FASTCALL effect::setGate( float _level )
}
effect * effect::instantiate( const QString & _plugin_name,
constructionData & _cdata )
{
plugin * p = plugin::instantiate( _plugin_name, &_cdata );
// check whether instantiated plugin is an instrument
if( dynamic_cast<effect *>( p ) != NULL )
{
// everything ok, so return pointer
return( dynamic_cast<effect *>( p ) );
}
// not quite... so delete plugin and return dummy instrument
delete p;
return( new dummyEffect() );
}
#endif
#endif

View File

@@ -24,8 +24,6 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "effect_chain.h"
@@ -195,6 +193,4 @@ bool effectChain::isRunning( void )
}
#endif
#endif

View File

@@ -0,0 +1,78 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* effect_control_dialog.cpp - base-class for effect-dialogs for displaying
* and editing control port values
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifdef QT4
#include <QtGui/QMessageBox>
#include <QtGui/QCloseEvent>
#else
#include <qmessagebox.h>
#endif
#include "effect_control_dialog.h"
effectControlDialog::effectControlDialog( QWidget * _parent, effect * _eff ) :
QWidget( _parent
#ifdef QT3
, "effectControlDialog"
#endif
),
journallingObject( _eff->eng() ),
m_effect( _eff )
{
setWindowTitle( m_effect->publicName() );
}
effectControlDialog::~effectControlDialog()
{
}
void effectControlDialog::closeEvent( QCloseEvent * _ce )
{
_ce->ignore();
emit( closed() );
}
#include "effect_control_dialog.moc"
#endif

View File

@@ -0,0 +1,276 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* effect_select_dialog.cpp - dialog to choose effect plugin
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QLayout>
#include <QtGui/QPushButton>
#else
#include <qlayout.h>
#include <qpushbutton.h>
#endif
#include "effect_select_dialog.h"
#include "gui_templates.h"
#include "embed.h"
effectSelectDialog::effectSelectDialog( QWidget * _parent, engine * _engine ) :
QDialog( _parent ),
engineObject( _engine )
{
setWindowIcon( embed::getIconPixmap( "setup_audio" ) );
setWindowTitle( tr( "Effects Selector" ) );
setModal( TRUE );
QVBoxLayout * vlayout = new QVBoxLayout( this );
vlayout->setSpacing( 10 );
vlayout->setMargin( 10 );
effectList * elist = new effectList( this, eng() );
elist->setMinimumSize( 500, 400 );
connect( elist, SIGNAL( doubleClicked( const effectKey & ) ),
this, SLOT( selectPlugin() ) );
connect( elist, SIGNAL( highlighted( const effectKey & ) ),
this, SLOT( setSelection( const effectKey & ) ) );
m_currentSelection = elist->getSelected();
QWidget * buttons = new QWidget( this );
QHBoxLayout * btn_layout = new QHBoxLayout( buttons );
btn_layout->setSpacing( 0 );
btn_layout->setMargin( 0 );
QPushButton * select_btn = new QPushButton(
embed::getIconPixmap( "add" ),
tr( "Add" ), buttons );
connect( select_btn, SIGNAL( clicked() ),
this, SLOT( selectPlugin() ) );
/* QPushButton * ports_btn = new QPushButton(
embed::getIconPixmap("ports" ),
tr( "Ports" ), buttons );
connect( ports_btn, SIGNAL( clicked() ),
this, SLOT( showPorts() ) );
*/
QPushButton * cancel_btn = new QPushButton(
embed::getIconPixmap( "cancel" ),
tr( "Cancel" ), buttons );
connect( cancel_btn, SIGNAL( clicked() ),
this, SLOT( reject() ) );
btn_layout->addStretch();
btn_layout->addSpacing( 10 );
btn_layout->addWidget( select_btn );
/* btn_layout->addSpacing( 10 );
btn_layout->addWidget( ports_btn );*/
btn_layout->addSpacing( 10 );
btn_layout->addWidget( cancel_btn );
btn_layout->addSpacing( 10 );
vlayout->addWidget( elist );
vlayout->addSpacing( 10 );
vlayout->addWidget( buttons );
vlayout->addSpacing( 10 );
//vlayout->addStretch();
show();
}
effectSelectDialog::~effectSelectDialog()
{
}
effect * effectSelectDialog::instantiateSelectedPlugin( void )
{
if( !m_currentSelection.name.isEmpty() && m_currentSelection.desc )
{
effect::constructionData cd =
{
eng(),
m_currentSelection
} ;
return( effect::instantiate( m_currentSelection.desc->name,
cd ) );
}
return( NULL );
}
void effectSelectDialog::showPorts( void )
{
/* ladspaPortDialog ports( m_currentSelection, eng() );
ports.exec();*/
}
void effectSelectDialog::setSelection( const effectKey & _selection )
{
m_currentSelection = _selection;
}
void effectSelectDialog::selectPlugin( void )
{
accept();
}
effectList::effectList( QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
engineObject( _engine ),
m_descriptionWidgetParent( new QWidget( this ) ),
m_descriptionWidget( NULL )
{
plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
for( vvector<plugin::descriptor>::iterator it =
m_pluginDescriptors.begin();
it != m_pluginDescriptors.end(); ++it )
{
if( it->type != plugin::Effect )
{
continue;
}
if( it->sub_plugin_features )
{
it->sub_plugin_features->listSubPluginKeys( eng(),
// as iterators are always stated to be not
// equal with pointers, we dereference the
// iterator and take the address of the item,
// so we're on the safe side and the compiler
// likely will reduce that to just "it"
&( *it ),
m_effectKeys );
}
else
{
// TODO
}
}
QStringList plugin_names;
for( effectKeyList::const_iterator it = m_effectKeys.begin();
it != m_effectKeys.end(); ++it )
{
plugin_names += QString( ( *it ).desc->public_name ) + ": " +
( *it ).name;
}
m_pluginList = new Q3ListBox( this );
m_pluginList->insertStringList( plugin_names );
connect( m_pluginList, SIGNAL( highlighted( int ) ),
SLOT( onHighlighted( int ) ) );
connect( m_pluginList, SIGNAL( doubleClicked( QListBoxItem * ) ),
SLOT( onDoubleClicked( QListBoxItem * ) ) );
QVBoxLayout * vboxl = new QVBoxLayout( this );
vboxl->setMargin( 0 );
vboxl->setSpacing( 10 );
vboxl->addWidget( m_pluginList );
vboxl->addWidget( m_descriptionWidgetParent );
new QVBoxLayout( m_descriptionWidgetParent );
if( m_pluginList->numRows() > 0 )
{
m_pluginList->setSelected( 0, true );
onHighlighted( 0 );
}
}
effectList::~effectList()
{
}
void effectList::onHighlighted( int _pluginIndex )
{
m_currentSelection = m_effectKeys[_pluginIndex];
delete m_descriptionWidget;
if( m_currentSelection.desc &&
m_currentSelection.desc->sub_plugin_features )
{
m_descriptionWidget = m_currentSelection.desc->
sub_plugin_features->
createDescriptionWidget( m_descriptionWidgetParent,
eng(), m_currentSelection );
}
dynamic_cast<QVBoxLayout *>( m_descriptionWidgetParent->layout() )->
addWidget( m_descriptionWidget );
m_descriptionWidget->show();
emit( highlighted( m_currentSelection ) );
}
void effectList::onDoubleClicked( QListBoxItem * _item )
{
emit( doubleClicked( m_currentSelection ) );
}
void effectList::onAddButtonReleased()
{
emit( addPlugin( m_currentSelection ) );
}
#include "effect_select_dialog.moc"
#endif

View File

@@ -25,8 +25,6 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
@@ -52,11 +50,12 @@
#include "group_box.h"
#include "tooltip.h"
#include "embed.h"
#include "select_ladspa_dialog.h"
#include "effect_select_dialog.h"
#include "rack_plugin.h"
#include "audio_port.h"
effectTabWidget::effectTabWidget( instrumentTrack * _track,
audioPort * _port ) :
QWidget( _track->tabWidgetParent() ),
@@ -146,16 +145,16 @@ void effectTabWidget::loadSettings( const QDomElement & _this )
void effectTabWidget::addEffect( void )
{
selectLADSPADialog sl( this, eng() );
sl.exec();
if( sl.result() == QDialog::Rejected )
effectSelectDialog esd( this, eng() );
esd.exec();
if( esd.result() == QDialog::Rejected )
{
return;
}
ladspa_key_t key = sl.getSelection();
m_rack->addPlugin( key );
effect * e = esd.instantiateSelectedPlugin();
m_rack->addEffect( e );
}
@@ -178,7 +177,4 @@ void effectTabWidget::closeEvent( QCloseEvent * _ce )
#include "effect_tab_widget.moc"
#endif
#endif

View File

@@ -83,7 +83,7 @@ void importFilter::import( const QString & _file_to_import,
for( vvector<plugin::descriptor>::iterator it = d.begin();
it != d.end(); ++it )
{
if( it->type == plugin::IMPORT_FILTER )
if( it->type == plugin::ImportFilter )
{
plugin * p = plugin::instantiate( it->name, s );
if( dynamic_cast<importFilter *>( p ) != NULL &&

View File

@@ -1,3 +1,4 @@
#if 0
#ifndef SINGLE_SOURCE_COMPILE
/*
@@ -305,3 +306,4 @@ void ladspaBrowser::displayHelp( void )
#endif
#endif
#endif

View File

@@ -0,0 +1,192 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_subplugin_features.cpp - derivation from
* plugin::descriptor::subPluginFeatures for
* hosting LADSPA-plugins
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtCore/QString>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#else
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qstring.h>
#endif
#include "ladspa_subplugin_features.h"
#include "ladspa_base.h"
#include "mixer.h"
#include "audio_device.h"
ladspaSubPluginDescriptionWidget::ladspaSubPluginDescriptionWidget(
QWidget * _parent, engine * _engine,
const ladspa_key_t & _key ) :
QWidget( _parent
#ifdef QT3
, "ladspaSubPluginDescriptionWidget"
#endif
)
{
ladspa2LMMS * lm = _engine->getLADSPAManager();
QVBoxLayout * l = new QVBoxLayout( this );
#ifndef QT3
QGroupBox * groupbox = new QGroupBox( tr( "Description" ), this );
#else
QGroupBox * groupbox = new QGroupBox( 9, Qt::Vertical,
tr( "Description" ), this );
#endif
QLabel * label = new QLabel( groupbox );
label->setText( tr( "Name: " ) + lm->getName( _key ) );
QLabel * maker = new QLabel( groupbox );
maker->setText( tr( "Maker: " ) + lm->getMaker( _key ) );
QLabel * copyright = new QLabel( groupbox );
copyright->setText( tr( "Copyright: " ) + lm->getCopyright( _key ) );
QLabel * requiresRealTime = new QLabel( groupbox );
if( lm->hasRealTimeDependency( _key ) )
{
requiresRealTime->setText( tr( "Requires Real Time: Yes" ) );
}
else
{
requiresRealTime->setText( tr( "Requires Real Time: No" ) );
}
QLabel * realTimeCapable = new QLabel( groupbox );
if( lm->isRealTimeCapable( _key ) )
{
realTimeCapable->setText( tr( "Real Time Capable: Yes" ) );
}
else
{
realTimeCapable->setText( tr( "Real Time Capable: No" ) );
}
QLabel * inplaceBroken = new QLabel( groupbox );
if( lm->isInplaceBroken( _key ) )
{
inplaceBroken->setText( tr( "In Place Broken: Yes" ) );
}
else
{
inplaceBroken->setText( tr( "In Place Broken: No" ) );
}
QLabel * channelsIn = new QLabel( groupbox );
channelsIn->setText( tr( "Channels In: " ) +
QString::number( lm->getDescription( _key )->inputChannels ) );
QLabel * channelsOut = new QLabel( groupbox );
channelsOut->setText( tr( "Channels Out: " ) +
QString::number( lm->getDescription( _key )->outputChannels ) );
l->addWidget( groupbox );
}
ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) :
subPluginFeatures( _type )
{
}
QWidget * ladspaSubPluginFeatures::createDescriptionWidget(
QWidget * _parent, engine * _eng, const key & _key )
{
return( new ladspaSubPluginDescriptionWidget( _parent, _eng,
subPluginKeyToLadspaKey( _key ) ) );
}
void ladspaSubPluginFeatures::listSubPluginKeys( engine * _eng,
plugin::descriptor * _desc, keyList & _kl )
{
ladspa2LMMS * lm = _eng->getLADSPAManager();
l_sortable_plugin_t plugins;
switch( m_type )
{
case plugin::Instrument:
plugins = lm->getInstruments();
break;
case plugin::Effect:
plugins = lm->getValidEffects();
//plugins += lm->getInvalidEffects();
break;
case plugin::AnalysisTools:
plugins = lm->getAnalysisTools();
break;
case plugin::Other:
plugins = lm->getOthers();
break;
default:
break;
}
for( l_sortable_plugin_t::const_iterator it = plugins.begin();
it != plugins.end(); ++it )
{
if( lm->getDescription( ( *it ).second )->inputChannels <=
_eng->getMixer()->audioDev()->channels() )
{
_kl.push_back( ladspaKeyToSubPluginKey(
_desc,
( *it ).first,
( *it ).second ) );
}
}
}
#include "ladspa_subplugin_features.moc"
#endif
#endif

View File

@@ -81,10 +81,6 @@
#include "project_journal.h"
#include "automation_editor.h"
#ifdef LADSPA_SUPPORT
#include "ladspa_browser.h"
#endif
#if QT_VERSION >= 0x030100
QSplashScreen * mainWindow::s_splashScreen = NULL;
@@ -532,7 +528,7 @@ void mainWindow::finalize( void )
tr( "What's this?" ),
this, SLOT( enterWhatsThisMode() ) );
#if 0
#ifdef LADSPA_SUPPORT
#ifdef QT4
help_menu->addSeparator();
@@ -542,6 +538,7 @@ void mainWindow::finalize( void )
help_menu->addAction( embed::getIconPixmap( "help" ), tr( "LADSPA Plugins..." ),
this, SLOT( ladspaPluginBrowser() ) );
#endif
#endif
#ifdef QT4
@@ -830,7 +827,7 @@ void mainWindow::help( void )
#if 0
void mainWindow::ladspaPluginBrowser( void )
{
// moc for Qt 3.x doesn't recognize preprocessor directives,
@@ -840,7 +837,7 @@ void mainWindow::ladspaPluginBrowser( void )
lb.exec();
#endif
}
#endif

View File

@@ -278,18 +278,12 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
eng()->getSongEditor()->processNextBuffer();
#ifdef LADSPA_SUPPORT
bool more_effects = FALSE;
#endif
for( vvector<audioPort *>::iterator it = m_audioPorts.begin();
it != m_audioPorts.end(); ++it )
{
#ifdef LADSPA_SUPPORT
more_effects = ( *it )->processEffects();
if( ( *it )->m_bufferUsage != audioPort::NONE || more_effects )
#else
if( ( *it )->m_bufferUsage != audioPort::NONE )
#endif
{
processBuffer( ( *it )->firstBuffer(),
( *it )->nextFxChannel() );

View File

@@ -57,7 +57,7 @@ static plugin::descriptor dummy_plugin_descriptor =
QT_TRANSLATE_NOOP( "pluginBrowser", "no description" ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::UNDEFINED,
plugin::Undefined,
NULL
} ;
@@ -105,17 +105,9 @@ QString plugin::getParameter( const QString & )
plugin * plugin::instantiate( const QString & _plugin_name, void * _data )
{
/*#ifdef HAVE_DLFCN_H
void * handle = dlopen( QString( "lib" + _plugin_name + ".so" ).
#ifdef QT4
toAscii().constData()
#else
ascii()
#endif
, RTLD_NOW );*/
QLibrary plugin_lib( configManager::inst()->pluginDir() +
_plugin_name );
if( /*handle == NULL*/ plugin_lib.load() == FALSE )
if( plugin_lib.load() == FALSE )
{
QMessageBox::information( NULL,
mixer::tr( "Plugin not found" ),
@@ -127,13 +119,6 @@ plugin * plugin::instantiate( const QString & _plugin_name, void * _data )
}
instantiationHook inst_hook = ( instantiationHook ) plugin_lib.resolve(
"lmms_plugin_main" );
/* dlerror();
instantiationHook inst_hook = ( instantiationHook )( dlsym( handle,
"lmms_plugin_main" ) );
char * error = dlerror();
if( error != NULL )
{
printf( "%s\n", error );*/
if( inst_hook == NULL )
{
QMessageBox::information( NULL,
@@ -148,10 +133,7 @@ plugin * plugin::instantiate( const QString & _plugin_name, void * _data )
plugin_lib.setAutoUnload( FALSE );
#endif
plugin * inst = inst_hook( _data );
//dlclose( handle );
return( inst );
/*#endif
return( new dummyPlugin() );*/
}
@@ -190,27 +172,6 @@ void plugin::getDescriptorsOfAvailPlugins( vvector<descriptor> & _plugin_descs )
#ifndef QT4
plugin_lib.setAutoUnload( FALSE );
#endif
/*
void * handle = dlopen( f.absoluteFilePath().
#ifdef QT4
toAscii().constData(),
#else
ascii(),
#endif
RTLD_NOW );
char * msg = dlerror();
if( msg != NULL || handle == NULL )
{
printf( "plugin-loader: %s\n", msg );
continue;
}
void * foo = dlsym( handle, "lmms_plugin_main" );
msg = dlerror();
if( msg != NULL || foo == NULL )
{
printf( "plugin-loader: %s\n", msg );
continue;
}*/
QString desc_name = f.fileName().section( '.', 0, 0 ) +
"_plugin_descriptor";
if( desc_name.left( 3 ) == "lib" )
@@ -229,21 +190,7 @@ void plugin::getDescriptorsOfAvailPlugins( vvector<descriptor> & _plugin_descs )
{
continue;
}
/* (descriptor *) dlsym( handle, desc_name.
#ifdef QT4
toAscii().constData()
#else
ascii()
#endif
);
msg = dlerror();
if( msg != NULL || plugin_desc == NULL )
{
printf( "plugin-loader: %s\n", msg );
continue;
}*/
_plugin_descs.push_back( *plugin_desc );
//dlclose( handle );
}
}

View File

@@ -88,7 +88,7 @@ pluginBrowser::pluginBrowser( QWidget * _parent, engine * _engine ) :
m_pluginDescriptors.begin();
it != m_pluginDescriptors.end(); ++it )
{
if( it->type == plugin::INSTRUMENT )
if( it->type == plugin::Instrument )
{
pluginDescWidget * p = new pluginDescWidget( *it,
m_view, eng() );

View File

@@ -2,8 +2,6 @@
#undef SINGLE_SOURCE_COMPILE
#include "src/tracks/instrument_track.cpp"
#include "src/core/effect_tab_widget.cpp"
#include "src/core/ladspa_control_dialog.cpp"
#include "src/core/select_ladspa_dialog.cpp"
#include "src/core/midi_tab_widget.cpp"
#include "src/lib/string_pair_drag.cpp"
#include "src/lib/buffer_allocator.cpp"
@@ -18,11 +16,13 @@
#include "src/lib/clipboard.cpp"
#include "src/lib/sample_buffer.cpp"
#include "src/core/meter_dialog.cpp"
#include "src/core/ladspa_effect.cpp"
#include "src/core/effect_chain.cpp"
#include "src/core/effect.cpp"
#include "src/core/ladspa_browser.cpp"
#include "src/core/effect_select_dialog.cpp"
#include "src/core/effect_control_dialog.cpp"
//#include "src/core/ladspa_browser.cpp"
#include "src/core/ladspa_port_dialog.cpp"
#include "src/core/ladspa_subplugin_features.cpp"
#include "src/core/import_filter.cpp"
#include "src/core/config_mgr.cpp"
#include "src/core/envelope_and_lfo_widget.cpp"

View File

@@ -26,12 +26,6 @@
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "effect_chain.h"
#include "effect_tab_widget.h"
#endif
#include "qt3support.h"
#ifdef QT4
@@ -93,6 +87,9 @@
#include "mmp.h"
#include "string_pair_drag.h"
#include "volume_knob.h"
#include "effect_chain.h"
#include "effect_tab_widget.h"
const char * volume_help = QT_TRANSLATE_NOOP( "instrumentTrack",
@@ -309,17 +306,11 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
m_envWidget = new envelopeTabWidget( this );
m_arpWidget = new arpAndChordsTabWidget( this );
m_midiWidget = new midiTabWidget( this, m_midiPort );
#ifdef LADSPA_SUPPORT
m_effWidget = new effectTabWidget( this, m_audioPort );
#endif
m_tabWidget->addTab( m_envWidget, tr( "ENV/LFO/FILTER" ), 1 );
m_tabWidget->addTab( m_arpWidget, tr( "ARP/CHORD" ), 2 );
#ifdef LADSPA_SUPPORT
m_tabWidget->addTab( m_effWidget, tr( "FX" ), 3 );
m_tabWidget->addTab( m_midiWidget, tr( "MIDI" ), 4 );
#else
m_tabWidget->addTab( m_midiWidget, tr( "MIDI" ), 3 );
#endif
// setup piano-widget
m_pianoWidget = new pianoWidget( this );
@@ -575,9 +566,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
}
float v_scale = (float) getVolume() / DEFAULT_VOLUME;
#ifdef LADSPA_SUPPORT
m_audioPort->getEffects()->startRunning();
#endif
// instruments using instrument-play-handles will call this method
// without any knowledge about notes, so they pass NULL for _n, which
@@ -1097,9 +1086,7 @@ void instrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc,
m_envWidget->saveState( _doc, _this );
m_arpWidget->saveState( _doc, _this );
m_midiWidget->saveState( _doc, _this );
#ifdef LADSPA_SUPPORT
m_effWidget->saveState( _doc, _this );
#endif
}
@@ -1135,27 +1122,10 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
{
m_midiWidget->restoreState( node.toElement() );
}
#ifdef LADSPA_SUPPORT
else if( m_effWidget->nodeName() == node.nodeName() )
{
m_effWidget->restoreState( node.toElement() );
}
#else
else if( node.nodeName() == "fx" )
{
// A song saved using ladspa will segfault when
// a version of lmms compiled without ladspa tries
// to instantiate a plugin from "libfx.so", so
// we catch it here.
QMessageBox::information( 0,
tr( "No LADSPA Support" ),
tr( "This instrument uses "
"features that aren't "
"available in this "
"version of LMMS." ),
QMessageBox::Ok );
}
#endif
else if( automationPattern::classNodeName()
!= node.nodeName() )
{

View File

@@ -44,12 +44,7 @@
#endif
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "effect_label.h"
#else
#include "name_label.h"
#endif
#include "sample_track.h"
#include "song_editor.h"
@@ -370,10 +365,9 @@ sampleTrack::sampleTrack( trackContainer * _tc ) :
{
getTrackWidget()->setFixedHeight( 32 );
#ifdef LADSPA_SUPPORT
m_trackLabel = new effectLabel( tr( "Sample track" ),
getTrackSettingsWidget(), eng(), this );
#else
#if 0
m_trackLabel = new nameLabel( tr( "Sample track" ),
getTrackSettingsWidget(), eng() );
m_trackLabel->setPixmap( embed::getIconPixmap( "sample_track" ) );
@@ -427,9 +421,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start,
{
sendMidiTime( _start );
#ifdef LADSPA_SUPPORT
m_audioPort->getEffects()->startRunning();
#endif
bool played_a_note = FALSE; // will be return variable
for( csize i = 0; i < numOfTCOs(); ++i )
@@ -484,9 +476,8 @@ void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _this )
{
_this.setAttribute( "name", m_trackLabel->text() );
#ifdef LADSPA_SUPPORT
m_trackLabel->saveState( _doc, _this );
#else
#if 0
_this.setAttribute( "icon", m_trackLabel->pixmapFile() );
#endif
m_volumeKnob->saveSettings( _doc, _this, "vol" );
@@ -498,7 +489,6 @@ void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc,
void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
{
m_trackLabel->setText( _this.attribute( "name" ) );
#ifdef LADSPA_SUPPORT
QDomNode node = _this.firstChild();
while( !node.isNull() )
{
@@ -511,7 +501,7 @@ void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
}
node = node.nextSibling();
}
#else
#if 0
if( _this.attribute( "icon" ) != "" )
{
m_trackLabel->setPixmapFile( _this.attribute( "icon" ) );

View File

@@ -25,8 +25,6 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "effect_label.h"
#include "sample_track.h"
@@ -192,7 +190,4 @@ void effectLabel::mouseDoubleClickEvent( QMouseEvent * _me )
#include "effect_label.moc"
#endif
#endif

View File

@@ -39,7 +39,7 @@
#include "ladspa_control.h"
#include "ladspa_effect.h"
#include "ladspa_base.h"
#include "tooltip.h"
#include "tempo_sync_knob.h"

View File

@@ -1,3 +1,4 @@
#if 0
#ifndef SINGLE_SOURCE_COMPILE
/*
@@ -42,10 +43,10 @@
#include "audio_device.h"
pluginDescription::pluginDescription( QWidget * _parent, engine * _engine ):
ladspaSubPluginDescriptionWidget::ladspaSubPluginDescriptionWidget( QWidget * _parent, engine * _engine ):
QWidget( _parent
#ifdef QT3
, "pluginDescription"
, "ladspaSubPluginDescriptionWidget"
#endif
),
m_ladspaManager( _engine->getLADSPAManager() )
@@ -88,14 +89,14 @@ pluginDescription::pluginDescription( QWidget * _parent, engine * _engine ):
pluginDescription::~pluginDescription()
ladspaSubPluginDescriptionWidget::~ladspaSubPluginDescriptionWidget()
{
}
void pluginDescription::onHighlighted( const ladspa_key_t & _key )
void ladspaSubPluginDescriptionWidget::update( const ladspa_key_t & _key )
{
m_label->setText( tr( "Name: " ) +
m_ladspaManager->getName( _key ) );
@@ -142,7 +143,7 @@ void pluginDescription::onHighlighted( const ladspa_key_t & _key )
ladspaDescription::ladspaDescription( QWidget * _parent,
engine * _engine,
pluginType _type ):
ladspaPluginType _type ):
QWidget( _parent
#ifdef QT3
, "ladspaDescription"
@@ -205,11 +206,11 @@ ladspaDescription::ladspaDescription( QWidget * _parent,
SLOT( onDoubleClicked( QListBoxItem * ) ) );
m_boxer->addWidget( m_grouper );
m_pluginDescription = new pluginDescription( this, _engine );
m_ladspaSubPluginDescriptionWidget = new ladspaSubPluginDescriptionWidget( this, _engine );
connect( this, SIGNAL( highlighted( const ladspa_key_t & ) ),
m_pluginDescription,
SLOT( onHighlighted( const ladspa_key_t & ) ) );
m_boxer->addWidget( m_pluginDescription );
m_ladspaSubPluginDescriptionWidget,
SLOT( update( const ladspa_key_t & ) ) );
m_boxer->addWidget( m_ladspaSubPluginDescriptionWidget );
if( m_pluginList->numRows() > 0 )
{
@@ -224,7 +225,7 @@ ladspaDescription::ladspaDescription( QWidget * _parent,
ladspaDescription::~ladspaDescription()
{
delete m_pluginDescription;
delete m_ladspaSubPluginDescriptionWidget;
delete m_pluginList;
delete m_grouper;
delete m_boxer;
@@ -261,3 +262,5 @@ void ladspaDescription::onAddButtonReleased()
#endif
#endif
#endif

View File

@@ -25,8 +25,8 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
@@ -57,31 +57,26 @@
#include "knob.h"
#include "tempo_sync_knob.h"
#include "tooltip.h"
#include "ladspa_2_lmms.h"
#include "ladspa_control_dialog.h"
#include "effect_control_dialog.h"
#include "embed.h"
#include "gui_templates.h"
#include "main_window.h"
rackPlugin::rackPlugin( QWidget * _parent,
ladspa_key_t _key,
effect * _eff,
track * _track,
engine * _engine,
audioPort * _port ) :
QWidget( _parent ),
journallingObject( _engine ),
journallingObject( _track->eng() ),
m_effect( _eff ),
m_track( _track ),
m_port( _port ),
m_contextMenu( NULL ),
m_key( _key ),
m_show( TRUE )
{
m_effect = new ladspaEffect( _key, eng() );
m_port->getEffects()->appendEffect( m_effect );
m_name = m_effect->getName();
setFixedSize( 210, 60 );
QPixmap bg = embed::getIconPixmap( "effect_plugin" );
@@ -170,9 +165,8 @@ rackPlugin::rackPlugin( QWidget * _parent,
connect( m_editButton, SIGNAL( clicked() ),
this, SLOT( editControls() ) );
QString name = eng()->getLADSPAManager()->getShortName( _key );
m_label = new QLabel( this );
m_label->setText( name );
m_label->setText( m_effect->publicName() );
f = m_label->font();
f.setBold( TRUE );
m_label->setFont( pointSize<7>( f ) );
@@ -188,9 +182,11 @@ rackPlugin::rackPlugin( QWidget * _parent,
195, 10 ) ) );
#endif
m_controlView = new ladspaControlDialog(
m_controlView = m_effect->createControlDialog( m_track );
/* eng()->getMainWindow()->workspace(),
new ControlDialog(
eng()->getMainWindow()->workspace(),
m_effect, eng(), m_track );
m_effect, eng(), m_track );*/
connect( m_controlView, SIGNAL( closed() ),
this, SLOT( closeEffects() ) );
m_controlView->hide();
@@ -300,10 +296,11 @@ void rackPlugin::contextMenuEvent( QContextMenuEvent * )
{
m_contextMenu = new QMenu( this );
#ifdef QT4
m_contextMenu->setTitle( m_effect->getName() );
m_contextMenu->setTitle( m_effect->publicName() );
#else
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( m_effect->getName() ) + "</b></font>",
QString( m_effect->publicName() ) +
"</b></font>",
this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
@@ -435,5 +432,3 @@ void rackPlugin::closeEffects( void )
#include "rack_plugin.moc"
#endif
#endif

View File

@@ -1,7 +1,7 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* right_frame.cpp - provides the display for the rackInsert instances
* rack_view.cpp - provides the display for the rackInsert instances
*
* Copyright (c) 2006 Danny McRae <khjklujn@netscape.net>
*
@@ -24,8 +24,6 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
@@ -48,8 +46,7 @@ rackView::rackView( QWidget * _parent,
QWidget( _parent ),
journallingObject( _engine ),
m_track( _track ),
m_port( _port ),
m_ladspa( eng()->getLADSPAManager() )
m_port( _port )
{
setFixedSize( 230, 184 );
@@ -76,7 +73,7 @@ rackView::~rackView()
void rackView::addPlugin( ladspa_key_t _key )
void rackView::addEffect( effect * _e )
{
#ifdef QT4
if( !m_scrollArea->widget() )
@@ -90,8 +87,7 @@ void rackView::addPlugin( ladspa_key_t _key )
#else
QWidget * w = m_scrollArea->viewport();
#endif
rackPlugin * plugin = new rackPlugin( w,
_key, m_track, eng(), m_port );
rackPlugin * plugin = new rackPlugin( w, _e, m_track, m_port );
connect( plugin, SIGNAL( moveUp( rackPlugin * ) ),
this, SLOT( moveUp( rackPlugin * ) ) );
connect( plugin, SIGNAL( moveDown( rackPlugin * ) ),
@@ -228,21 +224,15 @@ void rackView::redraw()
void FASTCALL rackView::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
int num = 0;
_this.setAttribute( "plugins", m_rackInserts.count() );
_this.setAttribute( "numofeffects", m_rackInserts.count() );
for( vvector<rackPlugin *>::iterator it = m_rackInserts.begin();
it != m_rackInserts.end(); it++ )
{
ladspa_key_t key = ( *it )->getKey();
_this.setAttribute( "label" + QString::number(num),
key.first );
_this.setAttribute( "lib" + QString::number(num), key.second );
_this.setAttribute( "name" + QString::number(num),
m_ladspa->getName( key ) );
_this.setAttribute( "maker" + QString::number(num),
m_ladspa->getMaker( key ) );
( *it )->saveState( _doc, _this );
num++;
QDomElement ef = ( *it )->saveState( _doc, _this );
ef.setAttribute( "name",
( *it )->getEffect()->getDescriptor()->name );
ef.setAttribute( "key",
( *it )->getEffect()->getKey().dumpBase64() );
}
}
@@ -251,19 +241,26 @@ void FASTCALL rackView::saveSettings( QDomDocument & _doc,
void FASTCALL rackView::loadSettings( const QDomElement & _this )
{
int plugin_cnt = _this.attribute( "plugins" ).toInt();
const int plugin_cnt = _this.attribute( "numofeffects" ).toInt();
QDomNode node = _this.firstChild();
for( int i = 0; i < plugin_cnt; i++ )
{
QString lib = _this.attribute( "lib" + QString::number( i ) );
QString label = _this.attribute( "label" +
QString::number( i ) );
ladspa_key_t key( label, lib );
if( m_ladspa->getDescriptor( key ) != NULL )
if( node.isElement() && node.nodeName() == "effect" )
{
addPlugin( key );
QDomElement cn = node.toElement();
const QString name = cn.attribute( "name" );
effect::constructionData cd =
{
eng(),
// we have this really convenient key-ctor
// which takes a QString and decodes the
// base64-data inside :-)
effectKey( cn.attribute( "key" ) )
} ;
addEffect(effect::instantiate( name, cd ) );
// TODO: somehow detect if effect is sub-plugin-capable
// but couldn't load sub-plugin with requsted key
if( node.isElement() )
{
if( m_rackInserts.last()->nodeName() ==
@@ -274,21 +271,6 @@ void FASTCALL rackView::loadSettings( const QDomElement & _this )
}
}
}
else
{
QString name = _this.attribute( "name" +
QString::number( i ) );
QString maker = _this.attribute( "maker" +
QString::number( i ) );
QString message = "Couldn't find " + name +
" from:\n\n";
message += "Library: " + lib + "\n";
message += "Label: " + label + "\n";
message += "Maker: " + maker;
QMessageBox::information( 0, tr( "Uknown plugin" ),
message, QMessageBox::Ok );
}
node = node.nextSibling();
}
@@ -299,5 +281,3 @@ void FASTCALL rackView::loadSettings( const QDomElement & _this )
#include "rack_view.moc"
#endif
#endif