First version of a new dynamic LADSPA control dialog
The new dialog shows the LADSPA controls in a matrix layout. Each row corresponds to a LADSPA parameter. Each parameter can have several channels which can be linked. Each channel has its own row of controls. The class LadspaMatrixControlView was added by copying and modifying LadspaControlView to get rid of the link buttons which are associated with some controls and some labels.
This commit is contained in:
@@ -116,6 +116,7 @@ private:
|
||||
|
||||
|
||||
friend class LadspaControlView;
|
||||
friend class LadspaMatrixControlDialog;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
49
include/LadspaMatrixControlView.h
Normal file
49
include/LadspaMatrixControlView.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* LadspaMatrixControlView.h - widget for controlling a LADSPA port
|
||||
*
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
|
||||
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2015 Michael Gregorius <michaelgregorius/at/web[dot]de>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* 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_MATRIX_CONTROL_VIEW_H
|
||||
#define LADSPA_MATRIX_CONTROL_VIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ModelView.h"
|
||||
|
||||
class LadspaControl;
|
||||
|
||||
|
||||
class LMMS_EXPORT LadspaMatrixControlView : public QWidget, public ModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LadspaMatrixControlView( QWidget * parent, LadspaControl * ladspaControl );
|
||||
virtual ~LadspaMatrixControlView();
|
||||
|
||||
private:
|
||||
LadspaControl * m_ladspaControl;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
INCLUDE(BuildPlugin)
|
||||
|
||||
BUILD_PLUGIN(ladspaeffect LadspaEffect.cpp LadspaControls.cpp LadspaControlDialog.cpp LadspaSubPluginFeatures.cpp LadspaEffect.h LadspaControls.h LadspaControlDialog.h LadspaSubPluginFeatures.h MOCFILES LadspaEffect.h LadspaControls.h LadspaControlDialog.h EMBEDDED_RESOURCES logo.png)
|
||||
BUILD_PLUGIN(ladspaeffect LadspaEffect.cpp LadspaControls.cpp LadspaControlDialog.cpp LadspaMatrixControlDialog.cpp LadspaSubPluginFeatures.cpp LadspaEffect.h LadspaControls.h LadspaControlDialog.h LadspaMatrixControlDialog.h LadspaSubPluginFeatures.h MOCFILES LadspaEffect.h LadspaControls.h LadspaControlDialog.h LadspaMatrixControlDialog.h EMBEDDED_RESOURCES logo.png)
|
||||
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ladspa")
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "EffectControls.h"
|
||||
#include "LadspaControl.h"
|
||||
#include "LadspaControlDialog.h"
|
||||
#include "LadspaMatrixControlDialog.h"
|
||||
|
||||
|
||||
typedef QVector<LadspaControl *> control_list_t;
|
||||
@@ -56,7 +57,7 @@ public:
|
||||
|
||||
virtual EffectControlDialog * createView()
|
||||
{
|
||||
return new LadspaControlDialog( this );
|
||||
return new LadspaMatrixControlDialog( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +76,7 @@ private:
|
||||
|
||||
|
||||
friend class LadspaControlDialog;
|
||||
friend class LadspaMatrixControlDialog;
|
||||
friend class LadspaEffect;
|
||||
|
||||
|
||||
|
||||
165
plugins/LadspaEffect/LadspaMatrixControlDialog.cpp
Normal file
165
plugins/LadspaEffect/LadspaMatrixControlDialog.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* LadspaMatrixControlDialog.h - Dialog for displaying and editing control port
|
||||
* values for LADSPA plugins in a matrix display
|
||||
*
|
||||
* Copyright (c) 2015 Michael Gregorius <michaelgregorius/at/web[dot]de>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* 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 <QGroupBox>
|
||||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
#include <QScrollArea>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "LadspaEffect.h"
|
||||
#include "LadspaMatrixControlDialog.h"
|
||||
#include "LadspaMatrixControlView.h"
|
||||
#include "LadspaControlView.h"
|
||||
#include "LedCheckbox.h"
|
||||
|
||||
|
||||
|
||||
static int const s_linkBaseColumn = 0;
|
||||
static int const s_parameterNameBaseColumn = 2;
|
||||
static int const s_channelBaseColumn = 4;
|
||||
|
||||
|
||||
|
||||
|
||||
LadspaMatrixControlDialog::LadspaMatrixControlDialog( LadspaControls * ladspaControls ) :
|
||||
EffectControlDialog( ladspaControls ),
|
||||
m_effectGridLayout( NULL ),
|
||||
m_stereoLink( NULL )
|
||||
{
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout( this );
|
||||
|
||||
m_effectGridLayout = new QGridLayout();
|
||||
mainLayout->addLayout(m_effectGridLayout);
|
||||
|
||||
updateEffectView( ladspaControls );
|
||||
|
||||
if( ladspaControls->m_processors > 1 )
|
||||
{
|
||||
mainLayout->addSpacing( 3 );
|
||||
QHBoxLayout * center = new QHBoxLayout();
|
||||
mainLayout->addLayout( center );
|
||||
m_stereoLink = new LedCheckBox( tr( "Link Channels" ), this );
|
||||
m_stereoLink->setModel( &ladspaControls->m_stereoLinkModel );
|
||||
center->addWidget( m_stereoLink );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LadspaMatrixControlDialog::~LadspaMatrixControlDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LadspaMatrixControlDialog::updateEffectView( LadspaControls * ladspaControls )
|
||||
{
|
||||
QList<QWidget *> list = findChildren<QWidget *>();
|
||||
for( QList<QWidget *>::iterator it = list.begin(); it != list.end(); ++it )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
|
||||
m_effectControls = ladspaControls;
|
||||
|
||||
QWidget *widget = new QWidget(this);
|
||||
QGridLayout *gridLayout = new QGridLayout(widget);
|
||||
widget->setLayout(gridLayout);
|
||||
|
||||
gridLayout->addWidget( new QLabel( "<b>" + tr( "Parameter" ) + "</b>", widget ), 0, s_parameterNameBaseColumn, Qt::AlignRight );
|
||||
|
||||
bool linkLabelAdded = false;
|
||||
ch_cnt_t const numberOfChannels = ladspaControls->m_processors;
|
||||
|
||||
gridLayout->setColumnMinimumWidth(1, 20);
|
||||
|
||||
for ( ch_cnt_t i = 0; i < numberOfChannels; ++i )
|
||||
{
|
||||
QString channelString( tr( "Channel %1" ) );
|
||||
int currentChannelColumn = s_channelBaseColumn + 2*i;
|
||||
|
||||
gridLayout->addWidget( new QLabel( "<b>" + channelString.arg( QString::number( i + 1 ) ) + "</b>", widget ), 0, currentChannelColumn, Qt::AlignHCenter );
|
||||
|
||||
control_list_t & controls = ladspaControls->m_controls[i];
|
||||
|
||||
int currentRow = 1;
|
||||
control_list_t::iterator end = controls.end();
|
||||
for( control_list_t::iterator it = controls.begin(); it != end; ++it )
|
||||
{
|
||||
LadspaControl * ladspaControl = *it;
|
||||
|
||||
if ( i == 0 )
|
||||
{
|
||||
// TODO Assumes that all processors are equal! Change to more general approach, e.g. map from name to row
|
||||
|
||||
// Link
|
||||
if ( ladspaControl->m_link )
|
||||
{
|
||||
if ( !linkLabelAdded )
|
||||
{
|
||||
gridLayout->addWidget( new QLabel( "<b>" + tr( "Link" ) + "</b>", widget ), 0, s_linkBaseColumn, Qt::AlignHCenter );
|
||||
linkLabelAdded = true;
|
||||
}
|
||||
LedCheckBox * linkCheckBox = new LedCheckBox( "", widget );
|
||||
linkCheckBox->setModel( &ladspaControl->m_linkEnabledModel );
|
||||
linkCheckBox->setToolTip( tr( "Link channels" ) );
|
||||
gridLayout->addWidget( linkCheckBox, currentRow, s_linkBaseColumn, Qt::AlignHCenter );
|
||||
}
|
||||
|
||||
// Parameter name
|
||||
QString portName = ladspaControl->port()->name;
|
||||
QLabel *portNameLabel = new QLabel( portName, widget );
|
||||
gridLayout->addWidget( portNameLabel, currentRow, s_parameterNameBaseColumn, Qt::AlignRight );
|
||||
}
|
||||
|
||||
LadspaMatrixControlView *ladspaMatrixControlView = new LadspaMatrixControlView( widget, ladspaControl );
|
||||
gridLayout->addWidget( ladspaMatrixControlView, currentRow, currentChannelColumn, Qt::AlignHCenter );
|
||||
gridLayout->setColumnMinimumWidth(currentChannelColumn - 1, 20);
|
||||
|
||||
++currentRow;
|
||||
}
|
||||
}
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea( this );
|
||||
scrollArea->setWidgetResizable( true );
|
||||
scrollArea->setWidget( widget );
|
||||
scrollArea->setFrameShape( QFrame::NoFrame );
|
||||
|
||||
m_effectGridLayout->addWidget( scrollArea, 0, 0 );
|
||||
m_effectGridLayout->setMargin(0);
|
||||
|
||||
if( numberOfChannels > 1 && m_stereoLink != NULL )
|
||||
{
|
||||
m_stereoLink->setModel( &ladspaControls->m_stereoLinkModel );
|
||||
}
|
||||
|
||||
connect( ladspaControls, SIGNAL( effectModelChanged( LadspaControls * ) ),
|
||||
this, SLOT( updateEffectView( LadspaControls * ) ),
|
||||
Qt::DirectConnection );
|
||||
}
|
||||
56
plugins/LadspaEffect/LadspaMatrixControlDialog.h
Normal file
56
plugins/LadspaEffect/LadspaMatrixControlDialog.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* LadspaMatrixControlDialog.h - Dialog for displaying and editing control port
|
||||
* values for LADSPA plugins in a matrix display
|
||||
*
|
||||
* Copyright (c) 2015 Michael Gregorius <michaelgregorius/at/web[dot]de>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* 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_MATRIX_CONTROL_DIALOG_H
|
||||
#define LADSPA_MATRIX_CONTROL_DIALOG_H
|
||||
|
||||
#include "EffectControlDialog.h"
|
||||
|
||||
|
||||
class QGridLayout;
|
||||
class LadspaControls;
|
||||
class LedCheckBox;
|
||||
|
||||
|
||||
class LadspaMatrixControlDialog : public EffectControlDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LadspaMatrixControlDialog( LadspaControls * _ctl );
|
||||
~LadspaMatrixControlDialog();
|
||||
|
||||
virtual bool isResizable() const { return true; }
|
||||
|
||||
private slots:
|
||||
void updateEffectView( LadspaControls * _ctl );
|
||||
|
||||
|
||||
private:
|
||||
QGridLayout * m_effectGridLayout;
|
||||
LedCheckBox * m_stereoLink;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -65,6 +65,7 @@ SET(LMMS_SRCS
|
||||
gui/widgets/LeftRightNav.cpp
|
||||
gui/widgets/Knob.cpp
|
||||
gui/widgets/LadspaControlView.cpp
|
||||
gui/widgets/LadspaMatrixControlView.cpp
|
||||
gui/widgets/LcdSpinBox.cpp
|
||||
gui/widgets/LcdWidget.cpp
|
||||
gui/widgets/LedCheckbox.cpp
|
||||
|
||||
93
src/gui/widgets/LadspaMatrixControlView.cpp
Normal file
93
src/gui/widgets/LadspaMatrixControlView.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* LadspaMatrixControlView.cpp - widget for controlling a LADSPA port
|
||||
*
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
|
||||
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2015 Michael Gregorius <michaelgregorius/at/web[dot]de>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* 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 "LadspaMatrixControlView.h"
|
||||
|
||||
#include "LadspaControl.h"
|
||||
|
||||
#include "LadspaBase.h"
|
||||
#include "LedCheckbox.h"
|
||||
#include "TempoSyncKnob.h"
|
||||
#include "ToolTip.h"
|
||||
|
||||
#include <QLayout>
|
||||
|
||||
|
||||
LadspaMatrixControlView::LadspaMatrixControlView( QWidget * parent,
|
||||
LadspaControl * ladspaControl ) :
|
||||
QWidget( parent ),
|
||||
ModelView( ladspaControl, this ),
|
||||
m_ladspaControl( ladspaControl )
|
||||
{
|
||||
QHBoxLayout * layout = new QHBoxLayout( this );
|
||||
layout->setMargin( 0 );
|
||||
layout->setSpacing( 0 );
|
||||
|
||||
Knob * knob = NULL;
|
||||
|
||||
buffer_data_t dataType = m_ladspaControl->port()->data_type;
|
||||
switch( dataType )
|
||||
{
|
||||
case TOGGLED:
|
||||
{
|
||||
LedCheckBox * toggle = new LedCheckBox(
|
||||
"", this, QString::null, LedCheckBox::Green );
|
||||
toggle->setModel( m_ladspaControl->toggledModel() );
|
||||
layout->addWidget( toggle );
|
||||
setFixedSize( toggle->width(), toggle->height() );
|
||||
break;
|
||||
}
|
||||
|
||||
case INTEGER:
|
||||
case FLOATING:
|
||||
knob = new Knob( knobBright_26, this, m_ladspaControl->port()->name );
|
||||
knob->setModel( m_ladspaControl->knobModel() );
|
||||
break;
|
||||
|
||||
case TIME:
|
||||
knob = new TempoSyncKnob( knobBright_26, this, m_ladspaControl->port()->name );
|
||||
knob->setModel( m_ladspaControl->tempoSyncKnobModel() );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( knob != NULL )
|
||||
{
|
||||
knob->setHintText( tr( "Value:" ), "" );
|
||||
knob->setWhatsThis( tr( "Sorry, no help available." ) );
|
||||
layout->addWidget( knob );
|
||||
setFixedSize( knob->width(), knob->height() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LadspaMatrixControlView::~LadspaMatrixControlView()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user