added modified project indicator, fixed some segfaults
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@615 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -86,13 +86,12 @@ ladspaBrowser::ladspaBrowser( void ) :
|
||||
QWidget * ws = new QWidget( this );
|
||||
ws->setFixedSize( 500, 480 );
|
||||
|
||||
const QString type = "<b>" + tr( "Type:" ) + "</b> ";
|
||||
QWidget * available = createTab( ws, type + tr( "Available Effects" ), VALID );
|
||||
QWidget * unavailable = createTab( ws, type + tr( "Unavailable Effects" ),
|
||||
QWidget * available = createTab( ws, tr( "Available Effects" ), VALID );
|
||||
QWidget * unavailable = createTab( ws, tr( "Unavailable Effects" ),
|
||||
INVALID );
|
||||
QWidget * instruments = createTab( ws, type + tr( "Instruments" ), SOURCE );
|
||||
QWidget * analysis = createTab( ws, type + tr( "Analysis Tools" ), SINK );
|
||||
QWidget * other = createTab( ws, type + tr( "Don't know" ), OTHER );
|
||||
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" ),
|
||||
@@ -185,7 +184,8 @@ QWidget * ladspaBrowser::createTab( QWidget * _parent, const QString & _txt,
|
||||
layout->setSpacing( 0 );
|
||||
layout->setMargin( 0 );
|
||||
|
||||
QLabel * title = new QLabel( _txt, tab );
|
||||
const QString type = "<b>" + tr( "Type:" ) + "</b> ";
|
||||
QLabel * title = new QLabel( type + _txt, tab );
|
||||
QFont f = title->font();
|
||||
f.setBold( TRUE );
|
||||
title->setFont( pointSize<12>( f ) );
|
||||
|
||||
@@ -23,14 +23,16 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "ladspa_effect.h"
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include "ladspa_effect.h"
|
||||
#include "mixer.h"
|
||||
#include "config_mgr.h"
|
||||
#include "audio_device.h"
|
||||
#include "config_mgr.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
#include "ladspa_control.h"
|
||||
#include "ladspa_subplugin_features.h"
|
||||
#include "mixer.h"
|
||||
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
@@ -60,12 +62,12 @@ plugin::descriptor ladspaeffect_plugin_descriptor =
|
||||
ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
effect( &ladspaeffect_plugin_descriptor, _key ),
|
||||
m_effName( "none" ),
|
||||
m_key( subPluginKeyToLadspaKey( _key )
|
||||
m_key( ladspaSubPluginFeatures::subPluginKeyToLadspaKey( _key )
|
||||
/* ladspa_key_t( _cdata->settings.attribute( "label" ),
|
||||
_cdata->settings.attribute( "lib" ) )*/ ),
|
||||
m_ladspa( engine::getLADSPAManager() )
|
||||
_cdata->settings.attribute( "lib" ) )*/ )
|
||||
{
|
||||
if( m_ladspa->getDescription( m_key ) == NULL )
|
||||
ladspa2LMMS * manager = engine::getLADSPAManager();
|
||||
if( manager->getDescription( m_key ) == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
"Unknown LADSPA plugin requested: " + m_key.first,
|
||||
@@ -74,15 +76,15 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
return;
|
||||
}
|
||||
|
||||
setPublicName( m_ladspa->getShortName( m_key ) );
|
||||
setPublicName( manager->getShortName( m_key ) );
|
||||
|
||||
// Calculate how many processing units are needed.
|
||||
const ch_cnt_t lmms_chnls = engine::getMixer()->audioDev()->channels();
|
||||
m_effectChannels = m_ladspa->getDescription( m_key )->inputChannels;
|
||||
m_effectChannels = manager->getDescription( m_key )->inputChannels;
|
||||
setProcessorCount( lmms_chnls / m_effectChannels );
|
||||
|
||||
// Categorize the ports, and create the buffers.
|
||||
m_portCount = m_ladspa->getPortCount( m_key );
|
||||
m_portCount = manager->getPortCount( m_key );
|
||||
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
@@ -91,13 +93,13 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
{
|
||||
port_desc_t * p = new portDescription;
|
||||
|
||||
p->name = m_ladspa->getPortName( m_key, port );
|
||||
p->name = manager->getPortName( m_key, port );
|
||||
p->proc = proc;
|
||||
p->port_id = port;
|
||||
p->control = NULL;
|
||||
|
||||
// Determine the port's category.
|
||||
if( m_ladspa->isPortAudio( m_key, port ) )
|
||||
if( manager->isPortAudio( m_key, port ) )
|
||||
{
|
||||
// Nasty manual memory management--was having difficulty
|
||||
// with some prepackaged plugins that were segfaulting
|
||||
@@ -105,18 +107,18 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
// memory management all taking place in one file.
|
||||
p->buffer =
|
||||
new LADSPA_Data[engine::getMixer()->framesPerPeriod()];
|
||||
|
||||
if( p->name.toUpper().contains( "IN" ) &&
|
||||
m_ladspa->isPortInput( m_key, port ) )
|
||||
|
||||
if( p->name.toUpper().contains( "IN" ) &&
|
||||
manager->isPortInput( m_key, port ) )
|
||||
{
|
||||
p->rate = CHANNEL_IN;
|
||||
}
|
||||
else if( p->name.toUpper().contains( "OUT" ) &&
|
||||
m_ladspa->isPortOutput( m_key, port ) )
|
||||
else if( p->name.toUpper().contains( "OUT" ) &&
|
||||
manager->isPortOutput( m_key, port ) )
|
||||
{
|
||||
p->rate = CHANNEL_OUT;
|
||||
}
|
||||
else if( m_ladspa->isPortInput( m_key, port ) )
|
||||
else if( manager->isPortInput( m_key, port ) )
|
||||
{
|
||||
p->rate = AUDIO_RATE_INPUT;
|
||||
}
|
||||
@@ -128,8 +130,8 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
else
|
||||
{
|
||||
p->buffer = new LADSPA_Data;
|
||||
|
||||
if( m_ladspa->isPortInput( m_key, port ) )
|
||||
|
||||
if( manager->isPortInput( m_key, port ) )
|
||||
{
|
||||
p->rate = CONTROL_RATE_INPUT;
|
||||
}
|
||||
@@ -138,13 +140,13 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
p->rate = CONTROL_RATE_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p->scale = 1.0f;
|
||||
if( m_ladspa->isPortToggled( m_key, port ) )
|
||||
if( manager->isPortToggled( m_key, port ) )
|
||||
{
|
||||
p->data_type = TOGGLED;
|
||||
}
|
||||
else if( m_ladspa->isInteger( m_key, port ) )
|
||||
else if( manager->isInteger( m_key, port ) )
|
||||
{
|
||||
p->data_type = INTEGER;
|
||||
}
|
||||
@@ -173,34 +175,34 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
{
|
||||
p->data_type = FLOAT;
|
||||
}
|
||||
|
||||
|
||||
// Get the range and default values.
|
||||
p->max = m_ladspa->getUpperBound( m_key, port );
|
||||
p->max = manager->getUpperBound( m_key, port );
|
||||
if( p->max == NOHINT )
|
||||
{
|
||||
p->max = p->name.toUpper() == "GAIN" ? 10.0f :
|
||||
1.0f;
|
||||
}
|
||||
|
||||
if( m_ladspa->areHintsSampleRateDependent(
|
||||
|
||||
if( manager->areHintsSampleRateDependent(
|
||||
m_key, port ) )
|
||||
{
|
||||
p->max *= engine::getMixer()->sampleRate();
|
||||
}
|
||||
|
||||
p->min = m_ladspa->getLowerBound( m_key, port );
|
||||
|
||||
p->min = manager->getLowerBound( m_key, port );
|
||||
if( p->min == NOHINT )
|
||||
{
|
||||
p->min = 0.0f;
|
||||
}
|
||||
|
||||
if( m_ladspa->areHintsSampleRateDependent(
|
||||
|
||||
if( manager->areHintsSampleRateDependent(
|
||||
m_key, port ) )
|
||||
{
|
||||
p->min *= engine::getMixer()->sampleRate();
|
||||
}
|
||||
|
||||
p->def = m_ladspa->getDefaultSetting( m_key, port );
|
||||
|
||||
p->def = manager->getDefaultSetting( m_key, port );
|
||||
if( p->def == NOHINT )
|
||||
{
|
||||
if( p->data_type != TOGGLED )
|
||||
@@ -212,16 +214,16 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
p->def = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p->max *= p->scale;
|
||||
p->min *= p->scale;
|
||||
p->def *= p->scale;
|
||||
|
||||
|
||||
p->value = p->def;
|
||||
|
||||
|
||||
|
||||
|
||||
ports.append( p );
|
||||
|
||||
|
||||
// For convenience, keep a separate list of the ports that are used
|
||||
// to control the processors.
|
||||
if( p->rate == AUDIO_RATE_INPUT ||
|
||||
@@ -233,9 +235,9 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
}
|
||||
m_ports.append( ports );
|
||||
}
|
||||
|
||||
|
||||
// Instantiate the processing units.
|
||||
m_descriptor = m_ladspa->getDescriptor( m_key );
|
||||
m_descriptor = manager->getDescriptor( m_key );
|
||||
if( m_descriptor == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
@@ -246,35 +248,34 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
}
|
||||
if( m_descriptor->run == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
"Plugin has no processor: " + m_key.first,
|
||||
QMessageBox::Ok, QMessageBox::NoButton );
|
||||
setDontRun( TRUE );
|
||||
}
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
LADSPA_Handle effect = m_ladspa->instantiate( m_key,
|
||||
LADSPA_Handle effect = manager->instantiate( m_key,
|
||||
engine::getMixer()->sampleRate() );
|
||||
if( effect == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
"Can't get LADSPA instance: " + m_key.first,
|
||||
QMessageBox::Ok, QMessageBox::NoButton );
|
||||
setOkay( FALSE );
|
||||
return;
|
||||
}
|
||||
m_handles.append( effect );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Connect the ports.
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
if( !m_ladspa->connectPort( m_key,
|
||||
m_handles[proc],
|
||||
port,
|
||||
if( !manager->connectPort( m_key,
|
||||
m_handles[proc],
|
||||
port,
|
||||
m_ports[proc][port]->buffer ) )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect",
|
||||
@@ -285,11 +286,11 @@ ladspaEffect::ladspaEffect( const descriptor::subPluginFeatures::key * _key ) :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Activate the processing units.
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
m_ladspa->activate( m_key, m_handles[proc] );
|
||||
manager->activate( m_key, m_handles[proc] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,11 +303,12 @@ ladspaEffect::~ladspaEffect()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
m_ladspa->deactivate( m_key, m_handles[proc] );
|
||||
m_ladspa->cleanup( m_key, m_handles[proc] );
|
||||
ladspa2LMMS * manager = engine::getLADSPAManager();
|
||||
manager->deactivate( m_key, m_handles[proc] );
|
||||
manager->cleanup( m_key, m_handles[proc] );
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
free( m_ports[proc][port]->buffer );
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "effect.h"
|
||||
#include "engine.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
#include "ladspa_base.h"
|
||||
#include "ladspa_control.h"
|
||||
#include "ladspa_control_dialog.h"
|
||||
@@ -82,7 +81,6 @@ public:
|
||||
private:
|
||||
QString m_effName;
|
||||
ladspa_key_t m_key;
|
||||
ladspa2LMMS * m_ladspa;
|
||||
Uint16 m_effectChannels;
|
||||
Uint16 m_portCount;
|
||||
fpp_t m_bufferSize;
|
||||
|
||||
@@ -26,16 +26,18 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QBoxLayout>
|
||||
|
||||
|
||||
#include "ladspa_subplugin_features.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
#include "mixer.h"
|
||||
|
||||
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
|
||||
#include "audio_device.h"
|
||||
#include "engine.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
#include "ladspa_base.h"
|
||||
#include "mixer.h"
|
||||
|
||||
|
||||
ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) :
|
||||
@@ -155,3 +157,15 @@ void ladspaSubPluginFeatures::listSubPluginKeys( plugin::descriptor * _desc,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ladspa_key_t ladspaSubPluginFeatures::subPluginKeyToLadspaKey(
|
||||
const key * _key )
|
||||
{
|
||||
QStringList list = _key->user.toStringList();
|
||||
if( list.empty() )
|
||||
{
|
||||
return( ladspa_key_t() );
|
||||
}
|
||||
return( ladspa_key_t( list.first(), list.last() ) );
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#ifndef _LADSPA_SUBPLUGIN_FEATURES_H
|
||||
#define _LADSPA_SUBPLUGIN_FEATURES_H
|
||||
|
||||
#include "ladspa_manager.h"
|
||||
#include "plugin.h"
|
||||
#include "ladspa_base.h"
|
||||
|
||||
|
||||
class ladspaSubPluginFeatures : public plugin::descriptor::subPluginFeatures
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
virtual void listSubPluginKeys( plugin::descriptor * _desc,
|
||||
keyList & _kl );
|
||||
|
||||
static ladspa_key_t subPluginKeyToLadspaKey( const key * _key );
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user