123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- /*
- * ladspa_port_dialog.cpp - dialog to test a LADSPA plugin
- *
- * Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
- *
- * This file is part of LMMS - https://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 "ladspa_port_dialog.h"
- #include <QLayout>
- #include <QTableWidget>
- #include "embed.h"
- #include "Engine.h"
- #include "Ladspa2LMMS.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 );
- int 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( int row = 0; row < pc; row++ )
- {
- for( int col = 0; col < 7; ++col )
- {
- QTableWidgetItem * item = new QTableWidgetItem;
- item->setFlags(QFlag(0));
- settings->setItem( row, col, item );
- }
- int 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::mixer()->processingSampleRate();
- }
- if( max != NOHINT )
- {
- max *= Engine::mixer()->processingSampleRate();
- }
- }
- 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()
- {
- }
|