finally splitted rest of LMMS, i.e. tracks, track-containers, track-content-objects, whole instrument-track/instrument-track-window and so on - still a bit unstable but I'm sure we'll manage to get this one very stable\!

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@691 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-02-16 02:04:58 +00:00
parent 40017887e9
commit 5d5ad19021
79 changed files with 8453 additions and 6656 deletions

View File

@@ -1,138 +0,0 @@
/*
* arp_and_chords_tab_widget.h - declaration of class arpAndChordWidget which
* provides code for using arpeggio and chords
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ARP_AND_CHORDS_TAB_WIDGET_H
#define _ARP_AND_CHORDS_TAB_WIDGET_H
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "types.h"
#include "automatable_model.h"
class QLabel;
class QPixmap;
class automatableButtonGroup;
class flpImport;
class instrumentTrack;
class comboBox;
class groupBox;
class knob;
class notePlayHandle;
class tempoSyncKnob;
class comboBoxModel;
const int MAX_CHORD_POLYPHONY = 10;
class arpAndChordsTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
enum arpDirections
{
UP,
DOWN,
UP_AND_DOWN,
RANDOM
} ;
arpAndChordsTabWidget( instrumentTrack * _channel_track );
virtual ~arpAndChordsTabWidget();
static struct chord
{
const QString name;
Sint8 interval[MAX_CHORD_POLYPHONY];
} s_chords[];
void FASTCALL processNote( notePlayHandle * _n );
static inline int getChordSize( chord & _c )
{
int idx = 0;
while( _c.interval[idx] != -1 )
{
++idx;
}
return( idx );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "arpandchords" );
}
private:
enum arpModes
{
FREE,
SORT,
SYNC
} ;
// chord-stuff
groupBox * m_chordsGroupBox;
boolModel * m_chordsEnabledModel;
comboBox * m_chordsComboBox;
comboBoxModel * m_chordsModel;
knob * m_chordRangeKnob;
floatModel * m_chordRangeModel;
// arpeggio-stuff
groupBox * m_arpGroupBox;
boolModel * m_arpEnabledModel;
comboBox * m_arpComboBox;
comboBoxModel * m_arpModel;
knob * m_arpRangeKnob;
floatModel * m_arpRangeModel;
tempoSyncKnob * m_arpTimeKnob;
floatModel * m_arpTimeModel;
knob * m_arpGateKnob;
floatModel * m_arpGateModel;
QLabel * m_arpDirectionLbl;
automatableButtonGroup * m_arpDirectionBtnGrp;
intModel * m_arpDirectionModel;
comboBox * m_arpModeComboBox;
comboBoxModel * m_arpModeModel;
friend class flpImport;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* automation_track.h - declaration of class automationTrack, which handles
* automation of objects without a track
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/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,34 +30,30 @@
#include "track.h"
class automationTrack : public QWidget, public track
class automationTrack : public track
{
Q_OBJECT
public:
automationTrack( trackContainer * _tc );
virtual ~automationTrack();
private:
inline QString nodeName( void ) const
{
return( "automation-track" );
}
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual QString nodeName( void ) const
{
return( "automationtrack" );
}
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual trackView * createView( trackContainerView * )
{
return( NULL );
}
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
} ;

View File

@@ -1,7 +1,7 @@
/*
* bb_editor.h - declaration of class bbEditor, a basic-component of LMMS
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -35,39 +35,36 @@ class QPixmap;
class toolButton;
class bbEditor : public trackContainer
class bbTrackContainer : public trackContainer
{
Q_OBJECT
mapPropertyFromModelPtr(int,currentBB,setCurrentBB,m_bbComboBoxModel);
mapPropertyFromModel(int,currentBB,setCurrentBB,m_bbComboBoxModel);
public:
virtual bool FASTCALL play( midiTime _start, const fpp_t _frames,
bbTrackContainer( void );
virtual ~bbTrackContainer();
virtual bool play( midiTime _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
// virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
// virtual void loadSettings( const QDomElement & _this );
virtual void updateAfterTrackAdd( void );
inline virtual QString nodeName( void ) const
{
return( "bbeditor" );
return( "bbtrackcontainer" );
}
virtual inline bool fixedTCOs( void ) const
{
return( TRUE );
}
tact FASTCALL lengthOfBB( const int _bb );
tact lengthOfBB( int _bb );
inline tact lengthOfCurrentBB( void )
{
return( lengthOfBB( currentBB() ) );
}
void FASTCALL removeBB( const int _bb );
int numOfBBs( void ) const;
void removeBB( int _bb );
void FASTCALL swapBB( const int _bb1, const int _bb2 );
void swapBB( int _bb1, int _bb2 );
void updateBBTrack( trackContentObject * _tco );
@@ -79,27 +76,49 @@ public slots:
void currentBBChanged( void );
protected:
virtual void keyPressEvent( QKeyEvent * _ke );
private:
void createTCOsForBB( int _bb );
comboBoxModel m_bbComboBoxModel;
friend class bbEditor;
} ;
class bbEditor : public trackContainerView
{
Q_OBJECT
public:
bbEditor( bbTrackContainer * _tc );
virtual ~bbEditor();
virtual inline bool fixedTCOs( void ) const
{
return( TRUE );
}
void removeBBView( int _bb );
public slots:
void play( void );
void stop( void );
void updatePosition( void );
private:
bbEditor( void );
//bbEditor( const bbEditor & );
virtual ~bbEditor();
void FASTCALL createTCOsForBB( const int _bb );
virtual void keyPressEvent( QKeyEvent * _ke );
bbTrackContainer * m_bbtc;
QWidget * m_toolBar;
toolButton * m_playButton;
toolButton * m_stopButton;
comboBox * m_bbComboBox;
comboBoxModel * m_bbComboBoxModel;
friend class engine;
} ;

View File

@@ -2,7 +2,7 @@
* bb_track.h - class bbTrack, a wrapper for using bbEditor
* (which is a singleton-class) as track
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -38,27 +38,51 @@ class trackContainer;
class bbTCO : public trackContentObject
{
Q_OBJECT
public:
bbTCO( track * _track, const QColor & _c = QColor() );
bbTCO( track * _track, unsigned int _color = 0 );
virtual ~bbTCO();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "bbtco" );
}
const QColor & color( void ) const
inline unsigned int color( void ) const
{
return( m_color );
}
virtual trackContentObjectView * createView( trackView * _tv );
private:
QString m_name;
unsigned int m_color;
friend class bbTCOView;
} ;
class bbTCOView : public trackContentObjectView
{
Q_OBJECT
public:
bbTCOView( trackContentObject * _tco, trackView * _tv );
virtual ~bbTCOView();
QColor color( void ) const
{
return( m_bbTCO->m_color );
}
void setColor( QColor _new_color );
protected slots:
void openInBBEditor( bool _c );
void openInBBEditor( void );
void resetName( void );
void changeName( void );
@@ -72,62 +96,48 @@ protected:
private:
QString m_name;
QColor m_color;
void setColor( QColor _new_color );
bbTCO * m_bbTCO;
} ;
class bbTrack : public QObject, public track
class bbTrack : public track
{
Q_OBJECT
public:
bbTrack( trackContainer * _tc );
virtual ~bbTrack();
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
virtual bool play( const midiTime & _start,
const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual trackView * createView( trackContainerView * _tcv );
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
static bbTrack * FASTCALL findBBTrack( int _bb_num );
static int FASTCALL numOfBBTrack( track * _track );
static void FASTCALL swapBBTracks( track * _track1, track * _track2 );
inline nameLabel * trackLabel( void )
{
return( m_trackLabel );
}
static bbTrack * findBBTrack( int _bb_num );
static int numOfBBTrack( track * _track );
static void swapBBTracks( track * _track1, track * _track2 );
bool automationDisabled( track * _track )
{
return( m_disabled_tracks.contains( _track ) );
return( m_disabledTracks.contains( _track ) );
}
void disableAutomation( track * _track )
{
m_disabled_tracks.append( _track );
m_disabledTracks.append( _track );
}
void enableAutomation( track * _track )
{
m_disabled_tracks.removeAll( _track );
m_disabledTracks.removeAll( _track );
}
public slots:
void clickedTrackLabel( void );
protected:
inline virtual QString nodeName( void ) const
{
@@ -136,13 +146,43 @@ protected:
private:
nameLabel * m_trackLabel;
QList<track *> m_disabled_tracks;
QList<track *> m_disabledTracks;
typedef QMap<bbTrack *, int> infoMap;
static infoMap s_infoMap;
friend class bbTrackView;
} ;
class bbTrackView : public trackView
{
Q_OBJECT
public:
bbTrackView( bbTrack * _bbt, trackContainerView * _tcv );
virtual ~bbTrackView();
inline nameLabel * trackLabel( void )
{
return( m_trackLabel );
}
virtual bool close( void );
public slots:
void clickedTrackLabel( void );
private:
bbTrack * m_bbTrack;
nameLabel * m_trackLabel;
} ;
#endif

View File

@@ -33,25 +33,25 @@
class dummyInstrument : public instrument
{
public:
inline dummyInstrument( instrumentTrack * _instrument_track ) :
dummyInstrument( instrumentTrack * _instrument_track ) :
instrument( _instrument_track, NULL )
{
}
inline virtual ~dummyInstrument()
virtual ~dummyInstrument()
{
}
inline virtual void saveSettings( QDomDocument &, QDomElement & )
virtual void saveSettings( QDomDocument &, QDomElement & )
{
}
inline virtual void loadSettings( const QDomElement & )
virtual void loadSettings( const QDomElement & )
{
}
inline virtual QString nodeName( void ) const
virtual QString nodeName( void ) const
{
return( "dummyinstrument" );
}

View File

@@ -34,11 +34,13 @@
class automationEditor;
class bbEditor;
class bbTrackContainer;
class projectJournal;
class mainWindow;
class mixer;
class pianoRoll;
class projectNotes;
class song;
class songEditor;
class ladspa2LMMS;
@@ -54,11 +56,28 @@ public:
return( s_hasGUI );
}
// core
static mixer * getMixer( void )
{
return( s_mixer );
}
static song * getSong( void )
{
return( s_song );
}
static bbTrackContainer * getBBTrackContainer( void )
{
return( s_bbTrackContainer );
}
static projectJournal * getProjectJournal( void )
{
return( s_projectJournal );
}
// GUI
static mainWindow * getMainWindow( void )
{
return( s_mainWindow );
@@ -84,11 +103,6 @@ public:
return( s_projectNotes );
}
static projectJournal * getProjectJournal( void )
{
return( s_projectJournal );
}
static automationEditor * getAutomationEditor( void )
{
return( s_automationEditor );
@@ -115,14 +129,19 @@ private:
static bool s_hasGUI;
static float s_framesPerTact64th;
// core
static mixer * s_mixer;
static song * s_song;
static bbTrackContainer * s_bbTrackContainer;
static projectJournal * s_projectJournal;
// GUI
static mainWindow * s_mainWindow;
static songEditor * s_songEditor;
static automationEditor * s_automationEditor;
static bbEditor * s_bbEditor;
static pianoRoll * s_pianoRoll;
static projectNotes * s_projectNotes;
static projectJournal * s_projectJournal;
static ladspa2LMMS * s_ladspaManager;
static QMap<QString, QString> s_sampleExtensions;

View File

@@ -1,9 +1,7 @@
/*
* envelope_and_lfo_widget.h - declaration of class envelopeAndLFOWidget which
* is used by envelope/lfo/filter-tab of
* channel-window
* envelope_and_lfo_parameters.h - class envelopeAndLFOParameters
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -25,12 +23,10 @@
*/
#ifndef _ENVELOPE_AND_LFO_WIDGET_H
#define _ENVELOPE_AND_LFO_WIDGET_H
#ifndef _ENVELOPE_AND_LFO_PARAMETERS_H
#define _ENVELOPE_AND_LFO_PARAMETERS_H
#include <QtCore/QVector>
#include <QtGui/QWidget>
#include "journalling_object.h"
#include "automatable_model.h"
@@ -38,28 +34,18 @@
#include "types.h"
class QPaintEvent;
class QPixmap;
class automatableButtonGroup;
class envelopeTabWidget;
class knob;
class ledCheckBox;
class pixmapButton;
class tempoSyncKnob;
class track;
class flpImport;
class envelopeAndLFOWidget : public QWidget, public journallingObject
class envelopeAndLFOParameters : public model, public journallingObject
{
Q_OBJECT
public:
envelopeAndLFOWidget( float _value_for_zero_amount, QWidget * _parent,
track * _track );
virtual ~envelopeAndLFOWidget();
envelopeAndLFOParameters( float _value_for_zero_amount,
track * _track,
model * _parent );
virtual ~envelopeAndLFOParameters();
static inline float expKnobVal( float _val )
{
@@ -69,7 +55,7 @@ public:
static void triggerLFO( void );
static void resetLFO( void );
void FASTCALL fillLevel( float * _buf, f_cnt_t _frame,
void fillLevel( float * _buf, f_cnt_t _frame,
const f_cnt_t _release_begin,
const fpp_t _frames );
@@ -79,52 +65,38 @@ public:
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual QString nodeName( void ) const
{
return( "el" );
}
inline f_cnt_t PAHD_Frames( void ) const
{
return( m_pahdFrames );
}
inline f_cnt_t releaseFrames( void ) const
{
return( m_rFrames );
}
public slots:
void updateSampleVars( void );
protected:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
void FASTCALL fillLFOLevel( float * _buf, f_cnt_t _frame,
const fpp_t _frames );
protected slots:
void lfoUserWaveChanged( void );
void fillLFOLevel( float * _buf, f_cnt_t _frame, const fpp_t _frames );
private:
static QPixmap * s_envGraph;
static QPixmap * s_lfoGraph;
static QVector<envelopeAndLFOParameters *> s_EaLParametersInstances;
static QVector<envelopeAndLFOWidget *> s_EaLWidgets;
bool m_used;
bool m_used;
// envelope-stuff
knob * m_predelayKnob;
knob * m_attackKnob;
knob * m_holdKnob;
knob * m_decayKnob;
knob * m_sustainKnob;
knob * m_releaseKnob;
knob * m_amountKnob;
// models
floatModel m_predelayModel;
floatModel m_attackModel;
floatModel m_holdModel;
@@ -143,18 +115,6 @@ private:
sample_t * m_rEnv;
// LFO-stuff
knob * m_lfoPredelayKnob;
knob * m_lfoAttackKnob;
tempoSyncKnob * m_lfoSpeedKnob;
knob * m_lfoAmountKnob;
pixmapButton * m_userLfoBtn;
automatableButtonGroup * m_lfoWaveBtnGrp;
ledCheckBox * m_x100Cb;
ledCheckBox * m_controlEnvAmountCb;
// models
floatModel m_lfoPredelayModel;
floatModel m_lfoAttackModel;
floatModel m_lfoSpeedModel;
@@ -175,13 +135,14 @@ private:
bool m_bad_lfoShapeData;
sampleBuffer m_userWave;
enum lfoShapes
enum LfoShapes
{
SIN,
TRIANGLE,
SAW,
SQUARE,
USER
SineWave,
TriangleWave,
SawWave,
SquareWave,
UserDefinedWave,
NumLfoShapes
} ;
sample_t lfoShapeSample( fpp_t _frame_offset );
@@ -189,8 +150,8 @@ private:
friend class envelopeTabWidget;
friend class flpImport;
friend class envelopeAndLFOView;
// friend class flpImport;
} ;

View File

@@ -0,0 +1,98 @@
/*
* envelope_and_lfo_view.h - declaration of class envelopeAndLFOWidget which
* is used by envelope/lfo/filter-tab of
* channel-window
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _ENVELOPE_AND_LFO_VIEW_H
#define _ENVELOPE_AND_LFO_VIEW_H
#include <QtGui/QWidget>
#include "mv_base.h"
class QPaintEvent;
class QPixmap;
class envelopeAndLFOParameters;
class automatableButtonGroup;
class knob;
class ledCheckBox;
class pixmapButton;
class tempoSyncKnob;
class envelopeAndLFOView : public QWidget, public modelView
{
Q_OBJECT
public:
envelopeAndLFOView( QWidget * _parent );
virtual ~envelopeAndLFOView();
protected:
virtual void modelChanged( void );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
protected slots:
void lfoUserWaveChanged( void );
private:
static QPixmap * s_envGraph;
static QPixmap * s_lfoGraph;
envelopeAndLFOParameters * m_params;
// envelope-stuff
knob * m_predelayKnob;
knob * m_attackKnob;
knob * m_holdKnob;
knob * m_decayKnob;
knob * m_sustainKnob;
knob * m_releaseKnob;
knob * m_amountKnob;
// LFO-stuff
knob * m_lfoPredelayKnob;
knob * m_lfoAttackKnob;
tempoSyncKnob * m_lfoSpeedKnob;
knob * m_lfoAmountKnob;
pixmapButton * m_userLfoBtn;
automatableButtonGroup * m_lfoWaveBtnGrp;
ledCheckBox * m_x100Cb;
ledCheckBox * m_controlEnvAmountCb;
} ;
#endif

View File

@@ -173,13 +173,18 @@ public:
text( 0 ) );
}
enum fileTypes
enum FileTypes
{
PROJECT_FILE, PRESET_FILE, SAMPLE_FILE, MIDI_FILE, FLP_FILE,
UNKNOWN
ProjectFile,
PresetFile,
SampleFile,
MidiFile,
FlpFile,
UnknownFile,
NumFileTypes
} ;
inline fileTypes type( void )
inline FileTypes type( void )
{
return( m_type );
}
@@ -200,7 +205,7 @@ private:
static QPixmap * s_unknownFilePixmap;
QString m_path;
fileTypes m_type;
FileTypes m_type;
} ;

View File

@@ -0,0 +1,91 @@
/*
* instrument_function_views.h - views for instrument-functions-tab
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_FUNCTION_VIEWS_H
#define _INSTRUMENT_FUNCTION_VIEWS_H
#include "mv_base.h"
class automatableButtonGroup;
class comboBox;
class groupBox;
class knob;
class tempoSyncKnob;
class arpeggiator;
class chordCreator;
class chordCreatorView : public QWidget, public modelView
{
public:
chordCreatorView( chordCreator * _cc, QWidget * _parent );
virtual ~chordCreatorView();
private:
virtual void modelChanged( void );
chordCreator * m_cc;
groupBox * m_chordsGroupBox;
comboBox * m_chordsComboBox;
knob * m_chordRangeKnob;
} ;
class arpeggiatorView : public QWidget, public modelView
{
public:
arpeggiatorView( arpeggiator * _arp, QWidget * _parent );
virtual ~arpeggiatorView();
private:
virtual void modelChanged( void );
arpeggiator * m_a;
groupBox * m_arpGroupBox;
comboBox * m_arpComboBox;
knob * m_arpRangeKnob;
tempoSyncKnob * m_arpTimeKnob;
knob * m_arpGateKnob;
QLabel * m_arpDirectionLbl;
automatableButtonGroup * m_arpDirectionBtnGrp;
comboBox * m_arpModeComboBox;
} ;
#endif

View File

@@ -0,0 +1,141 @@
/*
* instrument_functions.h - models for instrument-functions-tab
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_FUNCTIONS_H
#define _INSTRUMENT_FUNCTIONS_H
#include "journalling_object.h"
#include "types.h"
#include "automatable_model.h"
#include "combobox.h"
class instrumentTrack;
class notePlayHandle;
const int MAX_CHORD_POLYPHONY = 10;
class chordCreator : public model, public journallingObject
{
public:
chordCreator( instrumentTrack * _instrument_track );
virtual ~chordCreator();
void processNote( notePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "chordcreator" );
}
static struct chord
{
const QString name;
Sint8 interval[MAX_CHORD_POLYPHONY];
} s_chordTable[];
static inline int getChordSize( chord & _c )
{
int idx = 0;
while( _c.interval[idx] != -1 )
{
++idx;
}
return( idx );
}
private:
boolModel m_chordsEnabledModel;
comboBoxModel m_chordsModel;
floatModel m_chordRangeModel;
friend class chordCreatorView;
} ;
class arpeggiator : public model, public journallingObject
{
public:
enum ArpDirections
{
ArpDirUp,
ArpDirDown,
ArpDirUpAndDown,
ArpDirRandom
} ;
arpeggiator( instrumentTrack * _instrument_track );
virtual ~arpeggiator();
void processNote( notePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "arpeggiator" );
}
private:
enum ArpModes
{
FreeMode,
SortMode,
SyncMode
} ;
boolModel m_arpEnabledModel;
comboBoxModel m_arpModel;
floatModel m_arpRangeModel;
floatModel m_arpTimeModel;
floatModel m_arpGateModel;
intModel m_arpDirectionModel;
comboBoxModel m_arpModeModel;
// friend class flpImport;
friend class instrumentTrack;
friend class arpeggiatorView;
} ;
#endif

View File

@@ -1,8 +1,7 @@
/*
* midi_tab_widget.h - tab-widget in channel-track-window for setting up
* MIDI-related stuff
* instrument_midi_io.h - class instrumentMidiIO
*
* 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
*
@@ -24,37 +23,33 @@
*/
#ifndef _MIDI_TAB_WIDGET_H
#define _MIDI_TAB_WIDGET_H
#ifndef _INSTRUMENT_MIDI_IO_H
#define _INSTRUMENT_MIDI_IO_H
#include <QtGui/QWidget>
#include <QtCore/QList>
#include "automatable_model.h"
class QMenu;
class QPixmap;
class QAction;
class instrumentTrack;
class tabWidget;
class ledCheckBox;
class lcdSpinBox;
class midiPort;
class midiTabWidget : public QWidget, public journallingObject
class instrumentMidiIO : public model, public journallingObject
{
Q_OBJECT
public:
midiTabWidget( instrumentTrack * _channel_track, midiPort * _port );
virtual ~midiTabWidget();
typedef QPair<QString, bool> descriptiveMidiPort;
typedef QList<descriptiveMidiPort> midiPortMap;
instrumentMidiIO( instrumentTrack * _instrument_track,
midiPort * _port );
virtual ~instrumentMidiIO();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual QString nodeName( void ) const
{
return( "midi" );
}
@@ -71,20 +66,15 @@ protected slots:
void defaultVelOutChanged( void );
void readablePortsChanged( void );
void writeablePortsChanged( void );
void activatedReadablePort( QAction * _item );
void activatedWriteablePort( QAction * _item );
void activatedReadablePort( const descriptiveMidiPort & _port );
void activatedWriteablePort( const descriptiveMidiPort & _port );
private:
instrumentTrack * m_instrumentTrack;
midiPort * m_midiPort;
tabWidget * m_setupTabWidget;
lcdSpinBox * m_inputChannelSpinBox;
lcdSpinBox * m_outputChannelSpinBox;
ledCheckBox * m_receiveCheckBox;
ledCheckBox * m_sendCheckBox;
ledCheckBox * m_defaultVelocityInCheckBox;
ledCheckBox * m_defaultVelocityOutCheckBox;
intModel m_inputChannelModel;
intModel m_outputChannelModel;
boolModel m_receiveEnabledModel;
@@ -92,10 +82,11 @@ private:
boolModel m_defaultVelocityInEnabledModel;
boolModel m_defaultVelocityOutEnabledModel;
QMenu * m_readablePorts;
QMenu * m_writeablePorts;
midiPortMap m_readablePorts;
midiPortMap m_writeablePorts;
friend class instrumentTrack;
friend class instrumentMidiIOView;
} ;

View File

@@ -0,0 +1,76 @@
/*
* instrument_midi_io_view.h - tab-widget in instrument-track-window for setting
* up MIDI-related stuff
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_MIDI_IO_VIEW_H
#define _INSTRUMENT_MIDI_IO_VIEW_H
#include <QtGui/QWidget>
#include "mv_base.h"
class QMenu;
class QAction;
class tabWidget;
class ledCheckBox;
class lcdSpinBox;
class instrumentMidiIOView : public QWidget, public modelView
{
Q_OBJECT
public:
instrumentMidiIOView( QWidget * _parent );
virtual ~instrumentMidiIOView();
protected slots:
void activatedReadablePort( QAction * _item );
void activatedWriteablePort( QAction * _item );
private:
virtual void modelChanged( void );
tabWidget * m_setupTabWidget;
lcdSpinBox * m_inputChannelSpinBox;
lcdSpinBox * m_outputChannelSpinBox;
ledCheckBox * m_receiveCheckBox;
ledCheckBox * m_sendCheckBox;
ledCheckBox * m_defaultVelocityInCheckBox;
ledCheckBox * m_defaultVelocityOutCheckBox;
QMenu * m_readablePorts;
QMenu * m_writeablePorts;
friend class instrumentTrackWindow;
} ;
#endif

View File

@@ -1,9 +1,7 @@
/*
* envelope_tab_widget.h - declaration of class envelopeTabWidget which
* provides UI- and DSP-code for using envelopes, LFOs
* and a filter
* instrument_sound_shaping.h - class instrumentSoundShaping
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -25,58 +23,44 @@
*/
#ifndef _ENVELOPE_TAB_WIDGET_H
#define _ENVELOPE_TAB_WIDGET_H
#include <QtGui/QWidget>
#ifndef _INSTRUMENT_SOUND_SHAPING_H
#define _INSTRUMENT_SOUND_SHAPING_H
#include "mixer.h"
#include "automatable_model.h"
#include "combobox.h"
class QLabel;
class comboBoxModel;
class instrumentTrack;
class comboBox;
class envelopeAndLFOWidget;
class groupBox;
class knob;
class envelopeAndLFOParameters;
class notePlayHandle;
class pixmapButton;
class tabWidget;
class envelopeTabWidget : public QWidget, public journallingObject
class instrumentSoundShaping : public model, public journallingObject
{
Q_OBJECT
public:
envelopeTabWidget( instrumentTrack * _channel_track );
virtual ~envelopeTabWidget();
instrumentSoundShaping( instrumentTrack * _instrument_track );
virtual ~instrumentSoundShaping();
void FASTCALL processAudioBuffer( sampleFrame * _ab,
const fpp_t _frames,
void processAudioBuffer( sampleFrame * _ab, const fpp_t _frames,
notePlayHandle * _n );
enum targets
enum Targets
{
VOLUME,
/* PANNING,
PITCH,*/
CUT,
RES,
TARGET_COUNT
Volume,
Cut,
Resonance,
NumTargets
} ;
f_cnt_t envFrames( const bool _only_vol = FALSE );
f_cnt_t releaseFrames( const bool _only_vol = FALSE );
f_cnt_t envFrames( const bool _only_vol = FALSE ) const;
f_cnt_t releaseFrames( const bool _only_vol = FALSE ) const;
float FASTCALL volumeLevel( notePlayHandle * _n, const f_cnt_t _frame );
float volumeLevel( notePlayHandle * _n, const f_cnt_t _frame );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "eldata" );
@@ -84,23 +68,21 @@ public:
private:
tabWidget * m_targetsTabWidget;
envelopeAndLFOWidget * m_envLFOWidgets[TARGET_COUNT];
envelopeAndLFOParameters * m_envLFOParameters[NumTargets];
instrumentTrack * m_instrumentTrack;
// filter-stuff
groupBox * m_filterGroupBox;
comboBox * m_filterComboBox;
knob * m_filterCutKnob;
knob * m_filterResKnob;
boolModel m_filterEnabledModel;
comboBoxModel m_filterModel;
floatModel m_filterCutModel;
floatModel m_filterResModel;
boolModel * m_filterEnabledModel;
comboBoxModel * m_filterModel;
floatModel * m_filterCutModel;
floatModel * m_filterResModel;
friend class flpImport;
friend class instrumentSoundShapingView;
} ;
extern const QString __targetNames[instrumentSoundShaping::NumTargets][2];
#endif

View File

@@ -0,0 +1,63 @@
/*
* instrument_sound_shaping_view.h - view for instrumentSoundShaping-class
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _INSTRUMENT_SOUND_SHAPING_VIEW_H
#define _INSTRUMENT_SOUND_SHAPING_VIEW_H
#include <QtGui/QWidget>
#include "instrument_sound_shaping.h"
class envelopeAndLFOView;
class comboBox;
class groupBox;
class knob;
class tabWidget;
class instrumentSoundShapingView : public QWidget, public modelView
{
public:
instrumentSoundShapingView( QWidget * _parent );
virtual ~instrumentSoundShapingView();
private:
virtual void modelChanged( void );
instrumentSoundShaping * m_ss;
tabWidget * m_targetsTabWidget;
envelopeAndLFOView * m_envLFOViews[instrumentSoundShaping::NumTargets];
// filter-stuff
groupBox * m_filterGroupBox;
comboBox * m_filterComboBox;
knob * m_filterCutKnob;
knob * m_filterResKnob;
} ;
#endif

View File

@@ -28,13 +28,16 @@
#define _INSTRUMENT_TRACK_H
#include <QtGui/QPushButton>
#include <QtGui/QPainter>
#include "audio_port.h"
#include "automatable_model.h"
#include "instrument_functions.h"
#include "instrument_midi_io.h"
#include "instrument_sound_shaping.h"
#include "lcd_spinbox.h"
#include "midi_event_processor.h"
#include "mixer.h"
#include "piano_widget.h"
#include "effect_chain.h"
#include "surround_area.h"
#include "tab_widget.h"
@@ -42,23 +45,23 @@
class QLineEdit;
class arpAndChordsTabWidget;
class arpeggiatorView;
class chordCreatorView;
class effectRackView;
class envelopeTabWidget;
class instrumentSoundShapingView;
class fadeButton;
class instrument;
class instrumentMidiIOView;
class instrumentTrackButton;
class lcdSpinBox;
class instrumentTrackWindow;
class midiPort;
class midiTabWidget;
class notePlayHandle;
class pianoWidget;
class pluginView;
class presetPreviewPlayHandle;
class surroundArea;
class volumeKnob;
class instrumentTrack : public QWidget, public track, public midiEventProcessor
class instrumentTrack : public track, public midiEventProcessor
{
Q_OBJECT
mapPropertyFromModel(int,getVolume,setVolume,m_volumeModel);
@@ -66,29 +69,22 @@ public:
instrumentTrack( trackContainer * _tc );
virtual ~instrumentTrack();
inline virtual trackTypes type( void ) const
{
return( m_trackType );
}
// used by instrument
void FASTCALL processAudioBuffer( sampleFrame * _buf,
const fpp_t _frames,
void processAudioBuffer( sampleFrame * _buf, const fpp_t _frames,
notePlayHandle * _n );
virtual void FASTCALL processInEvent( const midiEvent & _me,
virtual void processInEvent( const midiEvent & _me,
const midiTime & _time );
virtual void FASTCALL processOutEvent( const midiEvent & _me,
virtual void processOutEvent( const midiEvent & _me,
const midiTime & _time );
f_cnt_t FASTCALL beatLen( notePlayHandle * _n ) const;
f_cnt_t beatLen( notePlayHandle * _n ) const;
// for capturing note-play-events -> need that for arpeggio,
// filter and so on
void FASTCALL playNote( notePlayHandle * _n, bool _try_parallelizing );
void playNote( notePlayHandle * _n, bool _try_parallelizing );
QString instrumentName( void ) const;
inline const instrument * getInstrument( void ) const
@@ -96,68 +92,36 @@ public:
return( m_instrument );
}
void FASTCALL deleteNotePluginData( notePlayHandle * _n );
void deleteNotePluginData( notePlayHandle * _n );
// name-stuff
inline const QString & name( void ) const
{
return( m_name );
}
void FASTCALL setName( const QString & _new_name );
virtual void setName( const QString & _new_name );
// volume & surround-position-stuff
/* void FASTCALL setVolume( volume _new_volume );
volume getVolume( void ) const;*/
// void FASTCALL setBaseNote( Uint32 _new_note, bool _modified = TRUE );
/* inline tones baseTone( void ) const
{
return( m_baseTone );
}
inline octaves baseOctave( void ) const
{
return( m_baseOctave );
}*/
int FASTCALL masterKey( notePlayHandle * _n ) const;
int masterKey( notePlayHandle * _n ) const;
// play everything in given frame-range - creates note-play-handles
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
const f_cnt_t _frame_base,
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
// create new view for me
virtual trackView * createView( trackContainerView * _tcv );
// create new track-content-object = pattern
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual trackContentObject * createTCO( const midiTime & _pos );
// called by track
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
using track::setJournalling;
// load instrument whose name matches given one
instrument * FASTCALL loadInstrument( const QString &
_instrument_name );
instrument * loadInstrument( const QString & _instrument_name );
// parent for all internal tab-widgets
QWidget * tabWidgetParent( void )
{
return( m_tabWidget );
}
pianoWidget * getPianoWidget( void )
{
return( m_pianoWidget );
}
inline audioPort * getAudioPort( void )
{
return( &m_audioPort );
@@ -168,14 +132,146 @@ public:
return( &m_baseNoteModel );
}
piano * getPiano( void )
{
return( &m_piano );
}
bool arpeggiatorEnabled( void ) const
{
return( m_arpeggiator.m_arpEnabledModel.value() );
}
signals:
void instrumentChanged( void );
void newNote( void );
void noteDone( const note & _n );
void nameChanged( void );
protected:
virtual QString nodeName( void ) const
{
return( "instrumenttrack" );
}
// invalidates all note-play-handles linked to this instrument
void invalidateAllMyNPH( void );
protected slots:
void updateBaseNote( void );
private:
midiPort * m_midiPort;
audioPort m_audioPort;
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
intModel m_baseNoteModel;
QList<notePlayHandle *> m_processHandles;
floatModel m_volumeModel;
surroundAreaModel m_surroundAreaModel;
lcdSpinBoxModel m_effectChannelModel;
instrument * m_instrument;
instrumentSoundShaping m_soundShaping;
arpeggiator m_arpeggiator;
chordCreator m_chordCreator;
instrumentMidiIO m_midiIO;
piano m_piano;
friend class instrumentTrackView;
friend class instrumentTrackWindow;
friend class notePlayHandle;
friend class presetPreviewPlayHandle;
friend class flpImport;
} ;
class instrumentTrackView : public trackView
{
Q_OBJECT
public:
instrumentTrackView( instrumentTrack * _it, trackContainerView * _tc );
virtual ~instrumentTrackView();
instrumentTrackWindow * getInstrumentTrackWindow( void )
{
return( m_window );
}
instrumentTrack * model( void )
{
return( castModel<instrumentTrack>() );
}
const instrumentTrack * model( void ) const
{
return( castModel<instrumentTrack>() );
}
private slots:
void activityIndicatorPressed( void );
void activityIndicatorReleased( void );
void updateName( void );
private:
instrumentTrackWindow * m_window;
// widgets in track-settings-widget
volumeKnob * m_tswVolumeKnob;
fadeButton * m_tswActivityIndicator;
instrumentTrackButton * m_tswInstrumentTrackButton;
QMenu * m_tswMidiMenu;
friend class instrumentTrackButton;
friend class instrumentTrackWindow;
} ;
class instrumentTrackWindow : public QWidget, public modelView,
public journallingObjectHook
{
Q_OBJECT
public:
instrumentTrackWindow( instrumentTrackView * _tv );
virtual ~instrumentTrackWindow();
// parent for all internal tab-widgets
QWidget * tabWidgetParent( void )
{
return( m_tabWidget );
}
public slots:
void textChanged( const QString & _new_name );
void toggledInstrumentTrackButton( bool _on );
void updateName( void );
void updateInstrumentView( void );
signals:
void noteDone( const note & _n );
void midiInSelected( void );
void midiOutSelected( void );
void midiConfigChanged( bool );
protected:
@@ -185,40 +281,19 @@ protected:
virtual void dropEvent( QDropEvent * _de );
virtual void focusInEvent( QFocusEvent * _fe );
inline virtual QString nodeName( void ) const
{
return( "instrumenttrack" );
}
// invalidates all note-play-handles linked to this instrument
void invalidateAllMyNPH( void );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
protected slots:
void saveSettingsBtnClicked( void );
void activityIndicatorPressed( void );
void activityIndicatorReleased( void );
void midiInSelected( void );
void midiOutSelected( void );
void midiConfigChanged( bool );
void updateBaseNote( void );
private:
trackTypes m_trackType;
midiPort * m_midiPort;
audioPort m_audioPort;
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
intModel m_baseNoteModel;
QList<notePlayHandle *> m_processHandles;
virtual void modelChanged( void );
instrumentTrack * m_track;
instrumentTrackView * m_itv;
// widgets on the top of an instrument-track-window
tabWidget * m_generalSettingsWidget;
@@ -228,44 +303,23 @@ private:
lcdSpinBox * m_effectChannelNumber;
QPushButton * m_saveSettingsBtn;
floatModel m_volumeModel;
surroundAreaModel m_surroundAreaModel;
lcdSpinBoxModel m_effectChannelModel;
// tab-widget with all children
tabWidget * m_tabWidget;
instrument * m_instrument;
envelopeTabWidget * m_envWidget;
arpAndChordsTabWidget * m_arpWidget;
midiTabWidget * m_midiWidget;
pluginView * m_instrumentView;
effectRackView * m_effectRack;
// effectChain m_effects;
instrumentSoundShapingView * m_ssView;
chordCreatorView * m_chordView;
arpeggiatorView * m_arpView;
instrumentMidiIOView * m_midiView;
effectRackView * m_effectView;
// test-piano at the bottom of every instrument-settings-window
pianoWidget * m_pianoWidget;
pianoView * m_pianoView;
// widgets in track-settings-widget
volumeKnob * m_tswVolumeKnob;
fadeButton * m_tswActivityIndicator;
instrumentTrackButton * m_tswInstrumentTrackButton;
QMenu * m_tswMidiMenu;
QAction * m_midiInputAction;
QAction * m_midiOutputAction;
friend class instrumentTrackButton;
friend class notePlayHandle;
friend class presetPreviewPlayHandle;
friend class flpImport;
/* // base-tone stuff
void FASTCALL setBaseTone( tones _new_tone );
void FASTCALL setBaseOctave( octaves _new_octave );*/
} ;
@@ -275,14 +329,14 @@ private:
class instrumentTrackButton : public QPushButton
{
public:
instrumentTrackButton( instrumentTrack * _instrument_track );
instrumentTrackButton( instrumentTrackView * _instrument_track_view );
virtual ~instrumentTrackButton();
protected:
// since we want to draw a special label (instrument- and instrument-
// name) on our button, we have to re-implement this for doing so
virtual void drawButtonLabel( QPainter * _p );
virtual void paintEvent( QPaintEvent * _pe );
// allow drops on this button - we simply forward them to
// instrument-track
@@ -291,7 +345,7 @@ protected:
private:
instrumentTrack * m_instrumentTrack;
instrumentTrackView * m_instrumentTrackView;
} ;

View File

@@ -1,7 +1,7 @@
/*
* journalling_object.h - declaration of class journallingObject
*
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -37,15 +37,15 @@
#include <QtCore/QStack>
class QDomDocument;
class QDomElement;
typedef Uint32 t_action_id;
typedef uint32_t t_action_id;
class journallingObject;
class journallingObjectHook;
class journalEntry
@@ -98,7 +98,6 @@ private:
typedef QVector<journalEntry> journalEntryVector;
class journallingObject
{
public:
@@ -138,10 +137,10 @@ public:
m_journalling = m_journallingStateStack.pop();
}
virtual QDomElement FASTCALL saveState( QDomDocument & _doc,
virtual QDomElement saveState( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL restoreState( const QDomElement & _this );
virtual void restoreState( const QDomElement & _this );
// to be implemented by actual object
@@ -164,18 +163,23 @@ public:
return( old_journalling );
}
void setHook( journallingObjectHook * _hook );
journallingObjectHook * getHook( void )
{
return( m_hook );
}
protected:
void addJournalEntry( const journalEntry & _je );
// to be implemented by sub-objects
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this )
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this )
{
}
virtual void FASTCALL loadSettings( const QDomElement & _this )
virtual void loadSettings( const QDomElement & _this )
{
}
@@ -201,9 +205,36 @@ private:
QStack<bool> m_journallingStateStack;
journallingObjectHook * m_hook;
} ;
class journallingObjectHook
{
public:
journallingObjectHook() :
m_hookedIn( NULL )
{
}
virtual ~journallingObjectHook()
{
if( m_hookedIn != NULL )
{
m_hookedIn->setHook( NULL );
}
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ) = 0;
virtual void loadSettings( const QDomElement & _this ) = 0;
private:
journallingObject * m_hookedIn;
friend class journallingObject;
} ;
#endif

View File

@@ -58,7 +58,7 @@ public:
int addWidgetToToolBar( QWidget * _w, int _row = -1, int _col = -1 );
void addSpacingToToolBar( int _size );
void resetWindowTitle( bool _modified = FALSE );
void resetWindowTitle( void );
// every function that replaces current file (e.g. creates new file,
@@ -158,8 +158,6 @@ private:
QMenu * m_toolsMenu;
QList<pluginView *> m_tools;
bool m_modified;
friend class engine;

View File

@@ -1,7 +1,7 @@
/*
* mmp.h - class for reading and writing multimedia-project-files
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,27 +34,27 @@
class multimediaProject : public QDomDocument
{
public:
enum projectTypes
enum ProjectTypes
{
UNKNOWN,
SONG_PROJECT,
SONG_PROJECT_TEMPLATE,
INSTRUMENT_TRACK_SETTINGS,
DRAG_N_DROP_DATA,
CLIPBOARD_DATA,
JOURNAL_DATA,
EFFECT_SETTINGS,
VIDEO_PROJECT, // might come later...
BURN_PROJECT, // might come later...
PLAYLIST, // might come later...
PROJ_TYPE_COUNT
UnknownType,
SongProject,
SongProjectTemplate,
InstrumentTrackSettings,
DragNDropData,
ClipboardData,
JournalData,
EffectSettings,
VideoProject, // might come later...
BurnProject, // might come later...
Playlist, // might come later...
NumProjectTypes
} ;
multimediaProject( const QString & _in_file_name,
bool _is_filename = TRUE,
bool _upgrade = TRUE );
multimediaProject( projectTypes _project_type );
multimediaProject( ProjectTypes _project_type );
~multimediaProject();
QString nameWithExtension( const QString & _fn ) const;
@@ -70,17 +70,17 @@ public:
return( m_head );
}
inline projectTypes type( void ) const
inline ProjectTypes type( void ) const
{
return( m_type );
}
static projectTypes typeOfFile( const QString & _fn );
static ProjectTypes typeOfFile( const QString & _fn );
private:
static projectTypes type( const QString & _type_name );
static QString typeName( projectTypes _project_type );
static ProjectTypes type( const QString & _type_name );
static QString typeName( ProjectTypes _project_type );
void cleanMetaNodes( QDomElement _de );
@@ -89,14 +89,14 @@ private:
struct typeDescStruct
{
projectTypes m_type;
ProjectTypes m_type;
QString m_name;
} ;
static typeDescStruct s_types[PROJ_TYPE_COUNT];
static typeDescStruct s_types[NumProjectTypes];
QDomElement m_content;
QDomElement m_head;
projectTypes m_type;
ProjectTypes m_type;
} ;

View File

@@ -54,7 +54,6 @@ public:
private:
bool m_defaultConstructed;
signals:
// emitted if actual data of the model (e.g. values) have changed
void dataChanged( void );

View File

@@ -2,7 +2,7 @@
* name_label.h - class nameLabel, a label which is renamable by
* double-clicking it
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -58,7 +58,6 @@ public slots:
signals:
void clicked( void );
void nameChanged( void );
void nameChanged( const QString & _new_name );
void pixmapChanged( void );

View File

@@ -2,7 +2,7 @@
* pattern.h - declaration of class pattern, which contains all informations
* about a pattern
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -56,12 +56,13 @@ class pattern : public trackContentObject
{
Q_OBJECT
public:
enum patternTypes
enum PatternTypes
{
BEAT_PATTERN, MELODY_PATTERN/*, AUTOMATION_PATTERN*/
BeatPattern,
MelodyPattern
} ;
pattern( instrumentTrack * _channel_track );
pattern( instrumentTrack * _instrument_track );
pattern( const pattern & _pat_to_copy );
virtual ~pattern();
@@ -70,13 +71,12 @@ public:
virtual midiTime length( void ) const;
note * FASTCALL addNote( const note & _new_note,
const bool _quant_pos = TRUE );
note * addNote( const note & _new_note, const bool _quant_pos = TRUE );
void FASTCALL removeNote( const note * _note_to_del );
void removeNote( const note * _note_to_del );
note * FASTCALL rearrangeNote( const note * _note_to_proc,
const bool _quant_pos = TRUE );
note * rearrangeNote( const note * _note_to_proc,
const bool _quant_pos = TRUE );
void clearNotes( void );
@@ -86,11 +86,11 @@ public:
}
// pattern-type stuff
inline patternTypes type( void ) const
inline PatternTypes type( void ) const
{
return( m_patternType );
}
void FASTCALL setType( patternTypes _new_pattern_type );
void setType( PatternTypes _new_pattern_type );
void checkType( void );
@@ -103,7 +103,7 @@ public:
inline void setName( const QString & _name )
{
m_name = _name;
update();
emit dataChanged();
}
@@ -124,9 +124,8 @@ public:
}
// settings-management
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "pattern" );
@@ -140,57 +139,32 @@ public:
bool empty( void );
public slots:
virtual void update( void );
protected slots:
void openInPianoRoll( bool _c );
void openInPianoRoll( void );
void clear( void );
void resetName( void );
void changeName( void );
void freeze( void );
void unfreeze( void );
void abortFreeze( void );
void addSteps( QAction * _item );
void removeSteps( QAction * _item );
void addSteps( int _n );
void removeSteps( int _n );
virtual trackContentObjectView * createView( trackView * _tv );
using model::dataChanged;
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = TRUE;
trackContentObject::resizeEvent( _re );
}
virtual void wheelEvent( QWheelEvent * _we );
void ensureBeatNotes( void );
void updateBBTrack( void );
void abortFreeze( void );
protected slots:
void clear( void );
void freeze( void );
void unfreeze( void );
private:
static QPixmap * s_stepBtnOn;
static QPixmap * s_stepBtnOverlay;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;
static QPixmap * s_frozen;
QPixmap m_paintPixmap;
bool m_needsUpdate;
// general stuff
instrumentTrack * m_instrumentTrack;
patternTypes m_patternType;
PatternTypes m_patternType;
QString m_name;
// data-stuff
@@ -203,25 +177,77 @@ private:
volatile bool m_freezeAborted;
// as in Qt4 QThread is inherits from QObject and our base
// trackContentObject is a QWidget (=QObject), we cannot inherit from
// QThread. That's why we have to put pattern-freezing into separate
// thread-class -> patternFreezeThread
friend class patternView;
friend class patternFreezeThread;
} ;
class patternView : public trackContentObjectView
{
Q_OBJECT
public:
patternView( pattern * _pattern, trackView * _parent );
virtual ~patternView();
public slots:
virtual void update( void );
protected slots:
void openInPianoRoll( bool _c );
void openInPianoRoll( void );
void resetName( void );
void changeName( void );
void addSteps( QAction * _item );
void removeSteps( QAction * _item );
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = TRUE;
trackContentObjectView::resizeEvent( _re );
}
virtual void wheelEvent( QWheelEvent * _we );
private:
static QPixmap * s_stepBtnOn;
static QPixmap * s_stepBtnOverlay;
static QPixmap * s_stepBtnOff;
static QPixmap * s_stepBtnOffLight;
static QPixmap * s_frozen;
pattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
} ;
// TODO: move to own header-files
//
class patternFreezeStatusDialog : public QDialog
{
Q_OBJECT
public:
patternFreezeStatusDialog( QThread * _thread );
~patternFreezeStatusDialog();
virtual ~patternFreezeStatusDialog();
void FASTCALL setProgress( int _p );
void setProgress( int _p );
protected:

View File

@@ -1,8 +1,8 @@
/*
* piano_widget.h - declaration of class pianoWidget, a widget which provides
* piano_widget.h - declaration of class pianoView, a widget which provides
* an interactive piano/keyboard-widget
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -37,35 +37,54 @@
class instrumentTrack;
class knob;
class instrumentTrackView;
class notePlayHandle;
enum keyTypes
enum KeyTypes
{
WHITE_KEY,
BLACK_KEY
WhiteKey,
BlackKey
} ;
class pianoWidget : public QWidget
class piano : public model
{
public:
piano( instrumentTrack * _it );
virtual ~piano();
void setKeyState( int _key, bool _on = FALSE );
static int getKeyFromKeycode( int _kc );
private:
instrumentTrack * m_instrumentTrack;
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
friend class pianoView;
} ;
class pianoView : public QWidget, public modelView
{
Q_OBJECT
public:
pianoWidget( instrumentTrack * _channel_track );
virtual ~pianoWidget();
pianoView( QWidget * _parent );
virtual ~pianoView();
void setKeyState( int _key, bool _on = FALSE );
protected:
virtual void modelChanged( void );
virtual void keyPressEvent( QKeyEvent * ke );
virtual void keyReleaseEvent( QKeyEvent * ke );
#ifndef BUILD_WIN32
virtual bool x11Event( XEvent * _xe );
#endif
protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void customEvent( QEvent * );
virtual void paintEvent( QPaintEvent * );
virtual void mousePressEvent( QMouseEvent * me );
virtual void mouseReleaseEvent( QMouseEvent * me );
@@ -74,19 +93,17 @@ protected:
private:
int FASTCALL getKeyFromMouse( const QPoint & _p ) const;
int FASTCALL getKeyFromKeyboard( int _k ) const;
int FASTCALL getKeyX( int _key_num ) const;
int getKeyFromMouse( const QPoint & _p ) const;
int getKeyX( int _key_num ) const;
static QPixmap * s_whiteKeyPm;
static QPixmap * s_blackKeyPm;
static QPixmap * s_whiteKeyPressedPm;
static QPixmap * s_blackKeyPressedPm;
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
piano * m_piano;
QScrollBar * m_pianoScroll;
instrumentTrack * m_instrumentTrack;
tones m_startTone; // first key when drawing
octaves m_startOctave;
@@ -94,7 +111,6 @@ private:
unsigned int m_keyCode;
private slots:
void pianoScrolled( int _new_pos );

View File

@@ -47,12 +47,12 @@ public:
sampleTCO( track * _track );
virtual ~sampleTCO();
virtual void FASTCALL changeLength( const midiTime & _length );
virtual void changeLength( const midiTime & _length );
const QString & sampleFile( void ) const;
virtual void FASTCALL saveSettings( QDomDocument & _doc,
virtual void saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "sampletco" );
@@ -110,26 +110,23 @@ private:
class sampleTrack : public QObject, public track
class sampleTrack : public track
{
Q_OBJECT
public:
sampleTrack( trackContainer * _tc );
virtual ~sampleTrack();
virtual trackTypes type( void ) const;
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 );
virtual trackContentObject * FASTCALL createTCO( const midiTime &
_pos );
virtual trackView * createView( trackContainerView * _tcv );
virtual trackContentObject * createTCO( const midiTime & _pos );
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
_this );
virtual void loadTrackSpecificSettings( const QDomElement & _this );
inline audioPort * getAudioPort( void )
{
@@ -143,13 +140,30 @@ public:
private:
effectLabel * m_trackLabel;
audioPort m_audioPort;
volumeKnob * m_volumeKnob;
knobModel m_volumeModel;
friend class sampleTrackView;
} ;
class sampleTrackView : public track
{
public:
sampleTrackView( sampleTrack * _track, trackContainerView * _tcv );
virtual ~sampleTrackView();
private:
effectLabel * m_trackLabel;
volumeKnob * m_volumeKnob;
} ;
#endif

270
include/song.h Normal file
View File

@@ -0,0 +1,270 @@
/*
* song.h - class song - the root of the model-tree
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _SONG_H
#define _SONG_H
#include "track_container.h"
#include "automatable_model.h"
#include "automatable_slider.h"
#include "lcd_spinbox.h"
class pattern;
class timeLine;
const bpm_t MIN_BPM = 10;
const bpm_t DEFAULT_BPM = 140;
const bpm_t MAX_BPM = 999;
const Uint16 MAX_SONG_LENGTH = 9999;
class song : public trackContainer
{
Q_OBJECT
mapPropertyFromModel(int,masterPitch,setMasterPitch,m_masterPitchModel);
mapPropertyFromModel(int,masterVolume,setMasterVolume,
m_masterVolumeModel);
public:
enum PlayModes
{
Mode_PlaySong,
Mode_PlayTrack,
Mode_PlayBB,
Mode_PlayPattern,
Mode_PlayAutomationPattern,
Mode_Count
} ;
class playPos : public midiTime
{
public:
playPos( Sint32 _abs = 0 ) :
midiTime( _abs ),
m_timeLine( NULL ),
m_timeLineUpdate( TRUE ),
m_currentFrame( 0.0f )
{
}
inline void setCurrentFrame( const float _f )
{
m_currentFrame = _f;
}
inline float currentFrame( void ) const
{
return( m_currentFrame );
}
timeLine * m_timeLine;
bool m_timeLineUpdate;
private:
float m_currentFrame;
} ;
void processNextBuffer( void );
inline bool paused( void ) const
{
return( m_paused );
}
inline bool playing( void ) const
{
return( m_playing && m_exporting == FALSE );
}
inline bool exporting( void ) const
{
return( m_exporting );
}
bool realTimeTask( void ) const;
inline bool exportDone( void ) const
{
return( m_exporting == TRUE &&
m_playPos[Mode_PlaySong].getTact() >=
lengthInTacts() + 1 );
}
inline PlayModes playMode( void ) const
{
return( m_playMode );
}
inline playPos & getPlayPos( PlayModes _pm )
{
return( m_playPos[_pm] );
}
tact lengthInTacts( void ) const;
bpm_t getTempo( void );
virtual automationPattern * tempoAutomationPattern( void );
// file management
void createNewProject( void );
void createNewProjectFromTemplate( const QString & _template );
void loadProject( const QString & _file_name );
bool saveProject( void );
bool saveProjectAs( const QString & _file_name );
inline const QString & projectFileName( void ) const
{
return( m_fileName );
}
inline bool isLoadingProject( void ) const
{
return( m_loadingProject );
}
inline bool isModified( void ) const
{
return( m_modified );
}
inline virtual QString nodeName( void ) const
{
return( "song" );
}
virtual inline bool fixedTCOs( void ) const
{
return( FALSE );
}
public slots:
void play( void );
void stop( void );
void playTrack( track * _trackToPlay );
void playBB( void );
void playPattern( pattern * _patternToPlay, bool _loop = TRUE );
void pause( void );
void resumeFromPause( void );
void importProject( void );
void exportProject( void );
void startExport( void );
void stopExport( void );
void setModified( void );
void clearProject( void );
private slots:
void insertBar( void );
void removeBar( void );
void addBBTrack( void );
void addSampleTrack( void );
void setTempo( void );
void masterVolumeChanged( void );
void doActions( void );
void updateFramesPerTact64th( void );
private:
song( void );
song( const song & );
virtual ~song();
inline tact currentTact( void ) const
{
return( m_playPos[m_playMode].getTact() );
}
midiTime length( void ) const;
inline tact64th currentTact64th( void ) const
{
return( m_playPos[m_playMode].getTact64th() );
}
void setPlayPos( tact _tact_num, tact64th _t_64th, PlayModes
_play_mode );
track * m_automationTrack;
lcdSpinBoxModel m_tempoModel;
sliderModel m_masterVolumeModel;
sliderModel m_masterPitchModel;
QString m_fileName;
QString m_oldFileName;
bool m_modified;
volatile bool m_exporting;
volatile bool m_playing;
volatile bool m_paused;
bool m_loadingProject;
PlayModes m_playMode;
playPos m_playPos[Mode_Count];
track * m_trackToPlay;
pattern * m_patternToPlay;
bool m_loopPattern;
enum Actions
{
ActionStop,
ActionPlaySong,
ActionPlayTrack,
ActionPlayBB,
ActionPlayPattern,
ActionPause,
ActionResumeFromPause
} ;
QVector<Actions> m_actions;
friend class engine;
friend class songEditor;
signals:
void tempoChanged( bpm_t _new_bpm );
} ;
#endif

View File

@@ -2,7 +2,7 @@
* song_editor.h - declaration of class songEditor, a window where you can
* setup your songs
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -36,166 +36,24 @@ class QLabel;
class QScrollBar;
class comboBox;
class pattern;
class song;
class textFloat;
class timeLine;
class toolButton;
const bpm_t MIN_BPM = 10;
const bpm_t DEFAULT_BPM = 140;
const bpm_t MAX_BPM = 999;
const Uint16 MAX_SONG_LENGTH = 9999;
class songEditor : public trackContainer
class songEditor : public trackContainerView
{
Q_OBJECT
mapPropertyFromModel(int,masterPitch,setMasterPitch,m_masterPitchModel);
mapPropertyFromModel(int,masterVolume,setMasterVolume,m_masterVolumeModel);
public:
enum playModes
{
PLAY_SONG,
PLAY_TRACK,
PLAY_BB,
PLAY_PATTERN,
PLAY_AUTOMATION_PATTERN,
PLAY_MODE_CNT
} ;
songEditor( song * _song );
virtual ~songEditor();
class playPos : public midiTime
{
public:
playPos( Sint32 _abs = 0 ) :
midiTime( _abs ),
m_timeLine( NULL ),
m_timeLineUpdate( TRUE ),
m_currentFrame( 0.0f )
{
}
inline void setCurrentFrame( const float _f )
{
m_currentFrame = _f;
}
inline float currentFrame( void ) const
{
return( m_currentFrame );
}
timeLine * m_timeLine;
bool m_timeLineUpdate;
private:
float m_currentFrame;
} ;
void processNextBuffer( void );
inline bool paused( void ) const
{
return( m_paused );
}
inline bool playing( void ) const
{
return( m_playing && m_exporting == FALSE );
}
inline bool exporting( void ) const
{
return( m_exporting );
}
bool realTimeTask( void ) const;
inline bool exportDone( void ) const
{
return( m_exporting == TRUE &&
m_playPos[PLAY_SONG].getTact() >= lengthInTacts() + 1 );
}
inline playModes playMode( void ) const
{
return( m_playMode );
}
inline playPos & getPlayPos( playModes _pm )
{
return( m_playPos[_pm] );
}
tact lengthInTacts( void ) const;
bpm_t getTempo( void );
virtual automationPattern * tempoAutomationPattern( void );
// file management
void createNewProject( void );
void FASTCALL createNewProjectFromTemplate( const QString & _template );
void FASTCALL loadProject( const QString & _file_name );
bool saveProject( void );
bool FASTCALL saveProjectAs( const QString & _file_name );
inline const QString & projectFileName( void ) const
{
return( m_fileName );
}
inline virtual QString nodeName( void ) const
{
return( "songeditor" );
}
virtual inline bool fixedTCOs( void ) const
{
return( FALSE );
}
public slots:
void play( void );
void stop( void );
void playTrack( track * _trackToPlay );
void playBB( void );
void playPattern( pattern * _patternToPlay, bool _loop = TRUE );
void pause( void );
void resumeFromPause( void );
void importProject( void );
void exportProject( void );
void startExport( void );
void stopExport( void );
void setModified( void );
void clearProject( void );
protected:
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void wheelEvent( QWheelEvent * _we );
virtual void paintEvent( QPaintEvent * _pe );
virtual bool allowRubberband( void ) const;
protected slots:
void insertBar( void );
void removeBar( void );
void addBBTrack( void );
void addSampleTrack( void );
private slots:
void scrolled( int _new_pos );
void updateTimeLinePosition( void );
void setTempo( void );
void masterVolumeChanged( int _new_val );
void masterVolumePressed( void );
void masterVolumeMoved( int _new_val );
@@ -209,31 +67,18 @@ protected slots:
void zoomingChanged( void );
void doActions( void );
private:
songEditor( void );
songEditor( const songEditor & );
virtual ~songEditor();
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void wheelEvent( QWheelEvent * _we );
virtual void paintEvent( QPaintEvent * _pe );
virtual bool allowRubberband( void ) const;
// virtual void modelChanged( void );
inline tact currentTact( void ) const
{
return( m_playPos[m_playMode].getTact() );
}
midiTime length( void ) const;
inline tact64th currentTact64th( void ) const
{
return( m_playPos[m_playMode].getTact64th() );
}
void FASTCALL setPlayPos( tact _tact_num, tact64th _t_64th, playModes
_play_mode );
track * m_automationTrack;
song * m_s;
QScrollBar * m_leftRightScroll;
@@ -242,12 +87,9 @@ private:
toolButton * m_playButton;
toolButton * m_stopButton;
lcdSpinBox * m_tempoSpinBox;
lcdSpinBoxModel m_tempoModel;
automatableSlider * m_masterVolumeSlider;
automatableSlider * m_masterPitchSlider;
sliderModel m_masterVolumeModel;
sliderModel m_masterPitchModel;
textFloat * m_mvsStatus;
textFloat * m_mpsStatus;
@@ -261,45 +103,10 @@ private:
comboBox * m_zoomingComboBox;
QString m_fileName;
QString m_oldFileName;
volatile bool m_exporting;
volatile bool m_playing;
volatile bool m_paused;
bool m_loadingProject;
playModes m_playMode;
playPos m_playPos[PLAY_MODE_CNT];
track * m_trackToPlay;
pattern * m_patternToPlay;
bool m_loopPattern;
bool m_scrollBack;
enum ACTIONS
{
ACT_STOP_PLAY, ACT_PLAY_SONG, ACT_PLAY_TRACK, ACT_PLAY_BB,
ACT_PLAY_PATTERN, ACT_PAUSE, ACT_RESUME_FROM_PAUSE
} ;
QVector<ACTIONS> m_actions;
friend class engine;
private slots:
void updateFramesPerTact64th( void );
signals:
void tempoChanged( bpm_t _new_bpm );
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* timeline.h - class timeLine, representing a time-line with position marker
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,7 +28,7 @@
#include <QtGui/QWidget>
#include "song_editor.h"
#include "song.h"
class QPixmap;
@@ -40,39 +40,43 @@ class timeLine : public QWidget, public journallingObject
{
Q_OBJECT
public:
enum autoScrollStates
enum AutoScrollStates
{
AUTOSCROLL_ENABLED, AUTOSCROLL_DISABLED
AutoScrollEnabled,
AutoScrollDisabled
} ;
enum loopPointStates
enum LoopPointStates
{
LOOP_POINTS_DISABLED, LOOP_POINTS_ENABLED
LoopPointsDisabled,
LoopPointsEnabled
} ;
enum behaviourAtStopStates
enum BehaviourAtStopStates
{
BACK_TO_ZERO, BACK_TO_START, KEEP_STOP_POSITION
BackToZero,
BackToStart,
KeepStopPosition
} ;
timeLine( int _xoff, int _yoff, float _ppt, songEditor::playPos & _pos,
timeLine( int _xoff, int _yoff, float _ppt, song::playPos & _pos,
const midiTime & _begin, QWidget * _parent );
virtual ~timeLine();
inline songEditor::playPos & pos( void )
inline song::playPos & pos( void )
{
return( m_pos );
}
behaviourAtStopStates behaviourAtStop( void ) const
BehaviourAtStopStates behaviourAtStop( void ) const
{
return( m_behaviourAtStop );
}
bool loopPointsEnabled( void ) const
{
return( m_loopPoints == LOOP_POINTS_ENABLED );
return( m_loopPoints == LoopPointsEnabled );
}
inline const midiTime & loopBegin( void ) const
@@ -105,9 +109,8 @@ public:
void addToolButtons( QWidget * _tool_bar );
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "timeline" );
@@ -145,16 +148,16 @@ private:
static QPixmap * s_loopPointPixmap;
static QPixmap * s_loopPointDisabledPixmap;
autoScrollStates m_autoScroll;
loopPointStates m_loopPoints;
behaviourAtStopStates m_behaviourAtStop;
AutoScrollStates m_autoScroll;
LoopPointStates m_loopPoints;
BehaviourAtStopStates m_behaviourAtStop;
bool m_changedPosition;
int m_xOffset;
int m_posMarkerX;
float m_ppt;
songEditor::playPos & m_pos;
song::playPos & m_pos;
const midiTime & m_begin;
midiTime m_loopPos[2];
@@ -166,7 +169,10 @@ private:
enum actions
{
NONE, MOVE_POS_MARKER, MOVE_LOOP_BEGIN, MOVE_LOOP_END
NoAction,
MovePositionMarker,
MoveLoopBegin,
MoveLoopEnd
} m_action;
int m_moveXOff;

View File

@@ -2,7 +2,7 @@
* track.h - declaration of classes concerning tracks -> neccessary for all
* track-like objects (beat/bassline, sample-track...)
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -44,6 +44,7 @@
#include "midi_time.h"
#include "rubberband.h"
#include "journalling_object.h"
#include "automatable_model.h"
class QMenu;
@@ -54,26 +55,27 @@ class bbTrack;
class pixmapButton;
class textFloat;
class track;
class trackContentObjectView;
class trackContainer;
class trackContainerView;
class trackContentWidget;
class trackWidget;
class trackView;
typedef QWidget trackSettingsWidget;
const Uint16 DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const Uint16 TRACK_OP_WIDTH = 70;
const Uint16 TCO_BORDER_WIDTH = 1;
const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const int TRACK_OP_WIDTH = 70;
const int TCO_BORDER_WIDTH = 1;
class trackContentObject : public selectableObject,
public journallingObject
class trackContentObject : public model, public journallingObject
{
Q_OBJECT
public:
trackContentObject( track * _track );
trackContentObject( const trackContentObject & _copy );
// trackContentObject( const trackContentObject & _copy );
virtual ~trackContentObject();
inline track * getTrack( void )
{
@@ -94,17 +96,71 @@ public:
bool muted( void ) const
{
return( m_muted );
return( m_mutedModel.value() );
}
virtual void movePosition( const midiTime & _pos );
virtual void changeLength( const midiTime & _length );
virtual trackContentObjectView * createView( trackView * _tv ) = 0;
protected:
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
protected slots:
void cut( void );
void copy( void );
void paste( void );
void toggleMute( void );
signals:
void lengthChanged( void );
void positionChanged( void );
private:
enum Actions
{
NoAction,
Move,
Resize
} ;
track * m_track;
midiTime m_startPosition;
midiTime m_length;
boolModel m_mutedModel;
friend class trackContentObjectView;
} ;
class trackContentObjectView : public selectableObject, public modelView
{
Q_OBJECT
public:
trackContentObjectView( trackContentObject * _tco, trackView * _tv );
virtual ~trackContentObjectView();
bool fixedTCOs( void );
virtual void FASTCALL movePosition( const midiTime & _pos );
virtual void FASTCALL changeLength( const midiTime & _length );
inline trackContentObject * getTrackContentObject( void )
{
return( m_tco );
}
public slots:
virtual void close( void );
virtual bool close( void );
protected:
@@ -123,34 +179,34 @@ protected:
void setAutoResizeEnabled( bool _e = FALSE );
float pixelsPerTact( void );
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
inline trackView * getTrackView( void )
{
return( m_trackView );
}
protected slots:
void cut( void );
void copy( void );
void paste( void );
void toggleMute( void );
void updateLength( void );
void updatePosition( void );
private:
enum actions
enum Actions
{
NONE, MOVE, MOVE_SELECTION, RESIZE
NoAction,
Move,
MoveSelection,
Resize
} ;
static textFloat * s_textFloat;
track * m_track;
midiTime m_startPosition;
midiTime m_length;
actions m_action;
trackContentObject * m_tco;
trackView * m_trackView;
Actions m_action;
bool m_autoResize;
Sint16 m_initialMouseX;
bool m_muted;
textFloat * m_hint;
midiTime m_oldTime;// used for undo/redo while mouse-button is pressed
@@ -160,39 +216,30 @@ private:
class trackContentWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
trackContentWidget( trackWidget * _parent );
trackContentWidget( trackView * _parent );
virtual ~trackContentWidget();
trackContentObject * FASTCALL getTCO( int _tco_num );
int numOfTCOs( void );
trackContentObject * FASTCALL addTCO( trackContentObject * _tco );
void FASTCALL removeTCO( int _tco_num, bool _also_delete = TRUE );
void FASTCALL removeTCO( trackContentObject * _tco,
bool _also_delete = TRUE );
void removeAllTCOs( void );
void FASTCALL swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
inline Uint16 pixelsPerTact( void ) const
void addTCOView( trackContentObjectView * _tcov );
void removeTCOView( trackContentObjectView * _tcov );
void removeTCOView( int _tco_num )
{
return( m_pixelsPerTact );
if( _tco_num >= 0 && _tco_num < m_tcoViews.size() )
{
removeTCOView( m_tcoViews[_tco_num] );
}
}
inline void setPixelsPerTact( Uint16 _ppt )
{
m_pixelsPerTact = _ppt;
}
tact length( void ) const;
midiTime endPosition( const midiTime & _pos_start );
public slots:
void insertTact( const midiTime & _pos );
void removeTact( const midiTime & _pos );
void update( void );
void changePosition( const midiTime & _new_pos = -1 );
protected:
@@ -212,19 +259,21 @@ protected:
private:
enum actions
enum Actions
{
ADD_TCO, REMOVE_TCO
AddTrackContentObject,
RemoveTrackContentObject
} ;
track * getTrack( void );
midiTime getPosition( int _mouse_x );
typedef QVector<trackContentObject *> tcoVector;
trackView * m_trackView;
tcoVector m_trackContentObjects;
trackWidget * m_trackWidget;
Uint16 m_pixelsPerTact;
typedef QVector<trackContentObjectView *> tcoViewVector;
tcoViewVector m_tcoViews;
int m_pixelsPerTact;
} ;
@@ -236,7 +285,7 @@ class trackOperationsWidget : public QWidget
{
Q_OBJECT
public:
trackOperationsWidget( trackWidget * _parent );
trackOperationsWidget( trackView * _parent );
~trackOperationsWidget();
bool muted( void ) const;
@@ -267,7 +316,7 @@ private:
static QPixmap * s_muteOnDisabled;
static QPixmap * s_muteOnEnabled;
trackWidget * m_trackWidget;
trackView * m_trackView;
QPushButton * m_trackOps;
pixmapButton * m_muteBtn;
@@ -283,14 +332,137 @@ private:
// base-class for all tracks
class track : public model, public journallingObject
{
Q_OBJECT
mapPropertyFromModel(bool,muted,setMuted,m_mutedModel);
public:
enum TrackTypes
{
InstrumentTrack,
BBTrack,
SampleTrack,
EventTrack,
VideoTrack,
AutomationTrack,
NumTrackTypes
} ;
// actual widget shown in trackContainer
class trackWidget : public QWidget, public journallingObject
track( TrackTypes _type, trackContainer * _tc );
virtual ~track();
static track * create( TrackTypes _tt, trackContainer * _tc );
static track * create( const QDomElement & _this,
trackContainer * _tc );
void clone( void );
// pure virtual functions
TrackTypes type( void ) const
{
return( m_type );
}
virtual bool play( const midiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 ) = 0;
virtual trackView * createView( trackContainerView * _view ) = 0;
virtual trackContentObject * createTCO( const midiTime & _pos ) = 0;
virtual void saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent ) = 0;
virtual void loadTrackSpecificSettings( const QDomElement & _this ) = 0;
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
// -- for usage by trackContentObject only ---------------
trackContentObject * addTCO( trackContentObject * _tco );
void removeTCO( trackContentObject * _tco );
// -------------------------------------------------------
int numOfTCOs( void );
trackContentObject * getTCO( int _tco_num );
int getTCONum( trackContentObject * _tco );
void getTCOsInRange( QList<trackContentObject *> & _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
{
return( m_name );
}
inline const QPixmap * pixmap( void )
{
return( m_pixmap );
}
using model::dataChanged;
public slots:
virtual void setName( const QString & _new_name )
{
m_name = _new_name;
}
protected:
void sendMidiTime( const midiTime & _time );
private:
trackContainer * m_trackContainer;
TrackTypes m_type;
QString m_name;
QPixmap * m_pixmap;
boolModel m_mutedModel;
typedef QVector<trackContentObject *> tcoVector;
tcoVector m_trackContentObjects;
QList<automationPattern *> m_automationPatterns;
friend class trackView;
signals:
void trackContentObjectAdded( trackContentObject * );
} ;
class trackView : public QWidget, public modelView, public journallingObject
{
Q_OBJECT
public:
trackWidget( track * _track, QWidget * _parent );
virtual ~trackWidget();
trackView( track * _track, trackContainerView * _tcv );
virtual ~trackView();
inline const track * getTrack( void ) const
{
@@ -302,56 +474,46 @@ public:
return( m_track );
}
inline const trackOperationsWidget & getTrackOperationsWidget( void )
const
inline trackContainerView * getTrackContainerView( void )
{
return( m_trackOperationsWidget );
return( m_trackContainerView );
}
inline const trackSettingsWidget & getTrackSettingsWidget( void ) const
inline trackOperationsWidget * getTrackOperationsWidget( void )
{
return( m_trackSettingsWidget );
return( &m_trackOperationsWidget );
}
inline const trackContentWidget & getTrackContentWidget( void ) const
inline trackSettingsWidget * getTrackSettingsWidget( void )
{
return( m_trackContentWidget );
return( &m_trackSettingsWidget );
}
inline trackOperationsWidget & getTrackOperationsWidget( void )
inline trackContentWidget * getTrackContentWidget( void )
{
return( m_trackOperationsWidget );
}
inline trackSettingsWidget & getTrackSettingsWidget( void )
{
return( m_trackSettingsWidget );
}
inline trackContentWidget & getTrackContentWidget( void )
{
return( m_trackContentWidget );
return( &m_trackContentWidget );
}
bool isMovingTrack( void ) const
{
return( m_action == MOVE_TRACK );
return( m_action == MoveTrack );
}
virtual void update( void );
public slots:
void changePosition( const midiTime & _new_pos = -1 );
virtual bool close( void );
protected:
virtual void modelChanged( void );
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
virtual QString nodeName( void ) const
{
return( "trackwidget" );
return( "trackview" );
}
@@ -363,153 +525,30 @@ protected:
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
midiTime FASTCALL endPosition( const midiTime & _pos_start );
private:
enum actions
enum Actions
{
NONE, MOVE_TRACK, RESIZE_TRACK
NoAction,
MoveTrack,
ResizeTrack
} ;
track * m_track;
trackContainerView * m_trackContainerView;
trackOperationsWidget m_trackOperationsWidget;
trackSettingsWidget m_trackSettingsWidget;
trackContentWidget m_trackContentWidget;
actions m_action;
Actions m_action;
private slots:
void createTCOView( trackContentObject * _tco );
} ;
// base-class for all tracks
class track : public journallingObject
{
public:
enum trackTypes
{
INSTRUMENT_TRACK,
BB_TRACK,
SAMPLE_TRACK,
EVENT_TRACK,
VIDEO_TRACK,
AUTOMATION_TRACK,
TOTAL_TRACK_TYPES
} ;
track( trackContainer * _tc, bool _create_widget = TRUE );
virtual ~track();
static track * FASTCALL create( trackTypes _tt, trackContainer * _tc );
static void FASTCALL create( const QDomElement & _this,
trackContainer * _tc );
void FASTCALL clone( void );
tact length( void ) const;
inline bool muted( void ) const
{
return( m_trackWidget->getTrackOperationsWidget().muted() );
}
inline void setMuted( bool _muted )
{
m_trackWidget->getTrackOperationsWidget().setMuted( _muted );
}
// pure virtual functions
virtual trackTypes type( void ) const = 0;
virtual bool FASTCALL play( const midiTime & _start,
const fpp_t _frames,
const f_cnt_t _frame_base,
Sint16 _tco_num = -1 ) = 0;
virtual trackContentObject * FASTCALL createTCO(
const midiTime & _pos ) = 0;
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
QDomElement & _parent ) = 0;
virtual void FASTCALL loadTrackSpecificSettings(
const QDomElement & _this ) = 0;
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _this );
virtual void FASTCALL loadSettings( const QDomElement & _this );
trackContentObject * FASTCALL addTCO( trackContentObject * _tco );
void FASTCALL removeTCO( int _tco_num );
int numOfTCOs( void );
trackContentObject * FASTCALL getTCO( int _tco_num );
int FASTCALL getTCONum( trackContentObject * _tco );
void FASTCALL getTCOsInRange( QList<trackContentObject *> & _tco_v,
const midiTime & _start,
const midiTime & _end );
void FASTCALL swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
inline trackWidget * getTrackWidget( void )
{
return( m_trackWidget );
}
inline trackContainer * getTrackContainer( void ) const
{
return( m_trackContainer );
}
inline const trackSettingsWidget * getTrackSettingsWidget( void ) const
{
return( &m_trackWidget->getTrackSettingsWidget() );
}
inline const trackContentWidget * getTrackContentWidget( void ) const
{
return( &m_trackWidget->getTrackContentWidget() );
}
inline trackSettingsWidget * getTrackSettingsWidget( void )
{
return( &m_trackWidget->getTrackSettingsWidget() );
}
inline trackContentWidget * getTrackContentWidget( void )
{
return( &m_trackWidget->getTrackContentWidget() );
}
void addAutomationPattern( automationPattern * _pattern );
void removeAutomationPattern( automationPattern * _pattern );
// name-stuff
inline virtual const QString & name( void ) const
{
return( m_name );
}
inline virtual void setName( const QString & _new_name )
{
m_name = _new_name;
}
protected:
void sendMidiTime( const midiTime & _time );
QString m_name;
private:
trackContainer * m_trackContainer;
trackWidget * m_trackWidget;
QList<automationPattern *> m_automation_patterns;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* track_container.h - base-class for all track-containers like Song-Editor,
* BB-Editor...
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -36,65 +36,98 @@
#include "journalling_object.h"
class trackContainerView;
class QVBoxLayout;
class trackContainer : public QWidget, public journallingObject
class trackContainer : public model, public journallingObject
{
Q_OBJECT
public:
trackContainer( void );
virtual ~trackContainer();
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual automationPattern * tempoAutomationPattern( void )
{
return( NULL );
}
int countTracks( track::TrackTypes _tt = track::NumTrackTypes ) const;
void setMutedOfAllTracks( bool _muted );
virtual void updateAfterTrackAdd( void );
void addTrack( track * _track );
void removeTrack( track * _track );
void clearAllTracks( void );
const QList<track *> & tracks( void ) const
{
return( m_tracks );
}
static const QString classNodeName( void )
{
return( "trackcontainer" );
}
//const QList<track *> tracks( void ) const;
signals:
void trackAdded( track * _track );
private:
QList<track *> m_tracks;
friend class trackContainerView;
} ;
class trackContainerView : public QWidget, public modelView,
public journallingObject
{
Q_OBJECT
public:
trackContainerView( trackContainer * _tc );
virtual ~trackContainerView();
QWidget * contentWidget( void )
{
return( m_scrollArea );
}
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline float pixelsPerTact( void ) const
{
return( m_ppt );
}
inline const midiTime & currentPosition( void ) const
{
return( m_currentPosition );
}
virtual automationPattern * tempoAutomationPattern( void )
{
return( NULL );
}
virtual bool fixedTCOs( void ) const
{
return( FALSE );
}
Uint16 FASTCALL countTracks( track::trackTypes _tt =
track::TOTAL_TRACK_TYPES ) const;
inline float pixelsPerTact( void ) const
{
return( m_ppt );
}
void FASTCALL setMutedOfAllTracks( bool _muted );
void setPixelsPerTact( int _ppt );
virtual void updateAfterTrackAdd( void );
void FASTCALL setPixelsPerTact( Uint16 _ppt );
void FASTCALL addTrack( track * _track );
void FASTCALL removeTrack( track * _track );
void FASTCALL moveTrackUp( track * _track );
void FASTCALL moveTrackDown( track * _track );
void FASTCALL realignTracks( void );
void clearAllTracks( void );
const trackWidget * trackWidgetAt( const int _y ) const;
const trackView * trackViewAt( const int _y ) const;
virtual bool allowRubberband( void ) const;
@@ -110,73 +143,101 @@ public:
return( m_rubberBand->selectedObjects() );
}
return( QVector<selectableObject *>() );
/* QVector<selectableObject *> foo;
return( foo );*/
}
QList<track *> tracks( void );
static const QString classNodeName( void )
trackContainer * model( void )
{
return( "trackcontainer" );
return( m_tc );
}
const trackContainer * model( void ) const
{
return( m_tc );
}
void moveTrackViewUp( trackView * _tv );
void moveTrackViewDown( trackView * _tv );
// -- for usage by trackView only ---------------
trackView * addTrackView( trackView * _tv );
void removeTrackView( trackView * _tv );
// -------------------------------------------------------
void clearAllTracks( void );
virtual QString nodeName( void ) const
{
return( "trackcontainerview" );
}
signals:
void positionChanged( const midiTime & _pos );
public slots:
void realignTracks( void );
void createTrackView( track * _t );
protected:
static const Uint16 DEFAULT_PIXELS_PER_TACT = 16;
static const int DEFAULT_PIXELS_PER_TACT = 16;
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
const QList<trackView *> & trackViews( void ) const
{
return( m_trackViews );
}
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * );
const QList<track *> tracks( void ) const;
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
midiTime m_currentPosition;
private:
enum actions
enum Actions
{
ADD_TRACK, REMOVE_TRACK
AddTrack,
RemoveTrack
} ;
class scrollArea : public QScrollArea
{
public:
scrollArea( trackContainer * _parent );
scrollArea( trackContainerView * _parent );
virtual ~scrollArea();
protected:
virtual void wheelEvent( QWheelEvent * _we );
private:
trackContainer * m_trackContainer;
trackContainerView * m_trackContainerView;
} ;
trackContainer * m_tc;
typedef QList<trackView *> trackViewList;
trackViewList m_trackViews;
scrollArea * m_scrollArea;
QVBoxLayout * m_scrollLayout;
QList<track *> m_tracks;
float m_ppt;
rubberBand * m_rubberBand;
QPoint m_origin;
signals:
void positionChanged( const midiTime & _pos );
} ;
#endif