fundamental changes in plugin-architecture, added plugin-browser, bug-fixes - see ChangeLog for further details

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@18 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2005-10-20 13:02:26 +00:00
parent 58fe360793
commit f55c124be6
96 changed files with 5262 additions and 234 deletions

View File

@@ -80,7 +80,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
int FASTCALL setHWParams( Uint32 _sample_rate, Uint32 _channels,
snd_pcm_access_t _access );

View File

@@ -68,7 +68,7 @@ public:
void FASTCALL writeBuffer( surroundSampleFrame * _ab, Uint32 _frames,
Uint32 _src_sample_rate,
float _master_output );
float _master_gain );
inline Uint32 sampleRate( void ) const
{
@@ -104,12 +104,12 @@ public:
protected:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output ) = 0;
float _master_gain ) = 0;
// convert a given audio-buffer to a buffer in signed 16-bit samples
// returns num of bytes in outbuf
int FASTCALL convertToS16( surroundSampleFrame * _ab, Uint32 _frames,
float _master_output,
float _master_gain,
outputSampleType * _output_buffer,
bool _convert_endian = FALSE );

View File

@@ -64,7 +64,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
bool startEncoding( void );
void finishEncoding( void );

View File

@@ -57,7 +57,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
bool startEncoding( void );
void finishEncoding( void );

View File

@@ -91,7 +91,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
void clearBuffer( void );

View File

@@ -75,7 +75,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
int m_audioFD;

View File

@@ -63,7 +63,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
typedef vvector<QPair<sampleFrame *, Uint32> > bufferVector;
bufferVector m_buffers;

View File

@@ -88,7 +88,7 @@ public:
private:
virtual void FASTCALL writeBufferToDev( surroundSampleFrame * _ab,
Uint32 _frames,
float _master_output );
float _master_gain );
void clearBuffer( void );

View File

@@ -54,11 +54,9 @@ public:
NOTCH,
ALLPASS,
MOOG,
MOOG2,
SIMPLE_FLT_CNT,
DOUBLE_LOWPASS = 16+LOWPASS,
DOUBLE_MOOG = 16+MOOG,
DOUBLE_MOOG2 = 16+MOOG2
DOUBLE_MOOG = 16+MOOG
} ;
static inline filterTypes getFilterType( const int _idx )
@@ -127,7 +125,7 @@ public:
m_y4[_chnl] * ( 1.0f / 6.0f );
break;
}
case MOOG2:
/* case MOOG2:
case DOUBLE_MOOG2:
{
const float x1 = ( _in0 - m_r *
@@ -190,7 +188,7 @@ public:
out = m_oldx[_chnl];
break;
}
}*/
default:
// filter
@@ -251,7 +249,7 @@ public:
break;
}
case DOUBLE_MOOG2:
/* case DOUBLE_MOOG2:
{
if( m_subFilter == NULL )
{
@@ -276,7 +274,7 @@ public:
kfcr * kf ) );
m_r = 4 * _q * kacr;
break;
}
}*/
default:
{

View File

@@ -83,10 +83,10 @@ public:
protected:
void closeEvent( QCloseEvent * _ce );
void keyPressEvent (QKeyEvent * _ke);
void wheelEvent( QWheelEvent * _we );
void resizeEvent( QResizeEvent * _re );
virtual void closeEvent( QCloseEvent * _ce );
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void resizeEvent( QResizeEvent * _re );
void updateBackground( void );

View File

@@ -105,6 +105,11 @@ public:
{
return( m_lmmsDataDir + LOCALE_PATH );
}
const QString & pluginDir( void ) const
{
return( m_lmmsPluginDir );
}
const QString & value( const QString & _class,
const QString & _attribute ) const;
@@ -148,6 +153,7 @@ private:
const QString m_lmmsRcFile;
QString m_lmmsWorkingDir;
QString m_lmmsDataDir;
QString m_lmmsPluginDir;
typedef vvector<QPair<QString, QString> > stringPairVector;
typedef QMap<QString, stringPairVector> settingsMap;

View File

@@ -0,0 +1,61 @@
/*
* dummy_instrument.h - instrument used as fallback if an instrument couldn't
* be loaded
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _DUMMY_INSTRUMENT_H
#define _DUMMY_INSTRUMENT_H
#include "instrument.h"
class dummyInstrument : public instrument
{
public:
inline dummyInstrument( channelTrack * _channel_track ) :
instrument( _channel_track, "Dummy instrument" )
{
}
inline virtual ~dummyInstrument()
{
}
inline virtual void saveSettings( QDomDocument &, QDomElement & )
{
}
inline virtual void loadSettings( const QDomElement & )
{
}
inline virtual QString nodeName( void ) const
{
return( "dummyinstrument" );
}
} ;
#endif

61
include/dummy_plugin.h Normal file
View File

@@ -0,0 +1,61 @@
/*
* dummy_plugin.h - empty plugin which is used as fallback if a plugin wasn't
* found
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _DUMMY_PLUGIN_H
#define _DUMMY_PLUGIN_H
#include "plugin.h"
class dummyPlugin : public plugin
{
public:
inline dummyPlugin( void ) :
plugin( "Dummy plugin", plugin::UNDEFINED )
{
}
inline virtual ~dummyPlugin()
{
}
inline virtual void saveSettings( QDomDocument &, QDomElement & )
{
}
inline virtual void loadSettings( const QDomElement & )
{
}
inline virtual QString nodeName( void ) const
{
return( "dummyplugin" );
}
} ;
#endif

View File

@@ -42,10 +42,31 @@
namespace embed
{
struct descriptor
{
int size;
const unsigned char * data;
const char * name;
} ;
QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
QString getText( const char * _name );
void loadTranslation( const QString & _tname );
}
#ifdef PLUGIN_NAME
namespace PLUGIN_NAME
{
QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
QString getText( const char * _name );
void loadTranslation( const QString & _tname );
}
#endif
#endif

View File

@@ -31,6 +31,12 @@
#include <config.h>
#endif
#ifdef HAVE_LADSPA_H
#define LADSPA_SUPPORT
#include <ladspa.h>
#include "qt3support.h"
#ifdef QT4
@@ -49,9 +55,10 @@
#endif
#include <ladspa.h>
#include "types.h"
typedef QPair<QString, QString> ladspaKey;
/* ladspaManager provides a database of LADSPA plug-ins. Upon instantiation,
@@ -188,7 +195,7 @@ public:
/* The following methods are convenience functions for use during
development. A real soundGenerator should use the getDescriptor()
development. A real instrument should use the getDescriptor()
method and implement the plug-in manipulations internally to avoid
the overhead associated with QMap lookups. */
@@ -326,5 +333,7 @@ private:
typedef QMap<ladspaKey, ladspaManagerDescription *> ladspaManagerMapType;
ladspaManagerMapType m_ladspaManagerMap;
};
#endif
#endif

View File

@@ -57,6 +57,7 @@
class audioDevice;
class midiDevice;
class lmmsMainWin;
class plugin;
const int DEFAULT_BUFFER_SIZE = 512;
@@ -174,7 +175,8 @@ public:
m_playHandlesToRemove.push_back( _ph );
}
void FASTCALL checkValidityOfPlayHandles( void );
void checkValidityOfPlayHandles( void );
inline int sampleRate( void )
@@ -319,7 +321,6 @@ private:
volatile bool m_quit;
audioDevice * m_audioDev;
audioDevice * m_oldAudioDev;
QString m_audioDevName;

133
include/plugin.h Normal file
View File

@@ -0,0 +1,133 @@
/*
* plugin.h - class plugin, the base-class and generic interface for all plugins
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _PLUGIN_H
#define _PLUGIN_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QString>
#include <QVector>
#else
#include <qstring.h>
#include <qvaluevector.h>
#endif
#include "types.h"
#include "settings.h"
#include "embed.h"
#define STRINGIFY_PLUGIN_NAME(s) STR(s)
#define STR(PN) #PN
class QPixmap;
class plugin : public settings
{
public:
enum pluginTypes
{
INSTRUMENT, // instrument being used in channel-track
EFFECT, // effect-plugin for effect-board
IMPORT_FILTER, // filter for importing a file
EXPORT_FILTER, // filter for exporting a file
UNDEFINED = 255
} ;
// descriptor holds information about a plugin - every external plugin
// has to instantiate such a descriptor in an extern "C"-section so that
// the plugin-loader is able to access information about the plugin
struct descriptor
{
const char * name;
const char * public_name;
const char * description;
const char * author;
int version;
pluginTypes type;
embed::descriptor logo;
} ;
// contructor of a plugin
// _name: public name of plugin
// _type: one of the plugin-types defined above
plugin( const QString & _public_name, pluginTypes _type );
virtual ~plugin();
// returns the name, the plugin passed to plugin-constructor
inline const QString & publicName( void ) const
{
return( m_publicName );
}
// return type
inline pluginTypes type( void ) const
{
return( m_type );
}
// plugins can overload this for making other classes able to change
// settings of the plugin without knowing the actual class
virtual void FASTCALL setParameter( const QString & _param,
const QString & _value );
// plugins can overload this for making other classes able to query
// settings of the plugin without knowing the actual class
virtual QString FASTCALL getParameter( const QString & _param );
// returns an instance of a plugin whose name matches to given one
// if specified plugin couldn't be loaded, it creates a dummy-plugin
static plugin * FASTCALL instantiate( const QString & _plugin_name,
void * _data );
// fills given vector with descriptors for all available plugins
static void FASTCALL getDescriptorsOfAvailPlugins(
vvector<descriptor> & _plugin_descs );
private:
const QString m_publicName;
const pluginTypes m_type;
// pointer to instantiation-function in plugin
typedef plugin * ( * instantiationHook )( void * );
} ;
#endif

96
include/plugin_browser.h Normal file
View File

@@ -0,0 +1,96 @@
/*
* plugin_browser.h - include file for pluginBrowser
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _PLUGIN_BROWSER_H
#define _PLUGIN_BROWSER_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QVector>
#include <QPixmap>
#else
#include <qvaluevector.h>
#include <qpixmap.h>
#endif
#include "side_bar_widget.h"
#include "plugin.h"
class trackContainer;
class pluginBrowser : public sideBarWidget
{
Q_OBJECT
public:
pluginBrowser( QWidget * _parent );
virtual ~pluginBrowser();
private:
vvector<plugin::descriptor> m_pluginDescriptors;
QWidget * m_view;
} ;
class pluginDescWidget : public QWidget
{
public:
pluginDescWidget( const plugin::descriptor & _pd, QWidget * _parent );
virtual ~pluginDescWidget();
protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
private:
const plugin::descriptor & m_pluginDescriptor;
QPixmap m_logo;
bool m_mouseOver;
} ;
#endif

View File

@@ -48,7 +48,7 @@ class sideBarWidget : public QWidget
public:
sideBarWidget( const QString & _title, const QPixmap & _icon,
QWidget * _parent );
~sideBarWidget();
virtual ~sideBarWidget();
inline const QPixmap & icon( void ) const
{
return( m_icon );
@@ -60,9 +60,9 @@ public:
protected:
void paintEvent( QPaintEvent * _pe );
void resizeEvent( QResizeEvent * _re );
inline void contextMenuEvent( QContextMenuEvent * )
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
inline virtual void contextMenuEvent( QContextMenuEvent * )
{
}

View File

@@ -229,7 +229,6 @@ protected:
protected slots:
void insertTact( void );
void removeTact( void );
void addChannelTrack( void );
void addBBTrack( void );
void addSampleTrack( void );
void scrolled( int _new_pos );

View File

@@ -0,0 +1,64 @@
/*
* string_pair_drag.h - class stringPairDrag which provides general support
* for drag'n'drop of string-pairs
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _STRING_PAIR_DRAG_H
#define _STRING_PAIR_DRAG_H
#include "qt3support.h"
#ifdef QT4
#include <QDrag>
#else
#include <qdragobject.h>
#endif
class QPixmap;
class stringPairDrag : public
#ifdef QT4
QDrag
#else
QStoredDrag
#endif
{
public:
stringPairDrag( const QString & _key, const QString & _value,
const QPixmap & _icon, QWidget * _w );
~stringPairDrag();
static void processDragEnterEvent( QDragEnterEvent * _dee,
const QString & _allowed_keys );
static QString decodeKey( QDropEvent * _de );
static QString decodeValue( QDropEvent * _de );
} ;
#endif

View File

@@ -227,7 +227,7 @@ public:
public slots:
void changePosition( const midiTime & _new_pos = -1 );
void cloneTrack( void );
void deleteTrack( void );
void removeTrack( void );
void moveTrackUp( void );
void moveTrackDown( void );
void setMuted( bool _muted );
@@ -271,11 +271,10 @@ public:
track( trackContainer * _tc );
virtual ~track();
static track * FASTCALL createTrack( trackTypes _tt,
static track * FASTCALL create( trackTypes _tt, trackContainer * _tc );
static track * FASTCALL create( const QDomElement & _this,
trackContainer * _tc );
static track * FASTCALL createTrack( const QDomElement & _this,
trackContainer * _tc );
static track * FASTCALL cloneTrack( track * _track );
static track * FASTCALL clone( track * _track );
tact length( void ) const;

View File

@@ -93,10 +93,13 @@ public:
protected:
virtual void resizeEvent( QResizeEvent * );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
constTrackVector tracks( void ) const;
trackVector tracks( void );
virtual void resizeEvent( QResizeEvent * );
midiTime m_currentPosition;
@@ -106,16 +109,33 @@ protected slots:
private:
QScrollArea * m_scrollArea;
class scrollArea : public QScrollArea
{
public:
scrollArea( trackContainer * _parent );
virtual ~scrollArea();
protected:
virtual void wheelEvent( QWheelEvent * _we );
} ;
scrollArea * m_scrollArea;
typedef vvector<trackWidget *> trackWidgetVector;
trackWidgetVector m_trackWidgets;
float m_ppt;
friend class scrollArea;
signals:
void positionChanged( const midiTime & _pos );
} ;

View File

@@ -1,5 +1,6 @@
/*
* volume.h - declaration of some constants and types, concerning the volume of a note
* volume.h - declaration of some constants and types, concerning the volume
* of a note
*
* Linux MultiMedia Studio
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>