From aad7608b64273551c1e5f3d9a658a5e0820585a1 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sun, 30 Mar 2008 17:56:57 +0000 Subject: [PATCH] More SF2 fixes git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@812 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 7 +++++++ plugins/sf2_player/sf2_player.cpp | 22 ++++++++++++++++++++-- plugins/sf2_player/sf2_player.h | 4 ++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53f8a7a13..5ae574fdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-24 Paul Giblock + + * 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 * plugins/sf2_player/sf2_player.cpp: diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index a40c76c2c..0a223600c 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -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(); m_filenameLabel->setText( "File: " + - castModel()->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 ); } diff --git a/plugins/sf2_player/sf2_player.h b/plugins/sf2_player/sf2_player.h index 1f963df56..baa01b7c7 100644 --- a/plugins/sf2_player/sf2_player.h +++ b/plugins/sf2_player/sf2_player.h @@ -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 );