M/V-split for instrument-tracks

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@638 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-01-03 00:57:51 +00:00
parent e07c7fccee
commit ea467f92b7
8 changed files with 254 additions and 94 deletions

View File

@@ -2,7 +2,7 @@
* dummy_instrument.h - instrument used as fallback if an instrument couldn't
* be loaded
*
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,8 +33,8 @@
class dummyInstrument : public instrument
{
public:
inline dummyInstrument( instrumentTrack * _channel_track ) :
instrument( _channel_track, NULL )
inline dummyInstrument( instrumentTrack * _instrument_track ) :
instrument( _instrument_track, NULL )
{
}
@@ -56,6 +56,10 @@ public:
return( "dummyinstrument" );
}
virtual instrumentView * createView( QWidget * _parent )
{
return( new instrumentView( this, _parent ) );
}
} ;

View File

@@ -2,7 +2,7 @@
* instrument.h - declaration of class instrument, which provides a
* standard interface for all instrument plugins
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,29 +27,33 @@
#ifndef _INSTRUMENT_H
#define _INSTRUMENT_H
#include <QtGui/QWidget>
#include <QtCore/QVector>
#include "plugin.h"
#include "mixer.h"
#include "mv_base.h"
// forward-declarations
class instrumentTrack;
class notePlayHandle;
class instrumentView;
class midiEvent;
class midiTime;
class notePlayHandle;
class track;
class instrument : public QWidget, public plugin
class instrument : public plugin, public model
{
public:
instrument( instrumentTrack * _channel_track,
instrument( instrumentTrack * _instrument_track,
const descriptor * _descriptor );
virtual ~instrument();
// --------------------------------------------------------------------
// functions that can/should be re-implemented:
// --------------------------------------------------------------------
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes it's
// output buffer only once per mixer-period
@@ -101,13 +105,20 @@ public:
return( FALSE );
}
// --------------------------------------------------------------------
// provided functions:
// --------------------------------------------------------------------
// instantiate instrument-plugin with given name or return NULL
// on failure
static instrument * FASTCALL instantiate( const QString & _plugin_name,
instrumentTrack * _channel_track );
instrumentTrack * _instrument_track );
virtual bool isFromTrack( const track * _track ) const;
instrumentView * createEditor( QWidget * _parent );
protected:
inline instrumentTrack * getInstrumentTrack( void ) const
@@ -120,6 +131,10 @@ protected:
// desiredReleaseFrames() frames are left
void applyRelease( sampleFrame * buf, const notePlayHandle * _n );
// instruments have to implement this to create an according view for
// themselves
virtual instrumentView * createView( QWidget * _parent ) = 0;
private:
instrumentTrack * m_instrumentTrack;
@@ -127,4 +142,27 @@ private:
} ;
class instrumentView : public QWidget, public modelView
{
public:
instrumentView( instrument * _instrument, QWidget * _parent );
virtual ~instrumentView();
instrument * model( void )
{
return( castModel<instrument>() );
}
const instrument * model( void ) const
{
return( castModel<instrument>() );
}
virtual void setModel( ::model * _model, bool = FALSE );
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* mv_base.h - base for M/V-architecture of LMMS
*
* Copyright (c) 2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -77,12 +77,7 @@ public:
{
}
void setModel( model * _model, bool _old_model_valid = TRUE );
// sub-classes can re-implement this to track model-changes
virtual void modelChanged( void )
{
}
virtual void setModel( model * _model, bool _old_model_valid = TRUE );
template<class T>
T * castModel( void )
@@ -97,6 +92,13 @@ public:
}
protected:
// sub-classes can re-implement this to track model-changes
virtual void modelChanged( void )
{
}
private:
model * m_model;