* completely new automation-system with automation-tracks and automation-patterns as well as song-global automation

* made modelView take a QWidget-pointer argument
* trackContentObject-ctor now calls track::addTCO() directly
* optimize various loops to use iterators/const_iterators instead of a running index variable
* drag'n'drop doesn't fool around with pointers anymore - instead use unique journalling-IDs
* moved drag'n'drop handling code from knob to automatableModelView so that all controls can benefit from that



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1164 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-23 22:36:33 +00:00
parent 81ec8833f5
commit 9bebe4325b
98 changed files with 1321 additions and 1088 deletions

View File

@@ -36,7 +36,7 @@
class audioPort
{
public:
audioPort( const QString & _name, track * _track );
audioPort( const QString & _name );
~audioPort();
inline sampleFrame * firstBuffer( void )

View File

@@ -32,9 +32,6 @@
#include "mv_base.h"
#include "controller_connection.h"
class automationPattern;
class track;
// simple way to map a property of a view to a model
#define mapPropertyFromModelPtr(type,getfunc,setfunc,modelname) \
@@ -67,6 +64,8 @@ class EXPORT automatableModel : public model, public journallingObject
{
Q_OBJECT
public:
typedef QVector<automatableModel *> autoModelVector;
enum DataType
{
Float,
@@ -91,24 +90,7 @@ public:
return( __copiedValue );
}
automationPattern * getAutomationPattern( void );
inline void setTrack( track * _track )
{
m_track = _track;
}
inline bool nullTrack( void ) const
{
return( m_track == NULL );
}
inline track * getTrack( void ) const
{
return( m_track );
}
void initAutomationPattern( void );
bool isAutomated( void ) const;
inline controllerConnection * getControllerConnection( void ) const
{
@@ -212,8 +194,6 @@ public:
void addJournalEntryFromOldToCurVal( void );
void syncAutomationPattern( void );
QString displayValue( const float _val ) const
{
@@ -249,7 +229,6 @@ public slots:
protected:
void setFirstValue( void );
virtual void redoStep( journalEntry & _je );
virtual void undoStep( journalEntry & _je );
@@ -257,6 +236,10 @@ protected:
private:
void linkModel( automatableModel * _model );
void unlinkModel( automatableModel * _model );
DataType m_dataType;
float m_value;
float m_initValue;
@@ -270,23 +253,18 @@ private:
QString m_displayName;
bool m_journalEntryReady;
typedef QVector<automatableModel *> autoModelVector;
autoModelVector m_linkedModels;
void linkModel( automatableModel * _model );
void unlinkModel( automatableModel * _model );
controllerConnection * m_controllerConnection;
automationPattern * m_automationPattern;
track * m_track;
static float __copiedValue;
signals:
void initValueChanged( float _val );
} ;

View File

@@ -37,12 +37,8 @@ class QMenu;
class EXPORT automatableModelView : public modelView
{
public:
automatableModelView( ::model * _model ) :
modelView( _model ),
m_description( QString::null ),
m_unit( QString::null )
{
}
automatableModelView( ::model * _model, QWidget * _this );
virtual ~automatableModelView();
// some basic functions for convenience
automatableModel * modelUntyped( void )
@@ -86,6 +82,8 @@ public:
protected:
virtual void mousePressEvent( QMouseEvent * _ev );
QString m_description;
QString m_unit;
@@ -105,6 +103,8 @@ public:
public slots:
void execConnectionDialog( void );
void removeConnection( void );
void editSongGlobalAutomation( void );
protected:
automatableModelView * amv;
@@ -115,23 +115,23 @@ protected:
#define generateTypedModelView(type) \
class EXPORT type##ModelView : public automatableModelView \
{\
public:\
type##ModelView( ::model * _model ) :\
automatableModelView( _model )\
{\
}\
\
type##Model * model( void )\
{\
return( castModel<type##Model>() );\
}\
\
const type##Model * model( void ) const\
{\
return( castModel<type##Model>() );\
}\
class EXPORT type##ModelView : public automatableModelView \
{ \
public: \
type##ModelView( ::model * _model, QWidget * _this ) : \
automatableModelView( _model, _this ) \
{ \
} \
\
type##Model * model( void ) \
{ \
return( castModel<type##Model>() ); \
} \
\
const type##Model * model( void ) const \
{ \
return( castModel<type##Model>() ); \
} \
} ;

View File

@@ -33,13 +33,14 @@
#include "journalling_object.h"
#include "midi_time.h"
#include "automation_pattern.h"
#include "combobox.h"
#include "combobox_model.h"
class QPainter;
class QPixmap;
class QScrollBar;
class comboBox;
class notePlayHandle;
class timeLine;
class toolButton;

View File

@@ -2,6 +2,7 @@
* automation_pattern.h - declaration of class automationPattern, which contains
* all information about an automation pattern
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -27,30 +28,30 @@
#ifndef _AUTOMATION_PATTERN_H
#define _AUTOMATION_PATTERN_H
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include "journalling_object.h"
#include "track.h"
class automatableModel;
class automationTrack;
class midiTime;
class track;
class EXPORT automationPattern : public QObject, public journallingObject
class EXPORT automationPattern : public trackContentObject
{
Q_OBJECT
public:
typedef QMap<int, float> timeMap;
typedef QVector<QPointer<automatableModel> > objectVector;
automationPattern( track * _track, automatableModel * _object );
automationPattern( automationTrack * _auto_track );
automationPattern( const automationPattern & _pat_to_copy );
automationPattern( const automationPattern & _pat_to_copy,
automatableModel * _object );
virtual ~automationPattern();
const automatableModel * firstObject( void );
virtual midiTime length( void ) const;
midiTime putValue( const midiTime & _time, const float _value,
@@ -60,7 +61,7 @@ public:
inline timeMap & getTimeMap( void )
{
return( m_time_map );
return( m_timeMap );
}
float valueAt( const midiTime & _time );
@@ -73,7 +74,7 @@ public:
static inline const QString classNodeName( void )
{
return( "automation-pattern" );
return( "automationpattern" );
}
inline virtual QString nodeName( void ) const
@@ -81,37 +82,25 @@ public:
return( classNodeName() );
}
inline const track * getTrack( void ) const
{
return( m_track );
}
inline const automatableModel * object( void ) const
{
return( m_object );
}
inline automatableModel * object( void )
{
return( m_object );
}
void processMidiTime( const midiTime & _time );
inline bool updateFirst( void ) const
{
return( m_update_first );
return( m_updateFirst );
}
inline void setUpdateFirst( bool _update )
{
m_update_first = _update;
m_updateFirst = _update;
}
void forgetTrack( void )
{
m_track = NULL;
}
virtual trackContentObjectView * createView( trackView * _tv );
static bool isAutomated( const automatableModel * _m );
static automationPattern * globalAutomationPattern(
automatableModel * _m );
static void resolveAllIDs( void );
public slots:
@@ -120,15 +109,57 @@ public slots:
private:
track * m_track;
automatableModel * m_object;
timeMap m_time_map;
bool m_update_first;
bool m_dynamic;
automationTrack * m_autoTrack;
QVector<jo_id_t> m_idsToResolve;
objectVector m_objects;
timeMap m_timeMap; // actual values
bool m_updateFirst; // init-value set?
bool m_dynamic; // more than 1 value?
friend class automationPatternView;
} ;
class automationPatternView : public trackContentObjectView
{
Q_OBJECT
public:
automationPatternView( automationPattern * _pat, trackView * _parent );
virtual ~automationPatternView();
public slots:
virtual void update( void );
protected slots:
void resetName( void );
void changeName( void );
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = TRUE;
trackContentObjectView::resizeEvent( _re );
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
private:
automationPattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
} ;
#endif

View File

@@ -2,6 +2,7 @@
* automation_track.h - declaration of class automationTrack, which handles
* automation of objects without a track
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -30,10 +31,13 @@
#include "track.h"
class nameLabel;
class automationTrack : public track
{
public:
automationTrack( trackContainer * _tc );
automationTrack( trackContainer * _tc, bool _hidden = FALSE );
virtual ~automationTrack();
virtual bool play( const midiTime & _start, const fpp_t _frames,
@@ -45,17 +49,35 @@ public:
return( "automationtrack" );
}
virtual trackView * createView( trackContainerView * )
{
return( NULL );
}
virtual trackView * createView( trackContainerView * );
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
private:
friend class automationTrackView;
} ;
class automationTrackView : public trackView
{
public:
automationTrackView( automationTrack * _at, trackContainerView * _tcv );
virtual ~automationTrackView();
private:
bbTrack * m_bbTrack;
nameLabel * m_trackLabel;
} ;
#endif

View File

@@ -36,11 +36,7 @@ class QLabel;
class QPushButton;
class QMdiSubWindow;
//class controllerControlDialog;
//class knob;
class ledCheckBox;
//class tempoSyncKnob;
//class track;
class controllerView : public QWidget, public modelView
@@ -50,7 +46,7 @@ public:
controllerView( controller * _controller, QWidget * _parent );
virtual ~controllerView();
inline controller * getController( void )
inline controller * getController( void )
{
return( castModel<controller>() );
}

View File

@@ -38,7 +38,6 @@
class effectChain;
class effectControls;
class track;
class EXPORT effect : public plugin

View File

@@ -37,7 +37,7 @@ class effect;
class effectChain : public journallingObject, public model
{
public:
effectChain( track * _track );
effectChain( model * _parent );
virtual ~effectChain();
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
@@ -58,18 +58,11 @@ public:
void clear( void );
track * getTrack( void )
{
return( m_track );
}
private:
typedef QVector<effect *> effectList;
effectList m_effects;
track * m_track;
boolModel m_enabledModel;

View File

@@ -30,7 +30,6 @@
#include "effect.h"
class track;
class effectControlDialog;

View File

@@ -40,7 +40,6 @@ class effectControlDialog;
class knob;
class ledCheckBox;
class tempoSyncKnob;
class track;
class effectView : public pluginView

View File

@@ -35,16 +35,12 @@
#include "types.h"
class track;
class EXPORT envelopeAndLFOParameters : public model, public journallingObject
{
Q_OBJECT
public:
envelopeAndLFOParameters( float _value_for_zero_amount,
track * _track,
model * _parent );
virtual ~envelopeAndLFOParameters();

View File

@@ -35,7 +35,7 @@
#include "types.h"
class graphModel;
class track;
class EXPORT graph : public QWidget, public modelView
{
@@ -106,7 +106,7 @@ public:
graphModel( float _min,
float _max,
Uint32 _size,
:: model * _parent, track * _track = NULL,
:: model * _parent,
bool _default_constructed = FALSE );
virtual ~graphModel();

View File

@@ -44,7 +44,7 @@ class chordCreator : public model, public journallingObject
{
Q_OBJECT
public:
chordCreator( instrumentTrack * _instrument_track );
chordCreator( model * _parent );
virtual ~chordCreator();
void processNote( notePlayHandle * _n );
@@ -103,7 +103,7 @@ public:
NumArpDirections
} ;
arpeggiator( instrumentTrack * _instrument_track );
arpeggiator( model * _parent );
virtual ~arpeggiator();
void processNote( notePlayHandle * _n );

View File

@@ -152,6 +152,8 @@ public:
protected:
void changeID( jo_id_t _id );
void addJournalEntry( const journalEntry & _je );
// to be implemented by sub-objects

View File

@@ -1,6 +1,7 @@
/*
* ladspa_control.h - model for controlling a LADSPA port
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -39,8 +40,6 @@
#include "tempo_sync_knob.h"
class track;
typedef struct portDescription port_desc_t;
@@ -49,7 +48,7 @@ class EXPORT ladspaControl : public model, public journallingObject
{
Q_OBJECT
public:
ladspaControl( model * _parent, port_desc_t * _port, track * _track,
ladspaControl( model * _parent, port_desc_t * _port,
bool _link = FALSE );
~ladspaControl();

View File

@@ -34,7 +34,7 @@ class meterModel : public model
mapPropertyFromModel(int,getNumerator,setNumerator,m_numeratorModel);
mapPropertyFromModel(int,getDenominator,setDenominator,m_denominatorModel);
public:
meterModel( ::model * _parent, track * _track );
meterModel( ::model * _parent );
~meterModel();
void saveSettings( QDomDocument & _doc, QDomElement & _this,

View File

@@ -70,7 +70,6 @@ public:
midiClient * _mc,
midiEventProcessor * _mep,
model * _parent = NULL,
track * _track = NULL,
Modes _mode = Disabled );
virtual ~midiPort();

View File

@@ -90,7 +90,7 @@ signals:
class EXPORT modelView
{
public:
modelView( model * _model );
modelView( model * _model, QWidget * _this );
virtual ~modelView()
{
}
@@ -116,10 +116,16 @@ protected:
{
}
QWidget * widget( void )
{
return( m_widget );
}
virtual void doConnections( void );
private:
QWidget * m_widget;
model * m_model;
} ;

View File

@@ -48,8 +48,6 @@ class sampleBuffer;
class EXPORT pattern : public trackContentObject
{
Q_OBJECT
@@ -78,7 +76,7 @@ public:
const bool _quant_pos = TRUE );
void clearNotes( void );
inline const noteVector & notes( void )
{
return( m_notes );
@@ -111,7 +109,7 @@ public:
{
return( m_freezing );
}
inline bool frozen( void ) const
{
return( m_frozenPattern != NULL );
@@ -197,7 +195,6 @@ public slots:
protected slots:
void openInPianoRoll( bool _c );
void openInPianoRoll( void );
void resetName( void );

View File

@@ -36,7 +36,7 @@ class EXPORT pluginView : public QWidget, public modelView
public:
pluginView( plugin * _plugin, QWidget * _parent ) :
QWidget( _parent ),
modelView( _plugin )
modelView( _plugin, this )
{
}

View File

@@ -36,6 +36,7 @@
#include "meter_model.h"
class automationTrack;
class pattern;
class timeLine;
@@ -139,9 +140,9 @@ public:
bpm_t getTempo( void );
virtual automationPattern * tempoAutomationPattern( void );
track * getAutomationTrack( void )
automationTrack * globalAutomationTrack( void )
{
return( m_automationTrack );
return( m_globalAutomationTrack );
}
// file management
@@ -215,6 +216,7 @@ private slots:
void removeBar( void );
void addBBTrack( void );
void addSampleTrack( void );
void addAutomationTrack( void );
void setTempo( void );
void setTimeSignature( void );
@@ -255,7 +257,7 @@ private:
void restoreControllerStates( const QDomElement & _this );
track * m_automationTrack;
automationTrack * m_globalAutomationTrack;
lcdSpinBoxModel m_tempoModel;
meterModel m_timeSigModel;

View File

@@ -107,7 +107,7 @@ private:
toolButton * m_addBBTrackButton;
toolButton * m_addSampleTrackButton;
toolButton * m_addControllerButton;
toolButton * m_addAutomationTrackButton;
toolButton * m_drawModeButton;
toolButton * m_editModeButton;

View File

@@ -36,7 +36,6 @@
class QPixmap;
class knob;
class track;
const int SURROUND_AREA_SIZE = 1024;
@@ -48,7 +47,7 @@ class surroundAreaModel : public model
mapPropertyFromModel(int,x,setX,m_posX);
mapPropertyFromModel(int,y,setY,m_posY);
public:
surroundAreaModel( ::model * _parent, track * _track = NULL,
surroundAreaModel( ::model * _parent,
bool _default_constructed = FALSE );
surroundVolumeVector getVolumeVector( float _v_scale ) const;
@@ -70,8 +69,8 @@ public:
m_posY.addJournalEntryFromOldToCurVal();
}
automationPattern * automationPatternX( void );
automationPattern * automationPatternY( void );
// automationPattern * automationPatternX( void );
// automationPattern * automationPatternY( void );
private:

View File

@@ -41,7 +41,6 @@
class QMenu;
class QPushButton;
class automationPattern;
class bbTrack;
class pixmapButton;
class pixmapLoader;
@@ -290,17 +289,11 @@ protected:
private slots:
void cloneTrack( void );
void disableAutomation( void );
void enableAutomation( void );
void removeTrack( void );
void updateMenu( void );
private:
bbTrack * currentBBTrack( void );
bool inBBEditor( void );
static QPixmap * s_grip;
static QPixmap * s_muteOffDisabled;
static QPixmap * s_muteOffEnabled;
@@ -313,13 +306,9 @@ private:
pixmapButton * m_muteBtn;
pixmapButton * m_soloBtn;
bool m_automationDisabled;
friend class trackView;
signals:
void trackRemovalScheduled( trackView * _t );
@@ -335,6 +324,8 @@ class EXPORT track : public model, public journallingObject
Q_OBJECT
mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
public:
typedef QVector<trackContentObject *> tcoVector;
enum TrackTypes
{
InstrumentTrack,
@@ -343,6 +334,7 @@ public:
EventTrack,
VideoTrack,
AutomationTrack,
HiddenAutomationTrack,
NumTrackTypes
} ;
@@ -387,24 +379,26 @@ public:
trackContentObject * getTCO( int _tco_num );
int getTCONum( trackContentObject * _tco );
void getTCOsInRange( QList<trackContentObject *> & _tco_v,
const midiTime & _start,
const tcoVector & getTCOs( void ) const
{
return( m_trackContentObjects );
}
void getTCOsInRange( tcoVector & _tco_v, const midiTime & _start,
const midiTime & _end );
void swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
void insertTact( const midiTime & _pos );
void removeTact( const midiTime & _pos );
tact length( void ) const;
inline trackContainer * getTrackContainer( void ) const
{
return( m_trackContainer );
}
void addAutomationPattern( automationPattern * _pattern );
void removeAutomationPattern( automationPattern * _pattern );
// name-stuff
virtual const QString & name( void ) const
{
@@ -428,10 +422,6 @@ public slots:
void toggleSolo( void );
protected:
void sendMidiTime( const midiTime & _time );
private:
trackContainer * m_trackContainer;
TrackTypes m_type;
@@ -443,11 +433,8 @@ private:
bool m_mutedBeforeSolo;
typedef QVector<trackContentObject *> tcoVector;
tcoVector m_trackContentObjects;
QList<automationPattern *> m_automationPatterns;
friend class trackView;

View File

@@ -31,15 +31,16 @@
#include "journalling_object.h"
class trackContainerView;
class automationPattern;
class instrumentTrack;
class trackContainerView;
class EXPORT trackContainer : public model, public journallingObject
{
Q_OBJECT
public:
typedef QList<track *> trackList;
typedef QVector<track *> trackList;
trackContainer( void );
virtual ~trackContainer();
@@ -63,6 +64,11 @@ public:
void clearAllTracks( void );
trackList & tracks( void )
{
return( m_tracks );
}
const trackList & tracks( void ) const
{
return( m_tracks );