added LADSPA browser, fixed automatable sliders, workspace improvements

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@608 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-11-23 00:05:25 +00:00
parent f9beb66e4e
commit c13853a9b3
194 changed files with 510 additions and 1082 deletions

View File

@@ -482,9 +482,7 @@ void configManager::setFLDir( const QString & _fd )
void configManager::setLADSPADir( const QString & _fd )
{
#ifdef LADSPA_SUPPORT
m_ladDir = _fd;
#endif
}
@@ -780,9 +778,7 @@ bool configManager::loadConfigFile( void )
m_workingDir = value( "paths", "workingdir" );
m_vstDir = value( "paths", "vstdir" );
m_flDir = value( "paths", "fldir" );
#ifdef LADSPA_SUPPORT
m_ladDir = value( "paths", "laddir" );
#endif
#ifdef HAVE_STK_H
m_stkDir = value( "paths", "stkdir" );
#endif
@@ -797,12 +793,10 @@ bool configManager::loadConfigFile( void )
m_flDir = QDir::home().absolutePath();
}
#ifdef LADSPA_SUPPORT
if( m_ladDir == "" )
{
m_ladDir = "/usr/lib/ladspa/:/usr/local/lib/ladspa/";
}
#endif
{
m_ladDir = "/usr/lib/ladspa/:/usr/local/lib/ladspa/";
}
#ifdef HAVE_STK_H
if( m_stkDir == "" )
@@ -857,9 +851,7 @@ void configManager::saveConfigFile( void )
setValue( "paths", "workingdir", m_workingDir );
setValue( "paths", "vstdir", m_vstDir );
setValue( "paths", "fldir", m_flDir );
#ifdef LADSPA_SUPPORT
setValue( "paths", "laddir", m_ladDir );
#endif
#ifdef HAVE_STK_H
setValue( "paths", "stkdir", m_stkDir );
#endif

View File

@@ -25,23 +25,20 @@
*/
#include "engine.h"
#include "automation_editor.h"
#include "bb_editor.h"
#include "config_mgr.h"
#include "project_journal.h"
#include "engine.h"
#include "ladspa_2_lmms.h"
#include "main_window.h"
#include "mixer.h"
#include "pattern.h"
#include "piano_roll.h"
#include "preset_preview_play_handle.h"
#include "project_journal.h"
#include "project_notes.h"
#include "song_editor.h"
#ifdef LADSPA_SUPPORT
#include "ladspa_2_lmms.h"
#endif
bool engine::s_hasGUI = TRUE;
float engine::s_frames_per_tact64th;
@@ -53,9 +50,7 @@ bbEditor * engine::s_bbEditor;
pianoRoll * engine::s_pianoRoll;
projectNotes * engine::s_projectNotes;
projectJournal * engine::s_projectJournal;
#ifdef LADSPA_SUPPORT
ladspa2LMMS * engine::s_ladspaManager;
#endif
QMap<QString, QString> engine::s_sample_extensions;
@@ -75,11 +70,8 @@ void engine::init( const bool _has_gui )
s_bbEditor = new bbEditor;
s_pianoRoll = new pianoRoll;
s_automationEditor = new automationEditor;
#ifdef LADSPA_SUPPORT
s_ladspaManager = new ladspa2LMMS;
#endif
s_mixer->initDevices();
s_mainWindow->finalize();
@@ -106,10 +98,7 @@ void engine::destroy( void )
s_pianoRoll = NULL;
delete s_automationEditor;
s_automationEditor = NULL;
#ifdef LADSPA_SUPPORT
delete s_ladspaManager;
#endif
presetPreviewPlayHandle::cleanUp();

View File

@@ -1,307 +0,0 @@
#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.
*
*/
#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

View File

@@ -1,201 +0,0 @@
/*
* 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 <QtGui/QLayout>
#include <QtGui/QTableWidget>
#include "ladspa_port_dialog.h"
#include "embed.h"
#include "engine.h"
#include "mixer.h"
ladspaPortDialog::ladspaPortDialog( const ladspa_key_t & _key ) :
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;
display->item( row, col )->setText( m_ladspa->getPortName(
m_key, row ) );
col++;
if( m_ladspa->isPortAudio( m_key, row ) )
{
display->item( row, col )->setText( tr( "Audio" ) );
}
else
{
display->item( row, col )->setText( tr( "Control" ) );
}
col++;
if( m_ladspa->isPortInput( m_key, row ) )
{
display->item( row, col )->setText( tr( "Input" ) );
}
else
{
display->item( row, col )->setText( tr( "Output" ) );
}
col++;
if( m_ladspa->isPortToggled( m_key, row ) )
{
display->item( row, col )->setText( tr( "Toggled" ) );
}
else if( m_ladspa->isInteger( m_key, row ) )
{
display->item( row, col )->setText( tr( "Integer" ) );
}
else
{
display->item( row, col )->setText( tr( "Float" ) );
}
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 *= engine::getMixer()->sampleRate();
}
if( max != NOHINT )
{
max *= engine::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 = "";
}
display->item( row, col )->setText( range );
col++;
if( m_ladspa->isLogarithmic( m_key, row ) )
{
display->item( row, col )->setText( tr( "Yes" ) );
}
col++;
if( m_ladspa->areHintsSampleRateDependent( m_key, row ) )
{
display->item( row, col )->setText( tr( "Yes" ) );
}
col++;
}
vlayout->addWidget( settings );
setFixedSize( display->width(), display->height() );
show();
}
ladspaPortDialog::~ ladspaPortDialog()
{
}
#include "ladspa_port_dialog.moc"

View File

@@ -143,9 +143,11 @@ mainWindow::mainWindow( void ) :
if( no_mdi == FALSE )
{
m_workspace = new QMdiArea( splitter );
m_workspace->setBackground( embed::getIconPixmap(
"background_artwork" ) );
// m_workspace->setBackgroundMode (QWidget::NoBackground);
m_workspace->setBackground( Qt::NoBrush );
m_workspace->setHorizontalScrollBarPolicy(
Qt::ScrollBarAsNeeded );
m_workspace->setVerticalScrollBarPolicy(
Qt::ScrollBarAsNeeded );
}
hbox->addWidget( side_bar );

View File

@@ -182,7 +182,6 @@ songEditor::songEditor( void ) :
m_masterVolumeSlider->setTickPosition( QSlider::TicksLeft );
m_masterVolumeSlider->setFixedSize( 26, 60 );
m_masterVolumeSlider->setTickInterval( 50 );
m_masterVolumeSlider->setInvertedAppearance( true );
toolTip::add( m_masterVolumeSlider, tr( "master volume" ) );
connect( m_masterVolumeSlider, SIGNAL( logicValueChanged( int ) ), this,
@@ -217,7 +216,6 @@ songEditor::songEditor( void ) :
m_masterPitchSlider->setTickPosition( QSlider::TicksLeft );
m_masterPitchSlider->setFixedSize( 26, 60 );
m_masterPitchSlider->setTickInterval( 12 );
m_masterPitchSlider->setInvertedAppearance( true );
toolTip::add( m_masterPitchSlider, tr( "master pitch" ) );
connect( m_masterPitchSlider, SIGNAL( logicValueChanged( int ) ), this,
SLOT( masterPitchChanged( int ) ) );
@@ -438,14 +436,9 @@ void songEditor::paintEvent( QPaintEvent * _pe )
QRect songEditor::scrollAreaRect( void ) const
{
if( centralWidget() == NULL )
{
return( rect() );
}
return( QRect( 0, 0, centralWidget()->width(),
centralWidget()->height() - m_toolBar->height() -
m_playPos[PLAY_SONG].m_timeLine->height() -
DEFAULT_SCROLLBAR_SIZE ) );
return( QRect( 0, 0, width(), height() - m_toolBar->height() -
m_playPos[PLAY_SONG].m_timeLine->height() -
DEFAULT_SCROLLBAR_SIZE ) );
}
@@ -454,18 +447,10 @@ QRect songEditor::scrollAreaRect( void ) const
// responsible for moving scrollbars after resizing
void songEditor::resizeEvent( QResizeEvent * _re )
{
if( centralWidget() != NULL )
{
m_leftRightScroll->setGeometry( 0,
centralWidget()->height() -
DEFAULT_SCROLLBAR_SIZE,
centralWidget()->width(),
DEFAULT_SCROLLBAR_SIZE );
m_playPos[PLAY_SONG].m_timeLine->setFixedWidth(
centralWidget()->width() );
m_toolBar->setFixedWidth( centralWidget()->width() );
}
m_leftRightScroll->setGeometry( 0, height() - DEFAULT_SCROLLBAR_SIZE,
width(), DEFAULT_SCROLLBAR_SIZE );
m_playPos[PLAY_SONG].m_timeLine->setFixedWidth( width() );
m_toolBar->setFixedWidth( width() );
trackContainer::resizeEvent( _re );
}
@@ -682,8 +667,8 @@ void songEditor::updatePosition( const midiTime & _t )
{
if( ( m_playing && m_playMode == PLAY_SONG ) || m_scrollBack == TRUE )
{
const int w = centralWidget()->width() -
DEFAULT_SETTINGS_WIDGET_WIDTH - TRACK_OP_WIDTH;
const int w = width() - DEFAULT_SETTINGS_WIDGET_WIDTH
- TRACK_OP_WIDTH;
if( _t > m_currentPosition + w * 64 / pixelsPerTact() )
{
m_leftRightScroll->setValue( _t.getTact() );

View File

@@ -78,7 +78,7 @@ void automatableSlider::setRange( int _min, int _max )
void automatableSlider::setValue( int _value )
{
QSlider::setValue( _value );
m_knob->setValue( minimum() + maximum() - _value );
m_knob->setValue( _value );
}
@@ -87,7 +87,7 @@ void automatableSlider::setValue( int _value )
void automatableSlider::setInitValue( int _value )
{
m_knob->setInitValue( _value );
QSlider::setValue( minimum() + maximum() - _value );
QSlider::setValue( _value );
}
@@ -155,7 +155,7 @@ void automatableSlider::moveSlider( int _value )
void automatableSlider::updateSlider( void )
{
QSlider::setValue( minimum() + maximum() - logicValue() );
QSlider::setValue( logicValue() );
}