* integrated patch by Csaba Hruska

* fixed spinbox-ranges



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1423 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-08-01 16:14:29 +00:00
parent 8e95a8463b
commit 81bfa8cdad
6 changed files with 101 additions and 15 deletions

View File

@@ -1,5 +1,13 @@
2008-08-01 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sf2_player/patches_dialog.cpp:
* plugins/sf2_player/sf2_player.cpp:
* plugins/sf2_player/patches_dialog.h:
* plugins/sf2_player/sf2_player.h:
* data/themes/default/style.css:
- integrated patch by Csaba Hruska
- fixed spinbox-ranges
* plugins/vst_base/CMakeLists.txt:
fixed include-directories for lvsl_server-target for allowing
out-of-tree builds

View File

@@ -85,7 +85,7 @@ trackWidget {
/* border-bottom: 1px solid rgb(0, 0, 0);*/
background-color: rgb(0, 0, 0);
}
nameLabel, effectLabel > QLabel {
nameLabel, effectLabel, sf2InstrumentView > QLabel {
font-size:10px;
}

View File

@@ -111,17 +111,21 @@ patchesDialog::~patchesDialog()
// Dialog setup loader.
void patchesDialog::setup ( fluid_synth_t *pSynth, int iChan, const QString & _chanName,
lcdSpinBoxModel * _bankModel, lcdSpinBoxModel * _progModel )
void patchesDialog::setup ( fluid_synth_t * pSynth, int iChan,
const QString & _chanName,
lcdSpinBoxModel * _bankModel,
lcdSpinBoxModel * _progModel,
QLabel * _patchLabel )
{
// We'll going to changes the whole thing...
m_dirty = 0;
m_bankModel = _bankModel;
m_progModel = _progModel;
m_patchLabel = _patchLabel;
// Set the proper caption...
setWindowTitle( _chanName + " - Soundfont patches");
setWindowTitle( _chanName + " - Soundfont patches" );
// set m_pSynth to NULL so we don't trigger any progChanged events
m_pSynth = NULL;
@@ -232,8 +236,10 @@ void patchesDialog::accept()
setBankProg(iBank, iProg);
if (m_dirty > 0) {
m_bankModel->setValue(iBank);
m_progModel->setValue(iProg);
m_bankModel->setValue( iBank );
m_progModel->setValue( iProg );
m_patchLabel->setText( m_progListView->
currentItem()->text( 1 ) );
}
// Do remember preview state...

View File

@@ -31,6 +31,7 @@
#include <fluidsynth.h>
#include <QtGui/QWidget>
#include <QtGui/QLabel>
//----------------------------------------------------------------------------
// qsynthPresetForm -- UI wrapper form.
@@ -49,7 +50,7 @@ public:
void setup(fluid_synth_t *pSynth, int iChan, const QString & _chanName,
lcdSpinBoxModel * _bankModel, lcdSpinBoxModel * _progModel );
lcdSpinBoxModel * _bankModel, lcdSpinBoxModel * _progModel, QLabel *_patchLabel );
public slots:
@@ -86,6 +87,7 @@ private:
lcdSpinBoxModel * m_bankModel;
lcdSpinBoxModel * m_progModel;
QLabel *m_patchLabel;
};

View File

@@ -76,8 +76,8 @@ sf2Instrument::sf2Instrument( instrumentTrack * _instrument_track ) :
m_fontId( 0 ),
m_filename( "" ),
m_lastMidiPitch( 8192 ),
m_bankNum( -1, -1, 999, this, tr("Bank") ),
m_patchNum( -1, -1, 127, this, tr("Patch") ),
m_bankNum( 0, 0, 999, this, tr("Bank") ),
m_patchNum( 0, 0, 127, this, tr("Patch") ),
m_gain( 1.0f, 0.0f, 5.0f, 0.01f, this, tr( "Gain" ) ),
m_reverbOn( 0, this, tr( "Reverb" ) ),
m_reverbRoomSize( FLUID_REVERB_DEFAULT_ROOMSIZE, 0, 1.0, 0.01f,
@@ -362,6 +362,46 @@ void sf2Instrument::updatePatch( void )
QString sf2Instrument::getCurrentPatchName( void )
{
int iBankSelected = m_bankNum.value();
int iProgSelected = m_patchNum.value();
fluid_preset_t preset;
// For all soundfonts (in reversed stack order) fill the available programs...
int cSoundFonts = ::fluid_synth_sfcount( m_synth );
for( int i = 0; i < cSoundFonts; i++ )
{
fluid_sfont_t *pSoundFont = fluid_synth_get_sfont( m_synth, i );
if (pSoundFont) {
#ifdef CONFIG_FLUID_BANK_OFFSET
int iBankOffset =
fluid_synth_get_bank_offset(
m_synth, pSoundFont->id );
#endif
pSoundFont->iteration_start( pSoundFont );
while( pSoundFont->iteration_next( pSoundFont,
&preset ) )
{
int iBank = preset.get_banknum( &preset );
#ifdef CONFIG_FLUID_BANK_OFFSET
iBank += iBankOffset;
#endif
int iProg = preset.get_num( &preset );
if( iBank == iBankSelected && iProg ==
iProgSelected )
{
return preset.get_name( &preset );
}
}
}
}
return "";
}
void sf2Instrument::updateGain( void )
{
fluid_synth_set_gain( m_synth, m_gain.value() );
@@ -613,6 +653,13 @@ sf2InstrumentView::sf2InstrumentView( instrument * _instrument,
// QVBoxLayout * vl = new QVBoxLayout( this );
// QHBoxLayout * hl = new QHBoxLayout();
sf2Instrument * k = castModel<sf2Instrument>();
connect( &k->m_bankNum, SIGNAL( dataChanged() ),
this, SLOT( updatePatchName() ) );
connect( &k->m_patchNum, SIGNAL( dataChanged() ),
this, SLOT( updatePatchName() ) );
// File Button
m_fileDialogButton = new pixmapButton( this );
m_fileDialogButton->setCursor( QCursor( Qt::PointingHandCursor ) );
@@ -646,12 +693,12 @@ sf2InstrumentView::sf2InstrumentView( instrument * _instrument,
// LCDs
m_bankNumLcd = new lcdSpinBox( 3, "21pink", this );
m_bankNumLcd->move(131, 62);
m_bankNumLcd->addTextForValue( -1, "---" );
// m_bankNumLcd->addTextForValue( -1, "---" );
// m_bankNumLcd->setEnabled( FALSE );
m_patchNumLcd = new lcdSpinBox( 3, "21pink", this );
m_patchNumLcd->move(190, 62);
m_patchNumLcd->addTextForValue( -1, "---" );
// m_patchNumLcd->addTextForValue( -1, "---" );
// m_patchNumLcd->setEnabled( FALSE );
/*hl->addWidget( m_fileDialogButton );
@@ -666,7 +713,9 @@ sf2InstrumentView::sf2InstrumentView( instrument * _instrument,
//hl = new QHBoxLayout();
m_filenameLabel = new QLabel( this );
m_filenameLabel->setGeometry( 56, 109, 156, 11 );
m_filenameLabel->setGeometry( 58, 109, 156, 11 );
m_patchLabel = new QLabel( this );
m_patchLabel->setGeometry( 58, 127, 156, 11 );
//hl->addWidget( m_filenameLabel );
// vl->addLayout( hl );
@@ -817,7 +866,7 @@ void sf2InstrumentView::modelChanged( void )
void sf2InstrumentView::updateFilename( void )
{
sf2Instrument * i = castModel<sf2Instrument>();
QFontMetrics fm( font() );
QFontMetrics fm( m_filenameLabel->font() );
QString file = i->m_filename.endsWith( ".sf2", Qt::CaseInsensitive ) ?
i->m_filename.left( i->m_filename.length() - 4 ) :
i->m_filename;
@@ -828,6 +877,24 @@ void sf2InstrumentView::updateFilename( void )
m_patchDialogButton->setEnabled( !i->m_filename.isEmpty() );
updatePatchName();
update();
}
void sf2InstrumentView::updatePatchName( void )
{
sf2Instrument * i = castModel<sf2Instrument>();
QFontMetrics fm( font() );
QString patch = i->getCurrentPatchName();
m_patchLabel->setText(
fm.elidedText( patch, Qt::ElideLeft,
m_patchLabel->width() ) );
update();
}
@@ -844,7 +911,6 @@ void sf2InstrumentView::invalidateFile( void )
void sf2InstrumentView::showFileDialog( void )
{
printf("CLICKED\n");
sf2Instrument * k = castModel<sf2Instrument>();
QFileDialog ofd( NULL, tr( "Open SoundFont file" ) );
@@ -905,7 +971,7 @@ void sf2InstrumentView::showPatchDialog( void )
}
s_patchDialog->setup( k->m_synth, 1, k->getInstrumentTrack()->name(),
&k->m_bankNum, &k->m_patchNum );
&k->m_bankNum, &k->m_patchNum, m_patchLabel );
s_patchDialog->exec();
}

View File

@@ -91,6 +91,8 @@ public:
}
virtual pluginView * instantiateView( QWidget * _parent );
QString getCurrentPatchName();
public slots:
@@ -197,6 +199,7 @@ private:
lcdSpinBox * m_patchNumLcd;
QLabel * m_filenameLabel;
QLabel * m_patchLabel;
knob * m_gainKnob;
@@ -219,6 +222,7 @@ protected slots:
void showFileDialog( void );
void showPatchDialog( void );
void updateFilename( void );
void updatePatchName( void );
} ;