More SF2 fixes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@812 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-03-30 17:56:57 +00:00
parent 0355877769
commit aad7608b64
3 changed files with 31 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
2008-03-24 Paul Giblock <drfaygo/at/gmail/dot/com>
* plugins/sf2_player/sf2_player.cpp:
* plugins/sf2_player/sf2_player.h:
Fix patch dialog error when viewing dialog before file has loaded -
all we had to do is diable the button while a file is loading
2008-03-30 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sf2_player/sf2_player.cpp:

View File

@@ -151,6 +151,8 @@ QString sf2Instrument::nodeName( void ) const
void sf2Instrument::openFile( const QString & _sf2File )
{
emit fileLoading();
// Remove synth from this fluidSynth (but not necessarily memory)
if ( m_filename != "" )
{
@@ -377,6 +379,8 @@ sf2InstrumentView::sf2InstrumentView( instrument * _instrument,
"track_op_menu" ) );
m_patchDialogButton->setInactiveGraphic( embed::getIconPixmap(
"track_op_menu" ) );
m_patchDialogButton->setEnabled( FALSE );
connect( m_patchDialogButton, SIGNAL( clicked() ),
this, SLOT( showPatchDialog() ) );
toolTip::add( m_patchDialogButton, tr( "Choose the patch" ) );
@@ -435,6 +439,9 @@ void sf2InstrumentView::modelChanged( void )
connect(k, SIGNAL( fileChanged( void ) ),
this, SLOT( updateFilename( void ) ) );
connect(k, SIGNAL( fileLoading( void ) ),
this, SLOT( invalidateFile( void ) ) );
updateFilename();
}
@@ -443,13 +450,20 @@ void sf2InstrumentView::modelChanged( void )
void sf2InstrumentView::updateFilename( void )
{
sf2Instrument * i = castModel<sf2Instrument>();
m_filenameLabel->setText( "File: " +
castModel<sf2Instrument>()->m_filename +
i->m_filename +
"\nPatch: TODO" );
m_patchDialogButton->setEnabled( !i->m_filename.isEmpty() );
update();
}
void sf2InstrumentView::invalidateFile( void )
{
m_patchDialogButton->setEnabled( false );
}
void sf2InstrumentView::showFileDialog( void )
{
@@ -483,6 +497,8 @@ void sf2InstrumentView::showFileDialog( void )
ofd.setDirectory( configManager::inst()->userSamplesDir() );
}
m_fileDialogButton->setEnabled( false );
if( ofd.exec() == QDialog::Accepted && !ofd.selectedFiles().isEmpty() )
{
QString f = ofd.selectedFiles()[0];
@@ -492,6 +508,8 @@ void sf2InstrumentView::showFileDialog( void )
engine::getSong()->setModified();
}
}
m_fileDialogButton->setEnabled( true );
}

View File

@@ -100,6 +100,8 @@ private:
// Protect synth when we are re-creating it.
QMutex m_synthMutex;
QMutex m_loadMutex;
int m_notesRunning[128];
lcdSpinBoxModel m_bankNum;
@@ -117,6 +119,7 @@ private:
friend class sf2InstrumentView;
signals:
void fileLoading( void );
void fileChanged( void );
void patchChanged( void );
@@ -161,6 +164,7 @@ private:
static patchesDialog * s_patchDialog;
protected slots:
void invalidateFile( void );
void showFileDialog( void );
void showPatchDialog( void );
void updateFilename( void );