LADSPA-base now as library, fixed binary files

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@405 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-09-20 22:36:59 +00:00
parent 392dd0d89e
commit 373f7dffae
427 changed files with 83 additions and 340 deletions

View File

@@ -3,12 +3,12 @@ VESTIGE_SUBDIR=vestige
endif
if LADSPA_SUPPORT
LADSPA_DIR=ladspa_effect
LADSPA_DIRS=ladspa_base ladspa_effect
endif
if STK_SUPPORT
STK_DIR=stk
endif
SUBDIRS = audio_file_processor bit_invader flp_import $(LADSPA_DIR) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VESTIGE_SUBDIR) vibed
SUBDIRS = audio_file_processor bit_invader flp_import $(LADSPA_DIRS) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VESTIGE_SUBDIR) vibed

View File

@@ -0,0 +1,39 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I.
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="ladspabase"
%.moc: ./%.h
$(MOC) -o $@ $<
MOC_FILES = ./ladspa_control.moc \
./ladspa_port_dialog.moc \
./ladspa_subplugin_features.moc
BUILT_SOURCES = $(MOC_FILES)
CLEANFILES = $(MOC_FILES)
pkglib_LTLIBRARIES= libladspabase.la
libladspabase_la_SOURCES = ladspa_base.cpp \
ladspa_port_dialog.cpp \
ladspa_subplugin_features.cpp \
ladspa_2_lmms.cpp \
ladspa_manager.cpp \
ladspa_control.cpp \
ladspa_manager.h \
ladspa_2_lmms.h \
ladspa_control.h \
ladspa_port_dialog.h \
ladspa_subplugin_features.h \
ladspa_base.h

View File

@@ -0,0 +1,146 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_2_lmms.cpp - class that identifies and instantiates LADSPA effects
* for use with LMMS
*
* Copyright (c) 2005 Danny McRae <khjklujn@netscape.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
#include "ladspa_2_lmms.h"
#ifdef QT3
#define indexOf find
#endif
ladspa2LMMS::ladspa2LMMS( engine * _engine ):
ladspaManager( _engine )
{
l_sortable_plugin_t plugins = getSortedPlugins();
for( l_sortable_plugin_t::iterator it = plugins.begin();
it != plugins.end(); it++ )
{
ladspa_key_t key = (*it).second;
ladspaManagerDescription * desc = getDescription( key );
if( desc->type == SOURCE )
{
m_instruments.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == TRANSFER &&
( desc->inputChannels == desc->outputChannels &&
( desc->inputChannels == 1 ||
desc->inputChannels == 2 ||
desc->inputChannels == 4 ) &&
isRealTimeCapable( key ) ) )
{
m_validEffects.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == TRANSFER &&
( desc->inputChannels != desc->outputChannels ||
( desc->inputChannels != 1 &&
desc->inputChannels != 2 &&
desc->inputChannels != 4 ) ||
!isRealTimeCapable( key ) ) )
{
m_invalidEffects.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == SINK )
{
m_analysisTools.append( qMakePair( getName( key ),
key ) );
}
else if( desc->type == OTHER )
{
m_otherPlugins.append( qMakePair( getName( key ),
key ) );
}
}
}
ladspa2LMMS::~ladspa2LMMS()
{
}
QString ladspa2LMMS::getShortName( const ladspa_key_t & _key )
{
QString name = getName( _key );
if( name.indexOf( "(" ) > 0 )
{
name = name.left( name.indexOf( "(" ) );
}
if( name.indexOf( " - " ) > 0 )
{
name = name.left( name.indexOf( " - " ) );
}
if( name.indexOf( " " ) > 0 )
{
name = name.left( name.indexOf( " " ) );
}
#ifndef QT3
Qt::CaseSensitivity cs = Qt::CaseInsensitive;
#else
bool cs = FALSE;
#endif
if( name.indexOf( " with ", 0, cs ) > 0 )
{
name = name.left( name.indexOf( " with ", 0, cs ) );
}
if( name.indexOf( ",", 0, cs ) > 0 )
{
name = name.left( name.indexOf( ",", 0, cs ) );
}
if( name.length() > 40 )
{
Uint8 i = 40;
while( name[i] != ' ' && i != 0 )
{
i--;
}
name = name.left( i );
}
if( name.length() == 0 )
{
name = "LADSPA Plugin";
}
return( name );
}
#undef indexOf
#endif
#endif

View File

@@ -0,0 +1,86 @@
/*
* ladspa_2_lmms.h - class that identifies and instantiates LADSPA effects
* for use with LMMS
*
* Copyright (c) 2005 Danny McRae <khjklujn@netscape.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.
*
*/
#ifndef _LADSPA_2_LMMS_H
#define _LADSPA_2_LMMS_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "engine.h"
class ladspa2LMMS: public ladspaManager
{
public:
inline l_sortable_plugin_t getInstruments( void )
{
return( m_instruments );
}
inline l_sortable_plugin_t getValidEffects( void )
{
return( m_validEffects );
}
inline l_sortable_plugin_t getInvalidEffects( void )
{
return( m_invalidEffects );
}
inline l_sortable_plugin_t getAnalysisTools( void )
{
return( m_analysisTools );
}
inline l_sortable_plugin_t getOthers( void )
{
return( m_otherPlugins );
}
QString getShortName( const ladspa_key_t & _key );
private:
ladspa2LMMS( engine * _engine );
~ladspa2LMMS();
// engine * m_engine;
// ladspaManager * m_ladspa;
l_sortable_plugin_t m_instruments;
l_sortable_plugin_t m_validEffects;
l_sortable_plugin_t m_invalidEffects;
l_sortable_plugin_t m_analysisTools;
l_sortable_plugin_t m_otherPlugins;
friend class engine;
};
#endif
#endif

View File

@@ -0,0 +1,94 @@
/*
* ladspa_base.h - basic declarations concerning LADSPA
*
* 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.
*
*/
#ifndef _LADSPA_BASE_H
#define _LADSPA_BASE_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "plugin.h"
class ladspaControl;
typedef enum bufferRates
{
CHANNEL_IN,
CHANNEL_OUT,
AUDIO_RATE_INPUT,
AUDIO_RATE_OUTPUT,
CONTROL_RATE_INPUT,
CONTROL_RATE_OUTPUT
} buffer_rate_t;
typedef enum bufferData
{
TOGGLED,
INTEGER,
FLOAT,
TIME,
NONE
} buffer_data_t;
typedef struct portDescription
{
QString name;
ch_cnt_t proc;
Uint16 port_id;
Uint16 control_id;
buffer_rate_t rate;
buffer_data_t data_type;
float scale;
LADSPA_Data max;
LADSPA_Data min;
LADSPA_Data def;
LADSPA_Data value;
LADSPA_Data * buffer;
ladspaControl * control;
} port_desc_t;
inline ladspa_key_t subPluginKeyToLadspaKey(
const plugin::descriptor::subPluginFeatures::key & _key )
{
return( ladspa_key_t( _key.user.toStringList().first(),
_key.user.toStringList().last() ) );
}
inline plugin::descriptor::subPluginFeatures::key ladspaKeyToSubPluginKey(
plugin::descriptor * _desc,
const QString & _name,
const ladspa_key_t & _key )
{
return( plugin::descriptor::subPluginFeatures::key( _desc, _name,
QVariant( QStringList() << _key.first << _key.second ) ) );
}
#endif
#endif

View File

@@ -0,0 +1,309 @@
#if 0
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_browser.h - dialog to display information about installed LADSPA
* plugins
*
* Copyright (c) 2006 Danny McRae <khjklujn/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
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QLayout>
#include <QtGui/QWhatsThis>
#else
#include <qlayout.h>
#include <qwhatsthis.h>
#endif
#include "ladspa_browser.h"
#include "tab_bar.h"
#include "tab_button.h"
#include "tab_widget.h"
#include "gui_templates.h"
#include "config_mgr.h"
#include "embed.h"
#include "debug.h"
#include "tooltip.h"
#include "ladspa_description.h"
#include "ladspa_port_dialog.h"
#include "audio_device.h"
#include "buffer_allocator.h"
#include "effect_chain.h"
inline void ladspaBrowser::labelWidget( QWidget * _w, const QString & _txt )
{
QLabel * title = new QLabel( _txt, _w );
QFont f = title->font();
f.setBold( TRUE );
title->setFont( pointSize<12>( f ) );
#ifdef LMMS_DEBUG
assert( dynamic_cast<QBoxLayout *>( _w->layout() ) != NULL );
#endif
dynamic_cast<QBoxLayout *>( _w->layout() )->addSpacing( 5 );
dynamic_cast<QBoxLayout *>( _w->layout() )->addWidget( title );
dynamic_cast<QBoxLayout *>( _w->layout() )->addSpacing( 10 );
}
ladspaBrowser::ladspaBrowser( engine * _engine ) :
QDialog(),
engineObject( _engine )
{
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
setWindowTitle( tr( "LADSPA Plugin Browser" ) );
setModal( TRUE );
QVBoxLayout * vlayout = new QVBoxLayout( this );
vlayout->setSpacing( 0 );
vlayout->setMargin( 0 );
QWidget * settings = new QWidget( this );
QHBoxLayout * hlayout = new QHBoxLayout( settings );
hlayout->setSpacing( 0 );
hlayout->setMargin( 0 );
m_tabBar = new tabBar( settings, QBoxLayout::TopToBottom );
m_tabBar->setExclusive( TRUE );
m_tabBar->setFixedWidth( 72 );
QWidget * ws = new QWidget( settings );
ws->setFixedSize( 500, 400 );
QWidget * available = new QWidget( ws );
available->setFixedSize( 500, 340 );
QVBoxLayout * avl_layout = new QVBoxLayout( available );
avl_layout->setSpacing( 0 );
avl_layout->setMargin( 0 );
labelWidget( available, tr( "Available Effects" ) );
ladspaDescription * available_list = new ladspaDescription(available,
_engine, VALID );
connect( available_list, SIGNAL( doubleClicked( const ladspa_key_t & ) ),
this, SLOT( showPorts( const ladspa_key_t & ) ) );
avl_layout->addWidget( available_list );
QWidget * unavailable = new QWidget( ws );
unavailable->setFixedSize( 500, 340 );
QVBoxLayout * unavl_layout = new QVBoxLayout( unavailable );
unavl_layout->setSpacing( 0 );
unavl_layout->setMargin( 0 );
labelWidget( unavailable, tr( "Unavailable Effects" ) );
ladspaDescription * unavailable_list = new ladspaDescription(unavailable,
_engine, INVALID );
connect( unavailable_list,
SIGNAL( doubleClicked( const ladspa_key_t & ) ),
this, SLOT( showPorts( const ladspa_key_t & ) ) );
unavl_layout->addWidget( unavailable_list );
QWidget * instruments = new QWidget( ws );
instruments->setFixedSize( 500, 340 );
QVBoxLayout * inst_layout = new QVBoxLayout( instruments );
inst_layout->setSpacing( 0 );
inst_layout->setMargin( 0 );
labelWidget( instruments, tr( "Instruments" ) );
ladspaDescription * instruments_list =
new ladspaDescription(instruments, _engine, SOURCE );
connect( instruments_list,
SIGNAL( doubleClicked( const ladspa_key_t & ) ),
this, SLOT( showPorts( const ladspa_key_t & ) ) );
inst_layout->addWidget( instruments_list );
QWidget * analysis = new QWidget( ws );
analysis->setFixedSize( 500, 340 );
QVBoxLayout * anal_layout = new QVBoxLayout( analysis );
anal_layout->setSpacing( 0 );
anal_layout->setMargin( 0 );
labelWidget( analysis, tr( "Analysis Tools" ) );
ladspaDescription * analysis_list =
new ladspaDescription(analysis, _engine, SINK );
connect( analysis_list,
SIGNAL( doubleClicked( const ladspa_key_t & ) ),
this, SLOT( showPorts( const ladspa_key_t & ) ) );
anal_layout->addWidget( analysis_list );
QWidget * other = new QWidget( ws );
other->setFixedSize( 500, 340 );
QVBoxLayout * other_layout = new QVBoxLayout( other );
other_layout->setSpacing( 0 );
other_layout->setMargin( 0 );
labelWidget( other, tr( "Don't know" ) );
ladspaDescription * other_list =
new ladspaDescription(other, _engine, OTHER );
connect( other_list,
SIGNAL( doubleClicked( const ladspa_key_t & ) ),
this, SLOT( showPorts( const ladspa_key_t & ) ) );
other_layout->addWidget( other_list );
#ifndef QT4
#define setIcon setPixmap
#endif
m_tabBar->addTab( available, tr( "Available Effects" ),
0, FALSE, TRUE
)->setIcon( embed::getIconPixmap( "setup_audio" ) );
m_tabBar->addTab( unavailable, tr( "Unavailable Effects" ),
1, FALSE, TRUE
)->setIcon( embed::getIconPixmap(
"unavailable_sound" ) );
m_tabBar->addTab( instruments, tr( "Instruments" ),
2, FALSE, TRUE
)->setIcon( embed::getIconPixmap(
"setup_midi" ) );
m_tabBar->addTab( analysis, tr( "Analysis Tools" ),
3, FALSE, TRUE
)->setIcon( embed::getIconPixmap( "analysis" ) );
m_tabBar->addTab( other, tr( "Don't know" ),
4, TRUE, TRUE
)->setIcon( embed::getIconPixmap( "uhoh" ) );
#undef setIcon
m_tabBar->setActiveTab( 0 );
hlayout->addWidget( m_tabBar );
hlayout->addSpacing( 10 );
hlayout->addWidget( ws );
hlayout->addSpacing( 10 );
hlayout->addStretch();
QWidget * buttons = new QWidget( this );
QHBoxLayout * btn_layout = new QHBoxLayout( buttons );
btn_layout->setSpacing( 0 );
btn_layout->setMargin( 0 );
QPushButton * help_btn = new QPushButton(
embed::getIconPixmap( "help" ), "", buttons );
connect( help_btn, SIGNAL( clicked() ),
this, SLOT( displayHelp() ) );
QPushButton * cancel_btn = new QPushButton(
embed::getIconPixmap( "cancel" ), tr( "Close" ), buttons );
connect( cancel_btn, SIGNAL( clicked() ),
this, SLOT( reject() ) );
btn_layout->addStretch();
btn_layout->addSpacing( 10 );
btn_layout->addWidget( help_btn );
btn_layout->addSpacing( 10 );
btn_layout->addWidget( cancel_btn );
btn_layout->addSpacing( 10 );
vlayout->addWidget( settings );
vlayout->addSpacing( 10 );
vlayout->addWidget( buttons );
vlayout->addSpacing( 10 );
vlayout->addStretch();
show();
#ifdef QT4
this->setWhatsThis(
#else
QWhatsThis::add( this,
#endif
tr(
"This dialog displays information on all of the LADSPA plugins LMMS was "
"able to locate. The plugins are divided into five categories based "
"upon an interpretation of the port types and names.\n\n"
"Available Effects are those that can be used by LMMS. In order for LMMS "
"to be able to use an effect, it must, first and foremost, be an effect, "
"which is to say, it has to have both input channels and output channels. "
"LMMS identifies an input channel as an audio rate port containing 'in' in "
"the name. Output channels are identified by the letters 'out'. Furthermore, "
"the effect must have the same number of inputs and outputs and be real time "
"capable.\n\n"
"Unavailable Effects are those that were identified as effects, but either "
"didn't have the same number of input and output channels or weren't real "
"time capable.\n\n"
"Instruments are plugins for which only output channels were identified.\n\n"
"Analysis Tools are plugins for which only input channels were identified.\n\n"
"Don't Knows are plugins for which no input or output channels were "
"identified.\n\n"
"Double clicking any of the plugins will bring up information on the "
"ports." ) );
}
ladspaBrowser::~ladspaBrowser()
{
}
void ladspaBrowser::showPorts( const ladspa_key_t & _key )
{
ladspaPortDialog ports( _key, eng() );
ports.exec();
}
void ladspaBrowser::displayHelp( void )
{
#ifdef QT4
QWhatsThis::showText( mapToGlobal( rect().bottomRight() ),
whatsThis() );
#else
QWhatsThis::display( QWhatsThis::textFor( this ),
mapToGlobal( rect().bottomRight() ) );
#endif
}
#include "ladspa_browser.moc"
#endif
#endif
#endif

View File

@@ -0,0 +1,79 @@
#if 0
/*
* ladspa_browser.h - dialog to display information about installed LADSPA
* plugins
*
* Copyright (c) 2006 Danny McRae <khjklujn/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.
*
*/
#ifndef _LADSPA_BROWSER_H
#define _LADSPA_BROWSER_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QDialog>
#else
#include <qdialog.h>
#endif
#include "engine.h"
class QComboBox;
class QLabel;
class QLineEdit;
class QSlider;
class tabBar;
class ladspaBrowser : public QDialog, public engineObject
{
Q_OBJECT
public:
ladspaBrowser( engine * _engine );
virtual ~ladspaBrowser();
inline void labelWidget( QWidget * _w, const QString & _txt );
public slots:
void showPorts( const ladspa_key_t & _key );
void displayHelp( void );
private:
tabBar * m_tabBar;
} ;
#endif
#endif
#endif

View File

@@ -0,0 +1,401 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_control.cpp - widget for controlling a LADSPA port
*
* Copyright (c) 2006 Danny McRae <khjklujn/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 <QtGui/QWhatsThis>
#else
#include <qwhatsthis.h>
#endif
#include "ladspa_control.h"
#include "ladspa_base.h"
#include "tooltip.h"
#include "tempo_sync_knob.h"
ladspaControl::ladspaControl( QWidget * _parent,
port_desc_t * _port,
engine * _engine,
track * _track,
bool _link) :
QWidget( _parent
#ifdef QT3
, "ladspaControl"
#endif
),
journallingObject( _engine ),
m_port( _port ),
m_track( _track ),
m_link( NULL ),
m_toggle( NULL ),
m_knob( NULL )
{
m_layout = new QHBoxLayout( this
#ifdef QT3
, 0, 0, "ladspaControlLayout"
#endif
);
if( _link )
{
m_link = new ledCheckBox( "", this, "", eng(), m_track );
m_link->setChecked( FALSE );
connect( m_link, SIGNAL( toggled( bool ) ),
this, SLOT( portLink( bool ) ) );
m_layout->addWidget( m_link );
toolTip::add( m_link, tr( "Link channels" ) );
}
switch( m_port->data_type )
{
case TOGGLED:
m_toggle = new ledCheckBox( m_port->name, this, "",
eng(), m_track,
ledCheckBox::GREEN );
connect( m_toggle, SIGNAL( toggled( bool ) ),
this, SLOT( ledChange( bool ) ) );
setFixedSize( m_toggle->width(), m_toggle->height() );
if( m_port->def == 1.0f )
{
m_toggle->setChecked( TRUE );
}
if( _link )
{
m_layout->addWidget( m_toggle );
setFixedSize( m_link->width() +
m_toggle->width(),
m_toggle->height() );
}
break;
case INTEGER:
m_knob = new knob( knobBright_26, this,
m_port->name, eng(), m_track);
connect( m_knob, SIGNAL( valueChanged( float ) ),
this, SLOT( knobChange( float ) ) );
m_knob->setLabel( m_port->name );
m_knob->setRange( static_cast<int>( m_port->max ),
static_cast<int>( m_port->min ),
1 + static_cast<int>( m_port->max -
m_port->min ) / 400 );
m_knob->setInitValue(
static_cast<int>( m_port->def ) );
setFixedSize( m_knob->width(), m_knob->height() );
m_knob->setHintText( tr( "Value:" ) + " ", "" );
#ifdef QT4
m_knob->setWhatsThis(
#else
QWhatsThis::add( m_knob,
#endif
tr( "Sorry, no help available." ) );
if( _link )
{
m_layout->addWidget( m_knob );
setFixedSize( m_link->width() +
m_knob->width(),
m_knob->height() );
}
break;
case FLOAT:
m_knob = new knob( knobBright_26, this,
m_port->name, eng(), m_track);
connect( m_knob, SIGNAL( valueChanged( float ) ),
this, SLOT( knobChange( float ) ) );
m_knob->setLabel( m_port->name );
m_knob->setRange( m_port->min, m_port->max,
( m_port->max -
m_port->min ) / 400.0f );
m_knob->setInitValue( m_port->def );
m_knob->setHintText( tr( "Value:" ) + " ", "" );
#ifdef QT4
m_knob->setWhatsThis(
#else
QWhatsThis::add( m_knob,
#endif
tr( "Sorry, no help available." ) );
setFixedSize( m_knob->width(), m_knob->height() );
if( _link )
{
m_layout->addWidget( m_knob );
setFixedSize( m_link->width() +
m_knob->width(),
m_knob->height() );
}
break;
case TIME:
m_knob = new tempoSyncKnob( knobBright_26, this,
m_port->name, eng(), m_track);
connect( m_knob, SIGNAL( valueChanged( float ) ),
this, SLOT( knobChange( float ) ) );
m_knob->setLabel( m_port->name );
m_knob->setRange( m_port->min, m_port->max,
( m_port->max -
m_port->min ) / 400.0f );
m_knob->setInitValue( m_port->def );
m_knob->setHintText( tr( "Value:" ) + " ", "" );
#ifdef QT4
m_knob->setWhatsThis(
#else
QWhatsThis::add( m_knob,
#endif
tr( "Sorry, no help available." ) );
setFixedSize( m_knob->width(), m_knob->height() );
if( _link )
{
m_layout->addWidget( m_knob );
setFixedSize( m_link->width() +
m_knob->width(),
m_knob->height() );
}
break;
default:
break;
}
}
ladspaControl::~ladspaControl()
{
}
LADSPA_Data ladspaControl::getValue( void )
{
LADSPA_Data value = 0.0f;
if( m_processLock.tryLock() )
{
switch( m_port->data_type )
{
case TOGGLED:
value = static_cast<LADSPA_Data>(
m_toggle->isChecked() );
break;
case INTEGER:
case FLOAT:
case TIME:
value = static_cast<LADSPA_Data>(
m_knob->value() );
break;
default:
printf(
"ladspaControl::getValue BAD BAD BAD\n" );
break;
}
m_processLock.unlock();
}
return( value );
}
void ladspaControl::setValue( LADSPA_Data _value )
{
m_processLock.lock();
switch( m_port->data_type )
{
case TOGGLED:
m_toggle->setChecked( static_cast<bool>( _value ) );
break;
case INTEGER:
m_knob->setValue( static_cast<int>( _value ) );
break;
case FLOAT:
case TIME:
m_knob->setValue( static_cast<float>( _value ) );
break;
default:
printf("ladspaControl::setValue BAD BAD BAD\n");
break;
}
m_processLock.unlock();
}
void FASTCALL ladspaControl::saveSettings( QDomDocument & _doc,
QDomElement & _this,
const QString & _name )
{
m_processLock.lock();
if( m_link != NULL )
{
m_link->saveSettings( _doc, _this, _name + "link" );
}
switch( m_port->data_type )
{
case TOGGLED:
m_toggle->saveSettings( _doc, _this, _name );
break;
case INTEGER:
case FLOAT:
case TIME:
m_knob->saveSettings( _doc, _this, _name );
break;
default:
printf("ladspaControl::saveSettings BAD BAD BAD\n");
break;
}
m_processLock.unlock();
}
void FASTCALL ladspaControl::loadSettings( const QDomElement & _this,
const QString & _name )
{
m_processLock.lock();
if( m_link != NULL )
{
m_link->loadSettings( _this, _name + "link" );
}
switch( m_port->data_type )
{
case TOGGLED:
m_toggle->loadSettings( _this, _name );
break;
case INTEGER:
case FLOAT:
case TIME:
m_knob->loadSettings( _this, _name );
break;
default:
printf("ladspaControl::loadSettings BAD BAD BAD\n");
break;
}
m_processLock.unlock();
}
void FASTCALL ladspaControl::linkControls( ladspaControl * _control )
{
m_processLock.lock();
switch( m_port->data_type )
{
case TOGGLED:
ledCheckBox::linkObjects( m_toggle, _control->getToggle() );
break;
case INTEGER:
case FLOAT:
case TIME:
knob::linkObjects( m_knob, _control->getKnob() );
break;
default:
break;
}
m_processLock.unlock();
}
void ladspaControl::ledChange( bool _state )
{
emit( changed( m_port->port_id, static_cast<LADSPA_Data>( _state ) ) );
}
void ladspaControl::knobChange( float _value )
{
emit( changed( m_port->port_id, static_cast<LADSPA_Data>( _value ) ) );
}
void FASTCALL ladspaControl::unlinkControls( ladspaControl * _control )
{
m_processLock.lock();
switch( m_port->data_type )
{
case TOGGLED:
ledCheckBox::unlinkObjects( m_toggle, _control->getToggle() );
break;
case INTEGER:
case FLOAT:
case TIME:
knob::unlinkObjects( m_knob, _control->getKnob() );
break;
default:
break;
}
m_processLock.unlock();
}
void ladspaControl::portLink( bool _state )
{
emit( linkChanged( m_port->control_id, _state ) );
}
void FASTCALL ladspaControl::setLink( bool _state )
{
if( m_link != NULL )
{
m_link->setChecked( _state );
}
}
#include "ladspa_control.moc"
#endif
#endif

View File

@@ -0,0 +1,116 @@
/*
* ladspa_control.h - widget for controlling a LADSPA port
*
* Copyright (c) 2006 Danny McRae <khjklujn/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.
*
*/
#ifndef _LADSPA_CONTROL_H
#define _LADSPA_CONTROL_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtGui/QWidget>
#include <QtGui/QLayout>
#include <QtCore/QMutex>
#else
#include <qwidget.h>
#include <qmutex.h>
#include <qlayout.h>
#endif
#include "journalling_object.h"
#include "track.h"
#include "knob.h"
#include "led_checkbox.h"
typedef struct portDescription port_desc_t;
class ladspaControl : public QWidget, public journallingObject
{
Q_OBJECT
public:
ladspaControl( QWidget * _parent, port_desc_t * _port,
engine * _engine, track * _track,
bool _link = FALSE );
~ladspaControl();
LADSPA_Data getValue( void );
void FASTCALL setValue( LADSPA_Data _value );
void FASTCALL setLink( bool _state );
void FASTCALL linkControls( ladspaControl * _control );
void FASTCALL unlinkControls( ladspaControl * _control );
inline ledCheckBox * getToggle( void )
{
return( m_toggle );
}
inline knob * getKnob( void )
{
return( m_knob );
}
inline port_desc_t * getPort( void )
{
return( m_port );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent, const QString & _name );
virtual void FASTCALL loadSettings( const QDomElement & _this,
const QString & _name );
inline virtual QString nodeName( void ) const
{
return( "port" );
}
signals:
void changed( Uint16 _port, LADSPA_Data _value );
void linkChanged( Uint16 _port, bool _state );
protected slots:
void ledChange( bool _state );
void knobChange( float _value );
void portLink( bool _state );
private:
port_desc_t * m_port;
track * m_track;
QHBoxLayout * m_layout;
ledCheckBox * m_link;
ledCheckBox * m_toggle;
knob * m_knob;
QMutex m_processLock;
};
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,373 @@
/*
* ladspa_manager.h - declaration of class ladspaManager
* a class to manage loading and instantiation
* of ladspa plugins
*
* Copyright (c) 2005 Danny McRae <khjklujn@netscape.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.
*
*/
#ifndef _LADSPA_MANAGER_H
#define _LADSPA_MANAGER_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_LADSPA_H
#include <ladspa.h>
#include "qt3support.h"
#ifdef QT4
#include <QtCore/QMap>
#include <QtCore/QPair>
#include <QtCore/QString>
#include <QtCore/QStringList>
#else
#include <qstring.h>
#include <qstringlist.h>
#include <qmap.h>
#include <qpair.h>
#endif
#include "types.h"
//#include "qt3support.h"
class engine;
const float NOHINT = -99342.2243f;
typedef QPair<QString, QString> ladspa_key_t;
typedef QPair<QString, ladspa_key_t> sortable_plugin_t;
typedef vlist<sortable_plugin_t> l_sortable_plugin_t;
typedef vlist<ladspa_key_t> l_ladspa_key_t;
/* ladspaManager provides a database of LADSPA plug-ins. Upon instantiation,
it loads all of the plug-ins found in the LADSPA_PATH environmental variable
and stores their access descriptors according in a dictionary keyed on
the filename the plug-in was loaded from and the label of the plug-in.
The can be retrieved by using ladspa_key_t. For example, to get the
"Phase Modulated Voice" plug-in from the cmt library, you would perform the
calls using:
ladspa_key_t key( "cmt.so", "phasemod" )
as the plug-in key. */
enum ladspaPluginType
{
SOURCE,
TRANSFER,
VALID,
INVALID,
SINK,
OTHER
};
typedef struct ladspaManagerStorage
{
LADSPA_Descriptor_Function descriptorFunction;
Uint32 index;
ladspaPluginType type;
Uint16 inputChannels;
Uint16 outputChannels;
} ladspaManagerDescription;
class ladspaManager
{
public:
ladspaManager( engine * _engine );
~ladspaManager();
l_sortable_plugin_t getSortedPlugins();
ladspaManagerDescription * getDescription( const ladspa_key_t &
_plugin );
/* This identifier can be used as a unique, case-sensitive
identifier for the plugin type within the plugin file. Plugin
types should be identified by file and label rather than by index
or plugin name, which may be changed in new plugin
versions. Labels must not contain white-space characters. */
QString FASTCALL getLabel( const ladspa_key_t & _plugin );
/* Indicates that the plugin has a real-time dependency
(e.g. listens to a MIDI device) and so its output must not
be cached or subject to significant latency. */
bool FASTCALL hasRealTimeDependency( const ladspa_key_t & _plugin );
/* Indicates that the plugin may cease to work correctly if the
host elects to use the same data location for both input and output
(see connectPort). */
bool FASTCALL isInplaceBroken( const ladspa_key_t & _plugin );
/* Indicates that the plugin is capable of running not only in a
conventional host but also in a 'hard real-time' environment. */
bool FASTCALL isRealTimeCapable( const ladspa_key_t & _plugin );
/* Returns the name of the plug-in */
QString FASTCALL getName( const ladspa_key_t & _plugin );
/* Returns the the plug-in's author */
QString FASTCALL getMaker( const ladspa_key_t & _plugin );
/* Returns the copyright for the plug-in */
QString FASTCALL getCopyright( const ladspa_key_t & _plugin );
/* This indicates the number of ports (input AND output) present on
the plugin. */
Uint32 FASTCALL getPortCount( const ladspa_key_t & _plugin );
/* Indicates that the port is an input. */
bool FASTCALL isPortInput( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that the port is an output. */
bool FASTCALL isPortOutput( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that the port is an audio. */
bool FASTCALL isPortAudio( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that the port is an control. */
bool FASTCALL isPortControl( const ladspa_key_t & _plugin,
Uint32 _port );
/* Indicates that any bounds specified should be interpreted as
multiples of the sample rate. For instance, a frequency range from
0Hz to the Nyquist frequency (half the sample rate) could be requested
by this hint in conjunction with LowerBound = 0 and UpperBound = 0.5.
Hosts that support bounds at all must support this hint to retain
meaning. */
bool FASTCALL areHintsSampleRateDependent(
const ladspa_key_t & _plugin,
Uint32 _port );
/* Returns the lower boundary value for the given port. If
no lower bound is provided by the plug-in, returns -999e-99. When
areHintsSampleRateDependent() is also true then this value should be
multiplied by the relevant sample rate. */
float FASTCALL getLowerBound( const ladspa_key_t & _plugin,
Uint32 _port );
/* Returns the upper boundary value for the given port. If
no upper bound is provided by the plug-in, returns -999e-99. When
areHintsSampleRateDependent() is also true then this value should be
multiplied by the relevant sample rate. */
float FASTCALL getUpperBound( const ladspa_key_t & _plugin,
Uint32 _port );
/* Indicates whether the given port should be considered 0 or 1
boolean switch. */
bool FASTCALL isPortToggled( const ladspa_key_t & _plugin,
Uint32 _port );
/* Retrieves any default setting hints offered by the plug-in for
the given port. */
float FASTCALL getDefaultSetting( const ladspa_key_t & _plugin,
Uint32 _port );
/* Indicates that it is likely that the user will find it more
intuitive to view values using a logarithmic scale. This is
particularly useful for frequencies and gains. */
bool FASTCALL isLogarithmic( const ladspa_key_t & _plugin,
Uint32 _port );
/* Indicates that a user interface would probably wish to provide a
stepped control taking only integer values. Any bounds set should be
slightly wider than the actual integer range required to avoid floating
point rounding errors. For instance, the integer set {0,1,2,3} might
be described as [-0.1, 3.1]. */
bool FASTCALL isInteger( const ladspa_key_t & _plugin, Uint32 _port );
/* Returns the name of the port. */
QString FASTCALL getPortName( const ladspa_key_t & _plugin,
Uint32 _port );
/* This may be used by the plugin developer to pass any custom
implementation data into an instantiate call. It must not be used
or interpreted by the host. It is expected that most plugin
writers will not use this facility as LADSPA_Handle should be
used to hold instance data. */
const void * FASTCALL getImplementationData(
const ladspa_key_t & _plugin );
/* Returns a pointer to the plug-in's descriptor from which control
of the plug-in is accessible */
const LADSPA_Descriptor * FASTCALL getDescriptor(
const ladspa_key_t & _plugin );
/* The following methods are convenience functions for use during
development. A real instrument should use the getDescriptor()
method and implement the plug-in manipulations internally to avoid
the overhead associated with QMap lookups. */
/* Returns a handle to an instantiation of the given plug-in. */
LADSPA_Handle FASTCALL instantiate( const ladspa_key_t & _plugin,
Uint32 _sample_rate );
/* This method calls a function pointer that connects a port on an
instantiated plugin to a memory location at which a block of data
for the port will be read/written. The data location is expected
to be an array of LADSPA_Data for audio ports or a single
LADSPA_Data value for control ports. Memory issues will be
managed by the host. The plugin must read/write the data at these
locations every time run() or runAdding() is called and the data
present at the time of this connection call should not be
considered meaningful.
connectPort() may be called more than once for a plugin instance
to allow the host to change the buffers that the plugin is
reading or writing. These calls may be made before or after
activate() or deactivate() calls.
connectPort() must be called at least once for each port before
run() or runAdding() is called. */
bool FASTCALL connectPort( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
Uint32 _port,
LADSPA_Data * _data_location );
/* This method calls a function pointer that initialises a plugin
instance and activates it for use. This is separated from
instantiate() to aid real-time support and so that hosts can
reinitialise a plugin instance by calling deactivate() and then
activate(). In this case the plugin instance must reset all state
information dependent on the history of the plugin instance
except for any data locations provided by connectPort() and any
gain set by setRunAddingGain(). If there is nothing for
activate() to do then the plugin writer may provide a NULL rather
than an empty function.
When present, hosts must call this function once before run() (or
runAdding()) is called for the first time. This call should be
made as close to the run() call as possible and indicates to
real-time plugins that they are now live. Plugins should not rely
on a prompt call to run() after activate(). activate() may not be
called again unless deactivate() is called first. Note that
connectPort() may be called before or after a call to
activate(). */
bool FASTCALL activate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
/* This method calls a function pointer that runs an instance of a
plugin for a block. Two parameters are required: the first is a
handle to the particular instance to be run and the second
indicates the block size (in samples) for which the plugin
instance may run.
Note that if an activate() function exists then it must be called
before run() or run_adding(). If deactivate() is called for a
plugin instance then the plugin instance may not be reused until
activate() has been called again. */
bool FASTCALL run( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
Uint32 _sample_count );
/* This method calls a function pointer that runs an instance of a
plugin for a block. This has identical behaviour to run() except
in the way data is output from the plugin. When run() is used,
values are written directly to the memory areas associated with
the output ports. However when runAdding() is called, values
must be added to the values already present in the memory
areas. Furthermore, output values written must be scaled by the
current gain set by setRunAddingGain() (see below) before
addition.
runAdding() is optional. When it is not provided by a plugin,
this function pointer must be set to NULL. When it is provided,
the function setRunAddingGain() must be provided also. */
bool FASTCALL runAdding( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
Uint32 _sample_count );
/* This method calls a function pointer that sets the output gain for
use when runAdding() is called (see above). If this function is
never called the gain is assumed to default to 1. Gain
information should be retained when activate() or deactivate()
are called.
This function should be provided by the plugin if and only if the
runAdding() function is provided. When it is absent this
function pointer must be set to NULL. */
bool FASTCALL setRunAddingGain( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
LADSPA_Data _gain );
/* This is the counterpart to activate() (see above). If there is
nothing for deactivate() to do then the plugin writer may provide
a NULL rather than an empty function.
Hosts must deactivate all activated units after they have been
run() (or run_adding()) for the last time. This call should be
made as close to the last run() call as possible and indicates to
real-time plugins that they are no longer live. Plugins should
not rely on prompt deactivation. Note that connect_port() may be
called before or after a call to deactivate().
Deactivation is not similar to pausing as the plugin instance
will be reinitialised when activate() is called to reuse it. */
bool FASTCALL deactivate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
/* Once an instance of a plugin has been finished with it can be
deleted using the following function. The instance handle passed
ceases to be valid after this call.
If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup()
is called. */
bool FASTCALL cleanup( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
private:
void FASTCALL addPlugins(
LADSPA_Descriptor_Function _descriptor_func,
const QString & _file );
Uint16 FASTCALL getPluginInputs(
const LADSPA_Descriptor * _descriptor );
Uint16 FASTCALL getPluginOutputs(
const LADSPA_Descriptor * _descriptor );
typedef QMap<ladspa_key_t, ladspaManagerDescription *>
ladspaManagerMapType;
ladspaManagerMapType m_ladspaManagerMap;
l_sortable_plugin_t m_sortedPlugins;
friend class engine;
} ;
#endif
#endif

View File

@@ -0,0 +1,276 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_port_dialog.cpp - dialog to test a LADSPA plugin
*
* Copyright (c) 2006 Danny McRae <khjklujn/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"
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtGui/QLayout>
#include <QtGui/QTableWidget>
#else
#include <qlayout.h>
#include <qtable.h>
#define QTableWidget QTable
#endif
#include "ladspa_port_dialog.h"
#include "embed.h"
#include "mixer.h"
ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key,
engine * _engine ) :
QDialog(),
engineObject( _engine ),
m_key( _key ),
m_ladspa( _engine->getLADSPAManager() )
{
setWindowIcon( embed::getIconPixmap( "ports" ) );
setWindowTitle( "Ports" );
setModal( TRUE );
QVBoxLayout * vlayout = new QVBoxLayout( this );
vlayout->setSpacing( 0 );
vlayout->setMargin( 0 );
QWidget * settings = new QWidget( this );
Uint16 pc = m_ladspa->getPortCount( m_key );
QTableWidget * display = new QTableWidget( pc, 7, settings );
QStringList ports;
ports.append( tr( "Name" ) );
ports.append( tr( "Rate" ) );
ports.append( tr( "Direction" ) );
ports.append( tr( "Type" ) );
ports.append( tr( "Min < Default < Max" ) );
ports.append( tr( "Logarithmic" ) );
ports.append( tr( "SR Dependent" ) );
QStringList port_nums;
for(Uint16 row = 0; row < pc; row++)
{
port_nums.append( QString::number( row ) );
Uint8 col = 0;
#ifdef QT3
display->setText( row, col, m_ladspa->getPortName(
m_key, row ) );
#else
display->item( row, col )->setText( m_ladspa->getPortName(
m_key, row ) );
#endif
col++;
if( m_ladspa->isPortAudio( m_key, row ) )
{
#ifdef QT3
display->setText( row, col, tr( "Audio" ) );
#else
display->item( row, col )->setText( tr( "Audio" ) );
#endif
}
else
{
#ifdef QT3
display->setText( row, col, tr( "Control" ) );
#else
display->item( row, col )->setText( tr( "Control" ) );
#endif
}
col++;
if( m_ladspa->isPortInput( m_key, row ) )
{
#ifdef QT3
display->setText( row, col, tr( "Input" ) );
#else
display->item( row, col )->setText( tr( "Input" ) );
#endif
}
else
{
#ifdef QT3
display->setText( row, col, tr( "Output" ) );
#else
display->item( row, col )->setText( tr( "Output" ) );
#endif
}
col++;
if( m_ladspa->isPortToggled( m_key, row ) )
{
#ifdef QT3
display->setText( row, col, tr( "Toggled" ) );
#else
display->item( row, col )->setText( tr( "Toggled" ) );
#endif
}
else if( m_ladspa->isInteger( m_key, row ) )
{
#ifdef QT3
display->setText( row, col, tr( "Integer" ) );
#else
display->item( row, col )->setText( tr( "Integer" ) );
#endif
}
else
{
#ifdef QT3
display->setText( row, col, tr( "Float" ) );
#else
display->item( row, col )->setText( tr( "Float" ) );
#endif
}
col++;
float min = m_ladspa->getLowerBound( m_key, row );
float max = m_ladspa->getUpperBound( m_key, row );
float def = m_ladspa->getDefaultSetting( m_key, row );
QString range = "";
if( m_ladspa->areHintsSampleRateDependent( m_key, row ) )
{
if( min != NOHINT )
{
min *= eng()->getMixer()->sampleRate();
}
if( max != NOHINT )
{
max *= eng()->getMixer()->sampleRate();
}
}
if( min == NOHINT )
{
range += "-Inf < ";
}
else if( m_ladspa->isInteger( m_key, row ) )
{
range += QString::number( static_cast<int>( min ) ) +
" < ";
}
else
{
range += QString::number( min ) + " < ";
}
if( def == NOHINT )
{
range += "None < ";
}
else if( m_ladspa->isInteger( m_key, row ) )
{
range += QString::number( static_cast<int>( def ) ) +
" < ";
}
else
{
range += QString::number( def ) + " < ";
}
if( max == NOHINT )
{
range += "Inf";
}
else if( m_ladspa->isInteger( m_key, row ) )
{
range += QString::number( static_cast<int>( max ) );
}
else
{
range += QString::number( max );
}
if( m_ladspa->isPortOutput( m_key, row ) ||
m_ladspa->isPortToggled( m_key, row ) )
{
range = "";
}
#ifdef QT3
display->setText( row, col, range );
#else
display->item( row, col )->setText( range );
#endif
col++;
if( m_ladspa->isLogarithmic( m_key, row ) )
{
#ifdef QT3
display->setText( row, col, tr( "Yes" ) );
#else
display->item( row, col )->setText( tr( "Yes" ) );
#endif
}
col++;
if( m_ladspa->areHintsSampleRateDependent( m_key, row ) )
{
#ifdef QT3
display->setText( row, col, tr( "Yes" ) );
#else
display->item( row, col )->setText( tr( "Yes" ) );
#endif
}
col++;
}
#ifdef QT3
display->setColumnLabels( ports );
display->setRowLabels( port_nums );
display->setReadOnly( true );
for(Uint8 col = 0; col < ports.count(); col++ )
{
display->adjustColumn( col );
}
#endif
vlayout->addWidget( settings );
setFixedSize( display->width(), display->height() );
show();
}
ladspaPortDialog::~ ladspaPortDialog()
{
}
#include "ladspa_port_dialog.moc"
#endif
#endif

View File

@@ -0,0 +1,61 @@
/*
* ladspa_port_dialog.h - dialog to test a LADSPA plugin
*
* Copyright (c) 2006 Danny McRae <khjklujn/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.
*
*/
#ifndef _LADSPA_PORT_DIALOG_H
#define _LADSPA_PORT_DIALOG_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtGui/QDialog>
#else
#include <qdialog.h>
#endif
#include "ladspa_2_lmms.h"
class ladspaPortDialog : public QDialog, public engineObject
{
Q_OBJECT
public:
ladspaPortDialog( const ladspa_key_t & _key,
engine * _engine );
virtual ~ladspaPortDialog();
private:
ladspa_key_t m_key;
ladspa2LMMS * m_ladspa;
};
#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

@@ -0,0 +1,68 @@
/*
* ladspa_subplugin_features.h - 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.
*
*/
#ifndef _LADSPA_SUBPLUGIN_FEATURES_H
#define _LADSPA_SUBPLUGIN_FEATURES_H
#include "plugin.h"
#include "ladspa_2_lmms.h"
#ifdef LADSPA_SUPPORT
class QLabel;
class ladspa2LMMS;
class ladspaSubPluginDescriptionWidget : public QWidget
{
public:
ladspaSubPluginDescriptionWidget( QWidget * _parent, engine * _engine,
const ladspa_key_t & _key );
} ;
class ladspaSubPluginFeatures : public plugin::descriptor::subPluginFeatures
{
public:
ladspaSubPluginFeatures( plugin::pluginTypes _type );
virtual QWidget * createDescriptionWidget( QWidget * _parent,
engine * _eng,
const key & _key );
virtual void listSubPluginKeys( engine * _eng,
plugin::descriptor * _desc, keyList & _kl );
} ;
#endif
#endif

View File

@@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I.
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I../ladspa_base/
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="ladspaeffect"