* improved concept for file types supported by certain plugins

* various small improvements for an even better ZynAddSubFX integration



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1520 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-08-30 00:07:02 +00:00
parent 5d6cfc01f8
commit 9b47d27f56
34 changed files with 150 additions and 101 deletions

View File

@@ -1,3 +1,49 @@
2008-08-29 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sid/sid_instrument.cpp:
* plugins/ladspa_effect/ladspa_effect.cpp:
* plugins/patman/patman.cpp:
* plugins/lb302/lb302.cpp:
* plugins/organic/organic.cpp:
* plugins/stereo_matrix/stereo_matrix.cpp:
* plugins/bass_booster/bass_booster.cpp:
* plugins/bit_invader/bit_invader.cpp:
* plugins/vst_effect/vst_effect.cpp:
* plugins/vibed/vibed.cpp:
* plugins/triple_oscillator/triple_oscillator.cpp:
* plugins/live_tool/live_tool.cpp:
* plugins/peak_controller_effect/peak_controller_effect.cpp:
* plugins/audio_file_processor/audio_file_processor.cpp:
* plugins/audio_file_processor/audio_file_processor.h:
* plugins/stk/mallets/mallets.cpp:
* plugins/stereo_enhancer/stereo_enhancer.cpp:
* plugins/sf2_player/sf2_player.cpp:
* plugins/sf2_player/sf2_player.h:
* plugins/vestige/vestige.cpp:
* plugins/ladspa_browser/ladspa_browser.cpp:
* plugins/spectrum_analyzer/spectrum_analyzer.cpp:
* plugins/kicker/kicker.cpp:
* plugins/flp_import/flp_import.cpp:
* plugins/midi_import/midi_import.cpp:
* include/plugin.h:
* include/instrument_track.h:
* include/instrument.h:
* include/file_browser.h:
* include/preset_preview_play_handle.h:
* src/core/engine.cpp:
* src/core/preset_preview_play_handle.cpp:
* src/gui/file_browser.cpp:
- improved concept for file types supported by certain plugins
- various small improvements for an even better ZynAddSubFX integration
* src/tracks/instrument_track.cpp:
pass all MIDI events to instrument
* include/remote_plugin.h:
* src/core/remote_plugin.cpp:
added remotePlugin-framework allowing to easily write plugins which
actually run as external process
2008-08-28 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_base/lvsl_client.cpp:

View File

@@ -174,6 +174,7 @@ public:
{
ProjectFile,
PresetFile,
SpecialPresetFile,
SampleFile,
MidiFile,
FlpFile,

View File

@@ -62,7 +62,9 @@ public:
// to be implemented by actual plugin
virtual void playNote( notePlayHandle * _note_to_play,
bool _try_parallelizing,
sampleFrame * _working_buf ) = 0;
sampleFrame * _working_buf )
{
}
// needed for deleting plugin-specific-data of a note - plugin has to
// cast void-ptr so that the plugin-data is deleted properly

View File

@@ -90,6 +90,11 @@ public:
return( m_instrument );
}
inline instrument * getInstrument( void )
{
return( m_instrument );
}
void deleteNotePluginData( notePlayHandle * _n );
// name-stuff

View File

@@ -72,6 +72,12 @@ public:
int version;
PluginTypes type;
const pixmapLoader * logo;
const char * supportedFileTypes;
inline bool supportsFileType( const QString & _ext ) const
{
return( QString( supportedFileTypes ).
split( ',' ).contains( _ext ) );
}
class EXPORT subPluginFeatures
{
public:
@@ -128,12 +134,6 @@ public:
{
}
virtual const QStringList & supportedExtensions( void )
{
static QStringList no_extensions;
return( no_extensions );
}
protected:
const plugin::PluginTypes m_type;

View File

@@ -37,7 +37,8 @@ class previewTrackContainer;
class presetPreviewPlayHandle : public playHandle
{
public:
presetPreviewPlayHandle( const QString & _preset_file );
presetPreviewPlayHandle( const QString & _preset_file,
bool _special_preset = false );
virtual ~presetPreviewPlayHandle();
virtual void play( bool _try_parallelizing,

View File

@@ -61,7 +61,8 @@ plugin::descriptor PLUGIN_EXPORT audiofileprocessor_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
new audioFileProcessor::subPluginFeatures( plugin::Instrument )
"wav,ogg,ds,spx,au,voc,aif,aiff,flac,raw",
NULL
} ;
}
@@ -273,28 +274,6 @@ void audioFileProcessor::loopPointChanged( void )
audioFileProcessor::subPluginFeatures::subPluginFeatures(
plugin::PluginTypes _type ) :
plugin::descriptor::subPluginFeatures( _type )
{
}
const QStringList & audioFileProcessor::subPluginFeatures::supportedExtensions(
void )
{
static QStringList extensions = QStringList()
<< "wav" << "ogg" << "ds" << "spx" << "au"
<< "voc" << "aif" << "aiff" << "flac" << "raw";
return( extensions );
}
class audioFileKnob : public knob
{
public:

View File

@@ -41,16 +41,6 @@ class audioFileProcessor : public instrument
{
Q_OBJECT
public:
class subPluginFeatures : public plugin::descriptor::subPluginFeatures
{
public:
subPluginFeatures( plugin::PluginTypes _type );
virtual const QStringList & supportedExtensions( void );
} ;
audioFileProcessor( instrumentTrack * _instrument_track );
virtual ~audioFileProcessor();

View File

@@ -43,6 +43,7 @@ plugin::descriptor PLUGIN_EXPORT bassbooster_plugin_descriptor =
0x0100,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -61,6 +61,7 @@ plugin::descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -75,6 +75,7 @@ plugin::descriptor PLUGIN_EXPORT flpimport_plugin_descriptor =
0x0100,
plugin::ImportFilter,
NULL,
NULL,
NULL
} ;

View File

@@ -50,6 +50,7 @@ plugin::descriptor PLUGIN_EXPORT kicker_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -57,6 +57,7 @@ plugin::descriptor PLUGIN_EXPORT ladspabrowser_plugin_descriptor =
0x0100,
plugin::Tool,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -54,6 +54,7 @@ plugin::descriptor PLUGIN_EXPORT ladspaeffect_plugin_descriptor =
0x0100,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
new ladspaSubPluginFeatures( plugin::Effect )
} ;

View File

@@ -87,6 +87,7 @@ plugin::descriptor PLUGIN_EXPORT lb302_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
};

View File

@@ -56,6 +56,7 @@ plugin::descriptor PLUGIN_EXPORT livetool_plugin_descriptor =
0x0100,
plugin::Tool,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -58,6 +58,7 @@ plugin::descriptor PLUGIN_EXPORT midiimport_plugin_descriptor =
0x0100,
plugin::ImportFilter,
NULL,
NULL,
NULL
} ;

View File

@@ -56,6 +56,7 @@ plugin::descriptor PLUGIN_EXPORT organic_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -58,6 +58,7 @@ plugin::descriptor PLUGIN_EXPORT patman_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
new patmanInstrument::subPluginFeatures( plugin::Instrument )
} ;

View File

@@ -46,6 +46,7 @@ plugin::descriptor PLUGIN_EXPORT peakcontrollereffect_plugin_descriptor =
0x0100,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -58,7 +58,8 @@ plugin::descriptor sf2player_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
new sf2Instrument::subPluginFeatures( plugin::Instrument )
"sf2",
NULL
} ;
}
@@ -634,22 +635,9 @@ 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 );
}
class sf2Knob : public knob
{
public:

View File

@@ -48,14 +48,6 @@ 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();
@@ -85,11 +77,6 @@ public:
return( FALSE );
}
virtual bool supportsParallelizing( void ) const
{
return( FALSE );
}
virtual pluginView * instantiateView( QWidget * _parent );
QString getCurrentPatchName();

View File

@@ -80,6 +80,7 @@ plugin::descriptor PLUGIN_EXPORT sid_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -44,6 +44,7 @@ plugin::descriptor PLUGIN_EXPORT spectrumanalyzer_plugin_descriptor =
0x0100,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -43,6 +43,7 @@ plugin::descriptor PLUGIN_EXPORT stereoenhancer_plugin_descriptor =
0x0100,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -43,6 +43,7 @@ plugin::descriptor PLUGIN_EXPORT stereomatrix_plugin_descriptor =
0x0100,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -52,6 +52,7 @@ plugin::descriptor malletsstk_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -58,6 +58,7 @@ plugin::descriptor PLUGIN_EXPORT tripleoscillator_plugin_descriptor =
0x0110,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -59,6 +59,7 @@ plugin::descriptor vestige_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
} ;

View File

@@ -57,6 +57,7 @@ plugin::descriptor PLUGIN_EXPORT vibedstrings_plugin_descriptor =
0x0100,
plugin::Instrument,
new pluginPixmapLoader( "logo" ),
NULL,
NULL
};

View File

@@ -50,6 +50,7 @@ plugin::descriptor vsteffect_plugin_descriptor =
0x0200,
plugin::Effect,
new pluginPixmapLoader( "logo" ),
NULL,
new vstSubPluginFeatures( plugin::Effect )
} ;

View File

@@ -173,19 +173,14 @@ void engine::loadExtensions( void )
pluginDescriptors.begin();
it != pluginDescriptors.end(); ++it )
{
if( it->sub_plugin_features )
if( it->type == plugin::Instrument )
{
if( it->type == plugin::Instrument )
{
const QStringList & ext =
it->sub_plugin_features
->supportedExtensions();
for( QStringList::const_iterator itExt =
ext.begin();
const QStringList & ext =
QString( it->supportedFileTypes ).split( ',' );
for( QStringList::const_iterator itExt = ext.begin();
itExt != ext.end(); ++itExt )
{
s_sampleExtensions[*itExt] = it->name;
}
{
s_sampleExtensions[*itExt] = it->name;
}
}
}

View File

@@ -26,7 +26,7 @@
*/
#include <QtCore/QMutex>
#include <QtCore/QFileInfo>
#include <QtCore/QMutexLocker>
#include "preset_preview_play_handle.h"
@@ -104,8 +104,8 @@ previewTrackContainer * presetPreviewPlayHandle::s_previewTC;
presetPreviewPlayHandle::presetPreviewPlayHandle(
const QString & _preset_file ) :
presetPreviewPlayHandle::presetPreviewPlayHandle( const QString & _preset_file,
bool _special_preset ) :
playHandle( PresetPreviewHandle ),
m_previewNote( NULL )
{
@@ -120,9 +120,30 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
const bool j = engine::getProjectJournal()->isJournalling();
engine::getProjectJournal()->setJournalling( FALSE );
multimediaProject mmp( _preset_file );
s_previewTC->previewInstrumentTrack()->loadTrackSpecificSettings(
if( _special_preset )
{
instrument * i = s_previewTC->previewInstrumentTrack()->
getInstrument();
const QString ext = QFileInfo( _preset_file ).
suffix().toLower();
if( i == NULL || !i->getDescriptor()->supportsFileType( ext ) )
{
i = s_previewTC->previewInstrumentTrack()->
loadInstrument(
engine::sampleExtensions()[ext] );
}
if( i != NULL )
{
i->setParameter( "samplefile", _preset_file );
}
}
else
{
multimediaProject mmp( _preset_file );
s_previewTC->previewInstrumentTrack()->
loadTrackSpecificSettings(
mmp.content().firstChild().toElement() );
}
// make sure, our preset-preview-track does not appear in any MIDI-
// devices list, so just disable receiving/sending MIDI-events at all

View File

@@ -211,7 +211,8 @@ void listView::activateListItem( QTreeWidgetItem * _item, int _column )
return;
}
if( f->type() == fileItem::SampleFile )
if( f->type() == fileItem::SampleFile ||
f->type() == fileItem::SpecialPresetFile )
{
// samples are per default opened in bb-editor because they're
// likely drum-samples etc.
@@ -283,17 +284,19 @@ void listView::sendToActiveInstrumentTrack( void )
// ok, it's an instrument-track, so we can apply the
// sample or the preset
engine::getMixer()->lock();
if( m_contextMenuItem->type() == fileItem::SampleFile )
if( m_contextMenuItem->type() == fileItem::SampleFile ||
m_contextMenuItem->type() ==
fileItem::SpecialPresetFile )
{
instrument * afp = itw->model()->loadInstrument(
engine::sampleExtensions()
[m_contextMenuItem
->extension()] );
if( afp != NULL )
QString e = m_contextMenuItem->extension();
instrument * i = itw->model()->getInstrument();
if( !i->getDescriptor()->supportsFileType( e ) )
{
afp->setParameter( "samplefile",
m_contextMenuItem->fullName() );
i = itw->model()->loadInstrument(
engine::sampleExtensions()[e] );
}
i->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
else if( m_contextMenuItem->type() ==
fileItem::PresetFile )
@@ -317,20 +320,21 @@ void listView::sendToActiveInstrumentTrack( void )
void listView::openInNewInstrumentTrack( trackContainer * _tc )
{
engine::getMixer()->lock();
if( m_contextMenuItem->type() == fileItem::SampleFile )
if( m_contextMenuItem->type() == fileItem::SampleFile ||
m_contextMenuItem->type() == fileItem::SpecialPresetFile )
{
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
track::create( track::InstrumentTrack, _tc ) );
#ifdef LMMS_DEBUG
assert( ct != NULL );
#endif
instrument * afp = ct->loadInstrument(
instrument * i = ct->loadInstrument(
engine::sampleExtensions()
[m_contextMenuItem
->extension()] );
if( afp != NULL )
if( i != NULL )
{
afp->setParameter( "samplefile",
i->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
//ct->toggledInstrumentTrackButton( TRUE );
@@ -385,7 +389,8 @@ void listView::contextMenuEvent( QContextMenuEvent * _e )
{
fileItem * f = dynamic_cast<fileItem *>( itemAt( _e->pos() ) );
if( f != NULL && ( f->type() == fileItem::SampleFile ||
f->type() == fileItem::PresetFile ) )
f->type() == fileItem::SpecialPresetFile ||
f->type() == fileItem::PresetFile ) )
{
m_contextMenuItem = f;
QMenu contextMenu( this );
@@ -459,10 +464,13 @@ void listView::mousePressEvent( QMouseEvent * _me )
m_previewPlayHandle = s;
delete tf;
}
else if( f->type() == fileItem::PresetFile )
else if( f->type() == fileItem::PresetFile ||
f->type() == fileItem::SpecialPresetFile )
{
m_previewPlayHandle = new presetPreviewPlayHandle(
f->fullName() );
m_previewPlayHandle =
new presetPreviewPlayHandle( f->fullName(),
f->type() ==
fileItem::SpecialPresetFile );
}
if( m_previewPlayHandle != NULL )
{
@@ -794,6 +802,7 @@ void fileItem::initPixmapStuff( void )
setIcon( 0, *s_projectFilePixmap );
break;
case PresetFile:
case SpecialPresetFile:
setIcon( 0, *s_presetFilePixmap );
break;
case SampleFile:
@@ -843,6 +852,10 @@ void fileItem::determineFileType( void )
{
m_type = PresetFile;
}
else if( ext == "xiz" )
{
m_type = SpecialPresetFile;
}
else if( engine::sampleExtensions().contains( ext ) )
{
m_type = SampleFile;