really added LADSPA browser

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@609 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-11-23 00:08:27 +00:00
parent c13853a9b3
commit 9b74ff93fb
8 changed files with 843 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I.
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="ladspa_browser"
%.moc: ./%.h
$(MOC) -o $@ $<
MOC_FILES = ./ladspa_browser.moc \
./ladspa_description.moc \
./ladspa_port_dialog.moc
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h
EMBEDDED_RESOURCES = $(wildcard *png)
./embedded_resources.h: $(EMBEDDED_RESOURCES)
$(BIN2RES) $(EMBEDDED_RESOURCES) > $@
EXTRA_DIST = $(EMBEDDED_RESOURCES)
CLEANFILES = $(MOC_FILES) ./embedded_resources.h
pkglib_LTLIBRARIES = libladspa_browser.la
libladspa_browser_la_SOURCES = ladspa_browser.cpp \
ladspa_browser.h \
ladspa_description.cpp \
ladspa_description.h \
ladspa_port_dialog.cpp \
ladspa_port_dialog.h
$(libladspa_browser_la_SOURCES): ./embedded_resources.h

View File

@@ -0,0 +1,216 @@
/*
* ladspa_browser.cpp - dialog to display information about installed LADSPA
* plugins
*
* Copyright (c) 2006-2007 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_browser.h"
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include "gui_templates.h"
#include "ladspa_description.h"
#include "ladspa_port_dialog.h"
#include "tab_bar.h"
#include "tab_button.h"
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
extern "C"
{
plugin::descriptor ladspa_browser_plugin_descriptor =
{
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"LADSPA Plugin Browser",
QT_TRANSLATE_NOOP( "pluginBrowser",
"List installed LADSPA plugins" ),
"Danny McRae <khjklujn/at/users.sourceforge.net>",
0x0100,
plugin::Tool,
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ),
NULL
} ;
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new ladspaBrowser );
}
}
ladspaBrowser::ladspaBrowser( void ) :
tool( &ladspa_browser_plugin_descriptor )
{
QHBoxLayout * hlayout = new QHBoxLayout( this );
hlayout->setSpacing( 0 );
hlayout->setMargin( 0 );
m_tabBar = new tabBar( this, QBoxLayout::TopToBottom );
m_tabBar->setExclusive( TRUE );
m_tabBar->setFixedWidth( 72 );
QWidget * ws = new QWidget( this );
ws->setFixedSize( 500, 400 );
QWidget * available = createTab( ws, tr( "Available Effects" ), VALID );
QWidget * unavailable = createTab( ws, tr( "Unavailable Effects" ),
INVALID );
QWidget * instruments = createTab( ws, tr( "Instruments" ), SOURCE );
QWidget * analysis = createTab( ws, tr( "Analysis Tools" ), SINK );
QWidget * other = createTab( ws, tr( "Don't know" ), OTHER );
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" ) );
m_tabBar->setActiveTab( 0 );
hlayout->addWidget( m_tabBar );
hlayout->addSpacing( 10 );
hlayout->addWidget( ws );
hlayout->addSpacing( 10 );
hlayout->addStretch();
setWhatsThis( 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." ) );
hide();
if( parentWidget() )
{
parentWidget()->hide();
parentWidget()->layout()->setSizeConstraint(
QLayout::SetFixedSize );
}
}
ladspaBrowser::~ladspaBrowser()
{
}
QString ladspaBrowser::nodeName( void ) const
{
return( ladspa_browser_plugin_descriptor.name );
}
QWidget * ladspaBrowser::createTab( QWidget * _parent, const QString & _txt,
ladspaPluginType _type )
{
QWidget * tab = new QWidget( _parent );
tab->setFixedSize( 500, 340 );
QVBoxLayout * layout = new QVBoxLayout( tab );
layout->setSpacing( 0 );
layout->setMargin( 0 );
QLabel * title = new QLabel( _txt, tab );
QFont f = title->font();
f.setBold( TRUE );
title->setFont( pointSize<12>( f ) );
layout->addSpacing( 5 );
layout->addWidget( title );
layout->addSpacing( 10 );
ladspaDescription * description = new ladspaDescription( tab, _type );
connect( description, SIGNAL( doubleClicked( const ladspa_key_t & ) ),
SLOT( showPorts( const ladspa_key_t & ) ) );
layout->addWidget( description, 1 );
return( tab );
}
void ladspaBrowser::showPorts( const ladspa_key_t & _key )
{
ladspaPortDialog ports( _key );
ports.exec();
}
#include "ladspa_browser.moc"

View File

@@ -0,0 +1,62 @@
/*
* ladspa_browser.h - dialog to display information about installed LADSPA
* plugins
*
* Copyright (c) 2006-2007 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"
#include "tool.h"
class tabBar;
class ladspaBrowser : public tool
{
Q_OBJECT
public:
ladspaBrowser( void );
virtual ~ladspaBrowser();
virtual QString nodeName( void ) const;
public slots:
void showPorts( const ladspa_key_t & _key );
void displayHelp( void );
private:
tabBar * m_tabBar;
QWidget * createTab( QWidget * _parent, const QString & _txt,
ladspaPluginType _type );
} ;
#endif

View File

@@ -0,0 +1,224 @@
/*
* ladspa_description.cpp - LADSPA plugin description
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/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_description.h"
#include <QtGui/QGroupBox>
#include <QtGui/QLabel>
#include <QtGui/QListWidget>
#include <QtGui/QScrollArea>
#include <QtGui/QVBoxLayout>
#include "audio_device.h"
#include "engine.h"
#include "ladspa_2_lmms.h"
#include "mixer.h"
ladspaDescription::ladspaDescription( QWidget * _parent,
ladspaPluginType _type ) :
QWidget( _parent )
{
ladspa2LMMS * manager = engine::getLADSPAManager();
l_sortable_plugin_t plugins;
switch( _type )
{
case SOURCE:
plugins = manager->getInstruments();
break;
case TRANSFER:
plugins = manager->getValidEffects();
break;
case VALID:
plugins = manager->getValidEffects();
break;
case INVALID:
plugins = manager->getInvalidEffects();
break;
case SINK:
plugins = manager->getAnalysisTools();
break;
case OTHER:
plugins = manager->getOthers();
break;
default:
break;
}
QList<QString> pluginNames;
for( l_sortable_plugin_t::iterator it = plugins.begin();
it != plugins.end(); it++ )
{
if( _type != VALID ||
manager->getDescription( ( *it ).second )->inputChannels
<= engine::getMixer()->audioDev()->channels() )
{
pluginNames.push_back( ( *it ).first );
m_pluginKeys.push_back( ( *it ).second );
}
}
QGroupBox * pluginsBox = new QGroupBox( tr( "Plugins" ), this );
QListWidget * pluginList = new QListWidget( pluginsBox );
pluginList->addItems( pluginNames );
connect( pluginList, SIGNAL( currentRowChanged( int ) ),
SLOT( rowChanged( int ) ) );
connect( pluginList, SIGNAL( itemDoubleClicked( QListWidgetItem * ) ),
SLOT( onDoubleClicked( QListWidgetItem * ) ) );
( new QVBoxLayout( pluginsBox ) )->addWidget( pluginList );
QGroupBox * descriptionBox = new QGroupBox( tr( "Description" ), this );
QVBoxLayout * descriptionLayout = new QVBoxLayout( descriptionBox );
descriptionLayout->setSpacing( 0 );
descriptionLayout->setMargin( 0 );
m_scrollArea = new QScrollArea( descriptionBox );
descriptionLayout->addWidget( m_scrollArea );
QVBoxLayout * layout = new QVBoxLayout( this );
layout->addWidget( pluginsBox );
layout->addWidget( descriptionBox );
if( pluginList->count() > 0 )
{
pluginList->setCurrentRow( 0 );
m_currentSelection = m_pluginKeys[0];
update( m_currentSelection );
}
}
ladspaDescription::~ladspaDescription()
{
}
void ladspaDescription::update( const ladspa_key_t & _key )
{
QWidget * description = new QWidget;
m_scrollArea->setWidget( description );
QVBoxLayout * layout = new QVBoxLayout( description );
layout->setSizeConstraint( QLayout::SetFixedSize );
ladspa2LMMS * manager = engine::getLADSPAManager();
QLabel * name = new QLabel( description );
name->setText( QWidget::tr( "Name: " ) + manager->getName( _key ) );
layout->addWidget( name );
QWidget * maker = new QWidget( description );
QHBoxLayout * makerLayout = new QHBoxLayout( maker );
makerLayout->setMargin( 0 );
makerLayout->setSpacing( 0 );
layout->addWidget( maker );
QLabel * maker_label = new QLabel( maker );
maker_label->setText( QWidget::tr( "Maker: " ) );
maker_label->setAlignment( Qt::AlignTop );
QLabel * maker_content = new QLabel( maker );
maker_content->setText( manager->getMaker( _key ) );
maker_content->setWordWrap( TRUE );
makerLayout->addWidget( maker_label );
makerLayout->addWidget( maker_content, 1 );
QWidget * copyright = new QWidget( description );
QHBoxLayout * copyrightLayout = new QHBoxLayout( copyright );
copyrightLayout->setMargin( 0 );
copyrightLayout->setSpacing( 0 );
layout->addWidget( copyright );
QLabel * copyright_label = new QLabel( copyright );
copyright_label->setText( QWidget::tr( "Copyright: " ) );
copyright_label->setAlignment( Qt::AlignTop );
QLabel * copyright_content = new QLabel( copyright );
copyright_content->setText( manager->getCopyright( _key ) );
copyright_content->setWordWrap( TRUE );
copyrightLayout->addWidget( copyright_label );
copyrightLayout->addWidget( copyright_content, 1 );
QLabel * requiresRealTime = new QLabel( description );
requiresRealTime->setText( QWidget::tr( "Requires Real Time: " ) +
( manager->hasRealTimeDependency( _key ) ?
QWidget::tr( "Yes" ) :
QWidget::tr( "No" ) ) );
layout->addWidget( requiresRealTime );
QLabel * realTimeCapable = new QLabel( description );
realTimeCapable->setText( QWidget::tr( "Real Time Capable: " ) +
( manager->isRealTimeCapable( _key ) ?
QWidget::tr( "Yes" ) :
QWidget::tr( "No" ) ) );
layout->addWidget( realTimeCapable );
QLabel * inplaceBroken = new QLabel( description );
inplaceBroken->setText( QWidget::tr( "In Place Broken: " ) +
( manager->isInplaceBroken( _key ) ?
QWidget::tr( "Yes" ) :
QWidget::tr( "No" ) ) );
layout->addWidget( inplaceBroken );
QLabel * channelsIn = new QLabel( description );
channelsIn->setText( QWidget::tr( "Channels In: " ) + QString::number(
manager->getDescription( _key )->inputChannels ) );
layout->addWidget( channelsIn );
QLabel * channelsOut = new QLabel( description );
channelsOut->setText( QWidget::tr( "Channels Out: " ) + QString::number(
manager->getDescription( _key )->outputChannels ) );
layout->addWidget( channelsOut );
}
void ladspaDescription::rowChanged( int _pluginIndex )
{
m_currentSelection = m_pluginKeys[_pluginIndex];
update( m_currentSelection );
}
void ladspaDescription::onDoubleClicked( QListWidgetItem * _item )
{
emit( doubleClicked( m_currentSelection ) );
}
#include "ladspa_description.moc"

View File

@@ -0,0 +1,69 @@
/*
* ladspa_description.h - LADSPA plugin description
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/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_DESCRIPTION_H
#define _LADSPA_DESCRIPTION_H
#include <QtGui/QWidget>
#include "ladspa_manager.h"
class QListWidgetItem;
class QScrollArea;
class ladspaDescription : public QWidget
{
Q_OBJECT
public:
ladspaDescription( QWidget * _parent, ladspaPluginType _type );
virtual ~ladspaDescription();
signals:
void doubleClicked( const ladspa_key_t & );
private:
QScrollArea * m_scrollArea;
QList<ladspa_key_t> m_pluginKeys;
ladspa_key_t m_currentSelection;
void update( const ladspa_key_t & _key );
private slots:
void rowChanged( int _pluginIndex );
void onDoubleClicked( QListWidgetItem * _item );
} ;
#endif

View File

@@ -0,0 +1,183 @@
/*
* ladspa_port_dialog.cpp - dialog to test a LADSPA plugin
*
* Copyright (c) 2006-2007 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_port_dialog.h"
#include <QtGui/QLayout>
#include <QtGui/QTableWidget>
#include "embed.h"
#include "engine.h"
#include "ladspa_2_lmms.h"
#include "mixer.h"
ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key )
{
ladspa2LMMS * manager = engine::getLADSPAManager();
setWindowIcon( embed::getIconPixmap( "ports" ) );
setWindowTitle( tr( "Ports" ) );
setModal( TRUE );
QVBoxLayout * vlayout = new QVBoxLayout( this );
vlayout->setSpacing( 0 );
vlayout->setMargin( 0 );
Uint16 pc = manager->getPortCount( _key );
QTableWidget * settings = new QTableWidget( pc, 7, this );
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" ) );
settings->setHorizontalHeaderLabels( ports );
for( Uint16 row = 0; row < pc; row++ )
{
for( Uint8 col = 0; col < 7; ++col )
{
QTableWidgetItem * item = new QTableWidgetItem;
item->setFlags( 0 );
settings->setItem( row, col, item );
}
Uint8 col = 0;
settings->item( row, col++ )->setText( manager->getPortName(
_key, row ) );
settings->item( row, col++ )->setText(
manager->isPortAudio( _key, row ) ?
tr( "Audio" ) : tr( "Control" ) );
settings->item( row, col++ )->setText(
manager->isPortInput( _key, row ) ?
tr( "Input" ) : tr( "Output" ) );
settings->item( row, col++ )->setText(
manager->isPortToggled( _key, row ) ? tr( "Toggled" ) :
manager->isInteger( _key, row ) ? tr( "Integer" ) :
tr( "Float" ) );
float min = manager->getLowerBound( _key, row );
float max = manager->getUpperBound( _key, row );
float def = manager->getDefaultSetting( _key, row );
QString range = "";
if( manager->areHintsSampleRateDependent( _key, row ) )
{
if( min != NOHINT )
{
min *= engine::getMixer()->sampleRate();
}
if( max != NOHINT )
{
max *= engine::getMixer()->sampleRate();
}
}
if( min == NOHINT )
{
range += "-Inf < ";
}
else if( manager->isInteger( _key, row ) )
{
range += QString::number( static_cast<int>( min ) ) +
" < ";
}
else
{
range += QString::number( min ) + " < ";
}
if( def == NOHINT )
{
range += "None < ";
}
else if( manager->isInteger( _key, row ) )
{
range += QString::number( static_cast<int>( def ) ) +
" < ";
}
else
{
range += QString::number( def ) + " < ";
}
if( max == NOHINT )
{
range += "Inf";
}
else if( manager->isInteger( _key, row ) )
{
range += QString::number( static_cast<int>( max ) );
}
else
{
range += QString::number( max );
}
if( manager->isPortOutput( _key, row ) ||
manager->isPortToggled( _key, row ) )
{
range = "";
}
settings->item( row, col++ )->setText( range );
if( manager->isLogarithmic( _key, row ) )
{
settings->item( row, col )->setText( tr( "Yes" ) );
}
col++;
if( manager->areHintsSampleRateDependent( _key, row ) )
{
settings->item( row, col )->setText( tr( "Yes" ) );
}
}
vlayout->addWidget( settings );
show();
}
ladspaPortDialog::~ladspaPortDialog()
{
}
#include "ladspa_port_dialog.moc"

View File

@@ -0,0 +1,49 @@
/*
* ladspa_port_dialog.h - dialog to test a LADSPA plugin
*
* Copyright (c) 2006-2007 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 <QtGui/QDialog>
#include "ladspa_manager.h"
class ladspaPortDialog : public QDialog
{
Q_OBJECT
public:
ladspaPortDialog( const ladspa_key_t & _key );
virtual ~ladspaPortDialog();
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB