From eb4931f321d556369d9597e559a26e0df1c1f38b Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 2 Jun 2008 17:34:50 +0000 Subject: [PATCH] Load SF2 files from sidebar git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1053 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 10 ++++++++++ plugins/sf2_player/sf2_player.cpp | 32 ++++++++++++++++++++++++++++++- plugins/sf2_player/sf2_player.h | 11 +++++++++++ src/gui/main_window.cpp | 4 ++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 75bc9b749..1a326a46f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-02 Paul Giblock + + * plugins/sf2_player/sf2_player.cpp: + * plugins/sf2_player/sf2_player.h: + * src/gui/main_window.cpp: + Support loading of sf2 files from the sidebar sample browser + 2008-06-02 Tobias Doerffel * plugins/patman/patman.cpp: @@ -121,6 +128,9 @@ * src/core/track.cpp: Correct misleading textFloat + * src/core/song.cpp: + Code style + 2008-06-01 Paul Giblock * src/tracks/pattern.cpp: diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index c5e818061..66987545a 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -58,7 +58,7 @@ plugin::descriptor sf2player_plugin_descriptor = 0x0100, plugin::Instrument, new pluginPixmapLoader( "logo" ), - NULL + new sf2Instrument::subPluginFeatures( plugin::Instrument ) } ; } @@ -225,6 +225,18 @@ void sf2Instrument::loadSettings( const QDomElement & _this ) +void sf2Instrument::setParameter( const QString & _param, + const QString & _value ) +{ + if( _param == "samplefile" ) + { + openFile( _value ); + } +} + + + + QString sf2Instrument::nodeName( void ) const { return( sf2player_plugin_descriptor.name ); @@ -547,6 +559,24 @@ pluginView * sf2Instrument::instantiateView( QWidget * _parent ) +sf2Instrument::subPluginFeatures::subPluginFeatures( + plugin::PluginTypes _type ) : + plugin::descriptor::subPluginFeatures( _type ) +{ +} + + + + +const QStringList & sf2Instrument::subPluginFeatures::supportedExtensions( + void ) +{ + static QStringList extensions = QStringList() + << "sf2"; + return( extensions ); +} + + sf2InstrumentView::sf2InstrumentView( instrument * _instrument, diff --git a/plugins/sf2_player/sf2_player.h b/plugins/sf2_player/sf2_player.h index ecad1e1e3..b6c2362fc 100644 --- a/plugins/sf2_player/sf2_player.h +++ b/plugins/sf2_player/sf2_player.h @@ -48,6 +48,14 @@ class sf2Instrument : public instrument { Q_OBJECT public: + class subPluginFeatures : public plugin::descriptor::subPluginFeatures + { + public: + subPluginFeatures( plugin::PluginTypes _type ); + + virtual const QStringList & supportedExtensions( void ); + } ; + sf2Instrument( instrumentTrack * _instrument_track ); virtual ~sf2Instrument(); @@ -62,6 +70,9 @@ public: virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); virtual void loadSettings( const QDomElement & _this ); + virtual void setParameter( const QString & _param, + const QString & _value ); + virtual QString nodeName( void ) const; virtual f_cnt_t desiredReleaseFrames( void ) const diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp index eb4a1af65..dc7571dc0 100644 --- a/src/gui/main_window.cpp +++ b/src/gui/main_window.cpp @@ -108,6 +108,10 @@ mainWindow::mainWindow( void ) : sample_filter += " *." + *it; } +#ifdef FLUIDSYNTH_SUPPORT + sample_filer += " *.sf2"; +#endif + int id = 0; QString wdir = configManager::inst()->workingDir(); side_bar->appendTab( new pluginBrowser( splitter ), ++id );