Merge pull request #1622 from M374LX/coding

Progressive coding conventions update (new branch)
This commit is contained in:
Tres Finocchiaro
2015-03-04 01:55:28 +00:00
14 changed files with 729 additions and 688 deletions

View File

@@ -81,36 +81,37 @@ const float MaxDetuning = 4 * 12.0f;
class EXPORT Note : public SerializingObject
{
public:
Note( const MidiTime & _length = MidiTime( 0 ),
const MidiTime & _pos = MidiTime( 0 ),
Note( const MidiTime & length = MidiTime( 0 ),
const MidiTime & pos = MidiTime( 0 ),
int key = DefaultKey,
volume_t _volume = DefaultVolume,
panning_t _panning = DefaultPanning,
DetuningHelper * _detuning = NULL );
Note( const Note & _note );
volume_t volume = DefaultVolume,
panning_t panning = DefaultPanning,
DetuningHelper * detuning = NULL );
Note( const Note & note );
virtual ~Note();
// used by GUI
inline void setSelected( const bool _selected ) { m_selected = _selected; }
inline void setOldKey( const int _oldKey ) { m_oldKey = _oldKey; }
inline void setOldPos( const MidiTime & _oldPos ) { m_oldPos = _oldPos; }
inline void setOldLength( const MidiTime & _oldLength )
inline void setSelected( const bool selected ) { m_selected = selected; }
inline void setOldKey( const int oldKey ) { m_oldKey = oldKey; }
inline void setOldPos( const MidiTime & oldPos ) { m_oldPos = oldPos; }
inline void setOldLength( const MidiTime & oldLength )
{
m_oldLength = _oldLength;
m_oldLength = oldLength;
}
inline void setIsPlaying( const bool _isPlaying )
inline void setIsPlaying( const bool isPlaying )
{
m_isPlaying = _isPlaying;
m_isPlaying = isPlaying;
}
void setLength( const MidiTime & _length );
void setPos( const MidiTime & _pos );
void setKey( const int _key );
void setLength( const MidiTime & length );
void setPos( const MidiTime & pos );
void setKey( const int key );
virtual void setVolume( volume_t volume );
virtual void setPanning( panning_t panning );
void quantizeLength( const int _q_grid );
void quantizePos( const int _q_grid );
void quantizeLength( const int qGrid );
void quantizePos( const int qGrid );
static inline bool lessThan( Note * &lhs, Note * &rhs )
{
@@ -160,9 +161,9 @@ public:
return m_pos;
}
inline MidiTime pos( MidiTime _base_pos ) const
inline MidiTime pos( MidiTime basePos ) const
{
const int bp = _base_pos;
const int bp = basePos;
return m_pos - bp;
}
@@ -196,7 +197,7 @@ public:
return classNodeName();
}
static MidiTime quantized( const MidiTime & _m, const int _q_grid );
static MidiTime quantized( const MidiTime & m, const int qGrid );
DetuningHelper * detuning() const
{
@@ -208,8 +209,7 @@ public:
protected:
virtual void saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void saveSettings( QDomDocument & doc, QDomElement & parent );
virtual void loadSettings( const QDomElement & _this );
@@ -234,4 +234,3 @@ typedef QVector<Note *> NoteVector;
#endif

View File

@@ -85,19 +85,19 @@ public:
{
typedef QMap<QString, QString> AttributeMap;
inline Key( const Plugin::Descriptor * _desc = NULL,
const QString & _name = QString(),
const AttributeMap & _am = AttributeMap() )
inline Key( const Plugin::Descriptor * desc = NULL,
const QString & name = QString(),
const AttributeMap & am = AttributeMap() )
:
desc( _desc ),
name( _name ),
attributes( _am )
desc( desc ),
name( name ),
attributes( am )
{
}
Key( const QDomElement & _key );
Key( const QDomElement & key );
QDomElement saveXML( QDomDocument & _doc ) const;
QDomElement saveXML( QDomDocument & doc ) const;
inline bool isValid() const
{
@@ -134,7 +134,7 @@ public:
const Plugin::PluginTypes m_type;
} ;
SubPluginFeatures *subPluginFeatures;
SubPluginFeatures * subPluginFeatures;
} ;
@@ -142,15 +142,15 @@ public:
typedef QList<Descriptor> DescriptorList;
// contructor of a plugin
Plugin( const Descriptor* descriptor, Model* parent );
Plugin( const Descriptor * descriptor, Model * parent );
virtual ~Plugin();
// returns display-name out of descriptor
virtual QString displayName() const
{
return Model::displayName().isEmpty()
? m_descriptor->displayName
: Model::displayName();
? m_descriptor->displayName
: Model::displayName();
}
// return plugin-type
@@ -160,41 +160,41 @@ public:
}
// return plugin-descriptor for further information
inline const Descriptor* descriptor() const
inline const Descriptor * descriptor() const
{
return m_descriptor;
}
// can be called if a file matching supportedFileTypes should be
// loaded/processed with the help of this plugin
virtual void loadFile( const QString& file );
virtual void loadFile( const QString & file );
// Called if external source needs to change something but we cannot
// reference the class header. Should return null if not key not found.
virtual AutomatableModel* childModel( const QString& modelName );
virtual AutomatableModel* childModel( const QString & modelName );
// returns an instance of a plugin whose name matches to given one
// if specified plugin couldn't be loaded, it creates a dummy-plugin
static Plugin * instantiate( const QString& pluginName, Model *parent, void * data );
static Plugin * instantiate( const QString& pluginName, Model * parent, void * data );
// fills given list with descriptors of all available plugins
static void getDescriptorsOfAvailPlugins( DescriptorList& pluginDescriptors );
static void getDescriptorsOfAvailPlugins( DescriptorList & pluginDescriptors );
// create a view for the model
PluginView* createView( QWidget* parent );
PluginView * createView( QWidget * parent );
protected:
// create a view for the model
virtual PluginView* instantiateView( QWidget* ) = 0;
void collectErrorForUI( QString err_msg );
virtual PluginView* instantiateView( QWidget * ) = 0;
void collectErrorForUI( QString errMsg );
private:
const Descriptor* m_descriptor;
const Descriptor * m_descriptor;
// pointer to instantiation-function in plugin
typedef Plugin * ( * InstantiationHook )( Model*, void* );
typedef Plugin * ( * InstantiationHook )( Model * , void * );
} ;

View File

@@ -61,7 +61,6 @@ private:
CompareType m_compareType;
} ;
/*
* ProjectVersion v. ProjectVersion
*/
@@ -72,5 +71,4 @@ inline bool operator>=(const ProjectVersion & v1, const ProjectVersion & v2) { r
inline bool operator==(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) == 0; }
inline bool operator!=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) != 0; }
#endif

View File

@@ -49,10 +49,9 @@ const tick_t MaxSongLength = 9999 * DefaultTicksPerTact;
class EXPORT Song : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel(int,getTempo,setTempo,m_tempoModel);
mapPropertyFromModel(int,masterPitch,setMasterPitch,m_masterPitchModel);
mapPropertyFromModel(int,masterVolume,setMasterVolume,
m_masterVolumeModel);
mapPropertyFromModel( int,getTempo,setTempo,m_tempoModel );
mapPropertyFromModel( int,masterPitch,setMasterPitch,m_masterPitchModel );
mapPropertyFromModel( int,masterVolume,setMasterVolume, m_masterVolumeModel );
public:
enum PlayModes
{
@@ -70,19 +69,19 @@ public:
bool hasErrors();
QString* errorSummary();
class playPos : public MidiTime
class PlayPos : public MidiTime
{
public:
playPos( const int _abs = 0 ) :
MidiTime( _abs ),
PlayPos( const int abs = 0 ) :
MidiTime( abs ),
m_timeLine( NULL ),
m_timeLineUpdate( true ),
m_currentFrame( 0.0f )
{
}
inline void setCurrentFrame( const float _f )
inline void setCurrentFrame( const float f )
{
m_currentFrame = _f;
m_currentFrame = f;
}
inline float currentFrame() const
{
@@ -104,9 +103,9 @@ public:
{
return m_elapsedMilliSeconds;
}
inline void setMilliSeconds( float _ellapsedMilliSeconds )
inline void setMilliSeconds( float ellapsedMilliSeconds )
{
m_elapsedMilliSeconds = (_ellapsedMilliSeconds);
m_elapsedMilliSeconds = ellapsedMilliSeconds;
}
inline int getTacts() const
{
@@ -123,14 +122,14 @@ public:
// Returns the beat position inside the bar, 0-based
inline int getBeat() const
{
return (currentTick() - currentTact()*ticksPerTact()) /
(ticksPerTact() / m_timeSigModel.getNumerator() );
return ( currentTick() - currentTact() * ticksPerTact() ) /
( ticksPerTact() / m_timeSigModel.getNumerator() );
}
// the remainder after bar and beat are removed
inline int getBeatTicks() const
{
return (currentTick() - currentTact()*ticksPerTact()) %
(ticksPerTact() / m_timeSigModel.getNumerator() );
return ( currentTick() - currentTact() * ticksPerTact() ) %
( ticksPerTact() / m_timeSigModel.getNumerator() );
}
inline int getTicks() const
{
@@ -151,7 +150,7 @@ public:
inline bool isPlaying() const
{
return m_playing && m_exporting == false;
return m_playing == true && m_exporting == false;
}
inline bool isStopped() const
@@ -186,9 +185,9 @@ public:
return m_playMode;
}
inline playPos & getPlayPos( PlayModes _pm )
inline PlayPos & getPlayPos( PlayModes pm )
{
return m_playPos[_pm];
return m_playPos[pm];
}
void updateLength();
@@ -208,11 +207,11 @@ public:
// file management
void createNewProject();
void createNewProjectFromTemplate( const QString & _template );
void loadProject( const QString & _filename );
void createNewProjectFromTemplate( const QString & templ );
void loadProject( const QString & filename );
bool guiSaveProject();
bool guiSaveProjectAs( const QString & _filename );
bool saveProjectFile( const QString & _filename );
bool guiSaveProjectAs( const QString & filename );
bool saveProjectFile( const QString & filename );
const QString & projectFileName() const
{
@@ -239,8 +238,8 @@ public:
return false;
}
void addController( Controller * _c );
void removeController( Controller * _c );
void addController( Controller * c );
void removeController( Controller * c );
const ControllerVector & controllers() const
@@ -259,14 +258,14 @@ public slots:
void playSong();
void record();
void playAndRecord();
void playTrack( Track * _trackToPlay );
void playTrack( Track * trackToPlay );
void playBB();
void playPattern(const Pattern* patternToPlay, bool _loop = true );
void playPattern( const Pattern * patternToPlay, bool loop = true );
void togglePause();
void stop();
void importProject();
void exportProject(bool multiExport=false);
void exportProject( bool multiExport = false );
void exportProjectTracks();
void exportProjectMidi();
@@ -316,13 +315,14 @@ private:
inline f_cnt_t currentFrame() const
{
return m_playPos[m_playMode].getTicks() * Engine::framesPerTick() + m_playPos[m_playMode].currentFrame();
return m_playPos[m_playMode].getTicks() * Engine::framesPerTick() +
m_playPos[m_playMode].currentFrame();
}
void setPlayPos( tick_t _ticks, PlayModes _play_mode );
void setPlayPos( tick_t ticks, PlayModes playMode );
void saveControllerStates( QDomDocument & _doc, QDomElement & _this );
void restoreControllerStates( const QDomElement & _this );
void saveControllerStates( QDomDocument & doc, QDomElement & element );
void restoreControllerStates( const QDomElement & element );
AutomationTrack * m_globalAutomationTrack;
@@ -352,7 +352,7 @@ private:
QList<QString> * m_errors;
PlayModes m_playMode;
playPos m_playPos[Mode_Count];
PlayPos m_playPos[Mode_Count];
tact_t m_length;
Track * m_trackToPlay;
@@ -375,10 +375,9 @@ signals:
void projectLoaded();
void playbackStateChanged();
void playbackPositionChanged();
void lengthChanged( int _tacts );
void tempoChanged( bpm_t _new_bpm );
void timeSignatureChanged( int _old_ticks_per_tact,
int _ticks_per_tact );
void lengthChanged( int tacts );
void tempoChanged( bpm_t newBPM );
void timeSignatureChanged( int oldTicksPerTact, int ticksPerTact );
} ;

View File

@@ -62,11 +62,11 @@ public:
} ;
TimeLineWidget( int _xoff, int _yoff, float _ppt, Song::playPos & _pos,
const MidiTime & _begin, QWidget * _parent );
TimeLineWidget( int xoff, int yoff, float ppt, Song::PlayPos & pos,
const MidiTime & begin, QWidget * parent );
virtual ~TimeLineWidget();
inline Song::playPos & pos()
inline Song::PlayPos & pos()
{
return( m_pos );
}
@@ -169,7 +169,7 @@ private:
int m_xOffset;
int m_posMarkerX;
float m_ppt;
Song::playPos & m_pos;
Song::PlayPos & m_pos;
const MidiTime & m_begin;
MidiTime m_loopPos[2];

View File

@@ -81,7 +81,7 @@ class TrackContentObject : public Model, public JournallingObject
mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
mapPropertyFromModel(bool,isSolo,setSolo,m_soloModel);
public:
TrackContentObject( Track * _track );
TrackContentObject( Track * track );
virtual ~TrackContentObject();
inline Track * getTrack() const
@@ -94,9 +94,9 @@ public:
return m_name;
}
inline void setName( const QString & _name )
inline void setName( const QString & name )
{
m_name = _name;
m_name = name;
emit dataChanged();
}
@@ -122,9 +122,9 @@ public:
return m_length;
}
inline void setAutoResize( const bool _r )
inline void setAutoResize( const bool r )
{
m_autoResize = _r;
m_autoResize = r;
}
inline const bool getAutoResize() const
@@ -132,10 +132,10 @@ public:
return m_autoResize;
}
virtual void movePosition( const MidiTime & _pos );
virtual void changeLength( const MidiTime & _length );
virtual void movePosition( const MidiTime & pos );
virtual void changeLength( const MidiTime & length );
virtual TrackContentObjectView * createView( TrackView * _tv ) = 0;
virtual TrackContentObjectView * createView( TrackView * tv ) = 0;
inline void selectViewOnCreate( bool select )
{
@@ -195,7 +195,7 @@ class TrackContentObjectView : public selectableObject, public ModelView
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
public:
TrackContentObjectView( TrackContentObject * _tco, TrackView * _tv );
TrackContentObjectView( TrackContentObject * tco, TrackView * tv );
virtual ~TrackContentObjectView();
bool fixedTCOs();
@@ -207,8 +207,8 @@ public:
// qproperty access func
QColor fgColor() const;
QColor textColor() const;
void setFgColor( const QColor & _c );
void setTextColor( const QColor & _c );
void setFgColor( const QColor & c );
void setTextColor( const QColor & c );
public slots:
virtual bool close();
@@ -220,13 +220,13 @@ protected:
{
}
virtual void contextMenuEvent( QContextMenuEvent * _cme );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void leaveEvent( QEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void contextMenuEvent( QContextMenuEvent * cme );
virtual void dragEnterEvent( QDragEnterEvent * dee );
virtual void dropEvent( QDropEvent * de );
virtual void leaveEvent( QEvent * e );
virtual void mousePressEvent( QMouseEvent * me );
virtual void mouseMoveEvent( QMouseEvent * me );
virtual void mouseReleaseEvent( QMouseEvent * me );
float pixelsPerTact();
@@ -276,7 +276,7 @@ private:
m_initialMouseGlobalPos = mapToGlobal( pos );
}
bool mouseMovedDistance( QMouseEvent * _me, int distance );
bool mouseMovedDistance( QMouseEvent * me, int distance );
} ;
@@ -293,46 +293,46 @@ class TrackContentWidget : public QWidget, public JournallingObject
Q_PROPERTY( QBrush lighterColor READ lighterColor WRITE setLighterColor )
public:
TrackContentWidget( TrackView * _parent );
TrackContentWidget( TrackView * parent );
virtual ~TrackContentWidget();
/*! \brief Updates the background tile pixmap. */
void updateBackground();
void addTCOView( TrackContentObjectView * _tcov );
void removeTCOView( TrackContentObjectView * _tcov );
void removeTCOView( int _tco_num )
void addTCOView( TrackContentObjectView * tcov );
void removeTCOView( TrackContentObjectView * tcov );
void removeTCOView( int tcoNum )
{
if( _tco_num >= 0 && _tco_num < m_tcoViews.size() )
if( tcoNum >= 0 && tcoNum < m_tcoViews.size() )
{
removeTCOView( m_tcoViews[_tco_num] );
removeTCOView( m_tcoViews[tcoNum] );
}
}
bool canPasteSelection( MidiTime tcoPos, const QMimeData * mimeData );
bool pasteSelection( MidiTime tcoPos, QDropEvent * _de );
bool pasteSelection( MidiTime tcoPos, QDropEvent * de );
MidiTime endPosition( const MidiTime & _pos_start );
MidiTime endPosition( const MidiTime & posStart );
// qproperty access methods
QBrush darkerColor() const;
QBrush lighterColor() const;
void setDarkerColor( const QBrush & _c );
void setLighterColor( const QBrush & _c );
void setDarkerColor( const QBrush & c );
void setLighterColor( const QBrush & c );
public slots:
void update();
void changePosition( const MidiTime & _new_pos = MidiTime( -1 ) );
void changePosition( const MidiTime & newPos = MidiTime( -1 ) );
protected:
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
virtual void dragEnterEvent( QDragEnterEvent * dee );
virtual void dropEvent( QDropEvent * de );
virtual void mousePressEvent( QMouseEvent * me );
virtual void paintEvent( QPaintEvent * pe );
virtual void resizeEvent( QResizeEvent * re );
virtual QString nodeName() const
{
@@ -353,7 +353,7 @@ protected:
private:
Track * getTrack();
MidiTime getPosition( int _mouse_x );
MidiTime getPosition( int mouseX );
TrackView * m_trackView;
@@ -375,13 +375,13 @@ class TrackOperationsWidget : public QWidget
{
Q_OBJECT
public:
TrackOperationsWidget( TrackView * _parent );
TrackOperationsWidget( TrackView * parent );
~TrackOperationsWidget();
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void mousePressEvent( QMouseEvent * me );
virtual void paintEvent( QPaintEvent * pe );
private slots:
@@ -405,7 +405,7 @@ private:
friend class TrackView;
signals:
void trackRemovalScheduled( TrackView * _t );
void trackRemovalScheduled( TrackView * t );
} ;
@@ -435,12 +435,12 @@ public:
NumTrackTypes
} ;
Track( TrackTypes _type, TrackContainer * _tc );
Track( TrackTypes type, TrackContainer * tc );
virtual ~Track();
static Track * create( TrackTypes _tt, TrackContainer * _tc );
static Track * create( const QDomElement & _this,
TrackContainer * _tc );
static Track * create( TrackTypes tt, TrackContainer * tc );
static Track * create( const QDomElement & element,
TrackContainer * tc );
void clone();
@@ -450,20 +450,20 @@ public:
return m_type;
}
virtual bool play( const MidiTime & _start, const fpp_t _frames,
const f_cnt_t _frame_base, int _tco_num = -1 ) = 0;
virtual bool play( const MidiTime & start, const fpp_t frames,
const f_cnt_t frameBase, int tcoNum = -1 ) = 0;
virtual TrackView * createView( TrackContainerView * _view ) = 0;
virtual TrackContentObject * createTCO( const MidiTime & _pos ) = 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 saveTrackSpecificSettings( QDomDocument & doc,
QDomElement & parent ) = 0;
virtual void loadTrackSpecificSettings( const QDomElement & element ) = 0;
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
virtual void saveSettings( QDomDocument & doc, QDomElement & element );
virtual void loadSettings( const QDomElement & element );
void setSimpleSerializing()
{
@@ -471,26 +471,26 @@ public:
}
// -- for usage by TrackContentObject only ---------------
TrackContentObject * addTCO( TrackContentObject * _tco );
void removeTCO( TrackContentObject * _tco );
TrackContentObject * addTCO( TrackContentObject * tco );
void removeTCO( TrackContentObject * tco );
// -------------------------------------------------------
void deleteTCOs();
int numOfTCOs();
TrackContentObject * getTCO( int _tco_num );
int getTCONum(const TrackContentObject* _tco );
TrackContentObject * getTCO( int tcoNum );
int getTCONum(const TrackContentObject* tco );
const tcoVector & getTCOs() const
{
return( m_trackContentObjects );
return m_trackContentObjects;
}
void getTCOsInRange( tcoVector & _tco_v, const MidiTime & _start,
const MidiTime & _end );
void swapPositionOfTCOs( int _tco_num1, int _tco_num2 );
void getTCOsInRange( tcoVector & tcoV, const MidiTime & start,
const MidiTime & end );
void swapPositionOfTCOs( int tcoNum1, int tcoNum2 );
void insertTact( const MidiTime & _pos );
void removeTact( const MidiTime & _pos );
void insertTact( const MidiTime & pos );
void removeTact( const MidiTime & pos );
tact_t length() const;
@@ -503,21 +503,25 @@ public:
// name-stuff
virtual const QString & name() const
{
return( m_name );
return m_name;
}
virtual QString displayName() const
{
return( name() );
return name();
}
using Model::dataChanged;
inline int getHeight() {
return ( m_height >= MINIMAL_TRACK_HEIGHT ? m_height : DEFAULT_TRACK_HEIGHT );
inline int getHeight()
{
return m_height >= MINIMAL_TRACK_HEIGHT
? m_height
: DEFAULT_TRACK_HEIGHT;
}
inline void setHeight( int _height ) {
m_height = _height;
inline void setHeight( int height )
{
m_height = height;
}
void lock()
@@ -534,9 +538,9 @@ public:
}
public slots:
virtual void setName( const QString & _new_name )
virtual void setName( const QString & newName )
{
m_name = _new_name;
m_name = newName;
emit nameChanged();
}
@@ -583,12 +587,12 @@ public:
inline const Track * getTrack() const
{
return( m_track );
return m_track;
}
inline Track * getTrack()
{
return( m_track );
return m_track;
}
inline TrackContainerView* trackContainerView()
@@ -598,22 +602,22 @@ public:
inline TrackOperationsWidget * getTrackOperationsWidget()
{
return( &m_trackOperationsWidget );
return &m_trackOperationsWidget;
}
inline trackSettingsWidget * getTrackSettingsWidget()
{
return( &m_trackSettingsWidget );
return &m_trackSettingsWidget;
}
inline TrackContentWidget * getTrackContentWidget()
{
return( &m_trackContentWidget );
return &m_trackContentWidget;
}
bool isMovingTrack() const
{
return( m_action == MoveTrack );
return m_action == MoveTrack;
}
virtual void update();
@@ -643,13 +647,13 @@ protected:
}
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 paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
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 paintEvent( QPaintEvent * pe );
virtual void resizeEvent( QResizeEvent * re );
private:
@@ -674,7 +678,7 @@ private:
private slots:
void createTCOView( TrackContentObject * _tco );
void createTCOView( TrackContentObject * tco );
} ;

View File

@@ -315,9 +315,9 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
{
m_profiler.startPeriod();
static Song::playPos last_metro_pos = -1;
static Song::PlayPos last_metro_pos = -1;
Song::playPos p = Engine::getSong()->getPlayPos(
Song::PlayPos p = Engine::getSong()->getPlayPos(
Song::Mode_PlayPattern );
if( Engine::getSong()->playMode() == Song::Mode_PlayPattern &&
gui->pianoRoll()->isRecording() == true &&
@@ -965,6 +965,3 @@ void Mixer::fifoWriter::run()

View File

@@ -2,7 +2,7 @@
* note.cpp - implementation of class note
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
@@ -29,28 +29,30 @@
#include "Note.h"
#include "DetuningHelper.h"
#include "templates.h"
Note::Note( const MidiTime & _length, const MidiTime & _pos,
int _key, volume_t _volume, panning_t _panning,
DetuningHelper * _detuning ) :
Note::Note( const MidiTime & length, const MidiTime & pos,
int key, volume_t volume, panning_t panning,
DetuningHelper * detuning ) :
m_selected( false ),
m_oldKey( qBound( 0, _key, NumKeys ) ),
m_oldPos( _pos ),
m_oldLength( _length ),
m_oldKey( qBound( 0, key, NumKeys ) ),
m_oldPos( pos ),
m_oldLength( length ),
m_isPlaying( false ),
m_key( qBound( 0, _key, NumKeys ) ),
m_volume( qBound( MinVolume, _volume, MaxVolume ) ),
m_panning( qBound( PanningLeft, _panning, PanningRight ) ),
m_length( _length ),
m_pos( _pos ),
m_key( qBound( 0, key, NumKeys ) ),
m_volume( qBound( MinVolume, volume, MaxVolume ) ),
m_panning( qBound( PanningLeft, panning, PanningRight ) ),
m_length( length ),
m_pos( pos ),
m_detuning( NULL )
{
if( _detuning )
if( detuning )
{
m_detuning = sharedObject::ref( _detuning );
m_detuning = sharedObject::ref( detuning );
}
else
{
@@ -61,23 +63,23 @@ Note::Note( const MidiTime & _length, const MidiTime & _pos,
Note::Note( const Note & _note ) :
SerializingObject( _note ),
m_selected( _note.m_selected ),
m_oldKey( _note.m_oldKey ),
m_oldPos( _note.m_oldPos ),
m_oldLength( _note.m_oldLength ),
m_isPlaying( _note.m_isPlaying ),
m_key( _note.m_key),
m_volume( _note.m_volume ),
m_panning( _note.m_panning ),
m_length( _note.m_length ),
m_pos( _note.m_pos ),
Note::Note( const Note & note ) :
SerializingObject( note ),
m_selected( note.m_selected ),
m_oldKey( note.m_oldKey ),
m_oldPos( note.m_oldPos ),
m_oldLength( note.m_oldLength ),
m_isPlaying( note.m_isPlaying ),
m_key( note.m_key),
m_volume( note.m_volume ),
m_panning( note.m_panning ),
m_length( note.m_length ),
m_pos( note.m_pos ),
m_detuning( NULL )
{
if( _note.m_detuning )
if( note.m_detuning )
{
m_detuning = sharedObject::ref( _note.m_detuning );
m_detuning = sharedObject::ref( note.m_detuning );
}
}
@@ -95,93 +97,93 @@ Note::~Note()
void Note::setLength( const MidiTime & _length )
void Note::setLength( const MidiTime & length )
{
m_length = _length;
m_length = length;
}
void Note::setPos( const MidiTime & _pos )
void Note::setPos( const MidiTime & pos )
{
m_pos = _pos;
m_pos = pos;
}
void Note::setKey( const int _key )
void Note::setKey( const int key )
{
const int k = qBound( 0, _key, NumKeys );
const int k = qBound( 0, key, NumKeys );
m_key = k;
}
void Note::setVolume( volume_t _volume )
void Note::setVolume( volume_t volume )
{
const volume_t v = qBound( MinVolume, _volume, MaxVolume );
const volume_t v = qBound( MinVolume, volume, MaxVolume );
m_volume = v;
}
void Note::setPanning( panning_t _panning )
void Note::setPanning( panning_t panning )
{
const panning_t p = qBound( PanningLeft, _panning, PanningRight );
const panning_t p = qBound( PanningLeft, panning, PanningRight );
m_panning = p;
}
MidiTime Note::quantized( const MidiTime & _m, const int _q_grid )
MidiTime Note::quantized( const MidiTime & m, const int qGrid )
{
float p = ( (float) _m / _q_grid );
float p = ( (float) m / qGrid );
if( p - floorf( p ) < 0.5f )
{
return( static_cast<int>( p ) * _q_grid );
return static_cast<int>( p ) * qGrid;
}
return( static_cast<int>( p + 1 ) * _q_grid );
return static_cast<int>( p + 1 ) * qGrid;
}
void Note::quantizeLength( const int _q_grid )
void Note::quantizeLength( const int qGrid )
{
setLength( quantized( length(), _q_grid ) );
setLength( quantized( length(), qGrid ) );
if( length() == 0 )
{
setLength( _q_grid );
setLength( qGrid );
}
}
void Note::quantizePos( const int _q_grid )
void Note::quantizePos( const int qGrid )
{
setPos( quantized( pos(), _q_grid ) );
setPos( quantized( pos(), qGrid ) );
}
void Note::saveSettings( QDomDocument & _doc, QDomElement & _this )
void Note::saveSettings( QDomDocument & doc, QDomElement & parent )
{
_this.setAttribute( "key", m_key );
_this.setAttribute( "vol", m_volume );
_this.setAttribute( "pan", m_panning );
_this.setAttribute( "len", m_length );
_this.setAttribute( "pos", m_pos );
parent.setAttribute( "key", m_key );
parent.setAttribute( "vol", m_volume );
parent.setAttribute( "pan", m_panning );
parent.setAttribute( "len", m_length );
parent.setAttribute( "pos", m_pos );
if( m_detuning && m_length )
{
m_detuning->saveSettings( _doc, _this );
m_detuning->saveSettings( doc, parent );
}
}
@@ -229,4 +231,3 @@ bool Note::hasDetuningInfo() const

View File

@@ -38,9 +38,9 @@
#include "Song.h"
static PixmapLoader __dummy_loader;
static PixmapLoader __dummyLoader;
static Plugin::Descriptor dummy_plugin_descriptor =
static Plugin::Descriptor dummyPluginDescriptor =
{
"dummy",
"dummy",
@@ -48,21 +48,21 @@ static Plugin::Descriptor dummy_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
Plugin::Undefined,
&__dummy_loader,
&__dummyLoader,
NULL
} ;
Plugin::Plugin( const Descriptor * _descriptor, Model * parent ) :
Plugin::Plugin( const Descriptor * descriptor, Model * parent ) :
Model( parent ),
JournallingObject(),
m_descriptor( _descriptor )
m_descriptor( descriptor )
{
if( m_descriptor == NULL )
{
m_descriptor = &dummy_plugin_descriptor;
m_descriptor = &dummyPluginDescriptor;
}
}
@@ -109,7 +109,7 @@ Plugin * Plugin::instantiate( const QString & pluginName, Model * parent,
return new DummyPlugin();
}
InstantiationHook instantiationHook = ( InstantiationHook ) pluginLibrary.resolve( "lmms_plugin_main" );
InstantiationHook instantiationHook = ( InstantiationHook )pluginLibrary.resolve( "lmms_plugin_main" );
if( instantiationHook == NULL )
{
if( Engine::hasGUI() )
@@ -126,13 +126,17 @@ Plugin * Plugin::instantiate( const QString & pluginName, Model * parent,
return inst;
}
void Plugin::collectErrorForUI( QString err_msg )
void Plugin::collectErrorForUI( QString errMsg )
{
Engine::getSong()->collectError( err_msg );
Engine::getSong()->collectError( errMsg );
}
void Plugin::getDescriptorsOfAvailPlugins( DescriptorList& pluginDescriptors )
{
QDir directory( ConfigManager::inst()->pluginDir() );
@@ -189,13 +193,13 @@ PluginView * Plugin::createView( QWidget * parent )
Plugin::Descriptor::SubPluginFeatures::Key::Key(
const QDomElement & _key ) :
Plugin::Descriptor::SubPluginFeatures::Key::Key( const QDomElement & key ) :
desc( NULL ),
name( _key.attribute( "key" ) ),
name( key.attribute( "key" ) ),
attributes()
{
QDomNodeList l = _key.elementsByTagName( "attribute" );
QDomNodeList l = key.elementsByTagName( "attribute" );
for( int i = 0; !l.item( i ).isNull(); ++i )
{
QDomElement e = l.item( i ).toElement();
@@ -208,13 +212,13 @@ Plugin::Descriptor::SubPluginFeatures::Key::Key(
QDomElement Plugin::Descriptor::SubPluginFeatures::Key::saveXML(
QDomDocument & _doc ) const
QDomDocument & doc ) const
{
QDomElement e = _doc.createElement( "key" );
for( AttributeMap::ConstIterator it = attributes.begin();
it != attributes.end(); ++it )
QDomElement e = doc.createElement( "key" );
for( AttributeMap::ConstIterator it = attributes.begin();
it != attributes.end(); ++it )
{
QDomElement a = _doc.createElement( "attribute" );
QDomElement a = doc.createElement( "attribute" );
a.setAttribute( "name", it.key() );
a.setAttribute( "value", it.value() );
e.appendChild( a );
@@ -222,3 +226,5 @@ QDomElement Plugin::Descriptor::SubPluginFeatures::Key::saveXML(
return e;
}

View File

@@ -163,7 +163,7 @@ void ProjectRenderer::run()
//skip first empty buffer
Engine::mixer()->nextBuffer();
Song::playPos & pp = Engine::getSong()->getPlayPos(
Song::PlayPos & pp = Engine::getSong()->getPlayPos(
Song::Mode_PlaySong );
m_progress = 0;
const int sl = ( Engine::getSong()->length() + 1 ) * 192;
@@ -230,5 +230,3 @@ void ProjectRenderer::updateConsoleProgress()

View File

@@ -31,18 +31,30 @@ int parseMajor(QString & version) {
return version.section( '.', 0, 0 ).toInt();
}
int parseMinor(QString & version) {
return version.section( '.', 1, 1 ).toInt();
}
int parseRelease(QString & version) {
return version.section( '.', 2 ).section( '-', 0, 0 ).toInt();
}
QString parseBuild(QString & version) {
return version.section( '.', 2 ).section( '-', 1 );
}
ProjectVersion::ProjectVersion(QString version, CompareType c) :
m_version(version),
m_major(parseMajor(m_version)),
@@ -53,41 +65,48 @@ ProjectVersion::ProjectVersion(QString version, CompareType c) :
{
}
ProjectVersion::ProjectVersion(const char* version, CompareType c) :
m_version(QString(version)),
m_major(parseMajor(m_version)),
m_minor(parseMinor(m_version)),
m_release(parseRelease(m_version)) ,
m_release(parseRelease(m_version)),
m_build(parseBuild(m_version)),
m_compareType(c)
{
}
int ProjectVersion::compare(const ProjectVersion& a, const ProjectVersion& b, CompareType c)
int ProjectVersion::compare(const ProjectVersion & a, const ProjectVersion & b, CompareType c)
{
if (a.getMajor() != b.getMajor())
if(a.getMajor() != b.getMajor())
{
return a.getMajor() - b.getMajor();
}
else if (c == CompareType::Major)
else if(c == CompareType::Major)
{
return 0;
}
if (a.getMinor() != b.getMinor())
if(a.getMinor() != b.getMinor())
{
return a.getMinor() - b.getMinor();
}
else if (c == CompareType::Minor)
else if(c == CompareType::Minor)
{
return 0;
}
if (a.getRelease() != b.getRelease())
if(a.getRelease() != b.getRelease())
{
return a.getRelease() - b.getRelease();
}
else if (c == CompareType::Release)
else if(c == CompareType::Release)
{
return 0;
}
@@ -105,8 +124,13 @@ int ProjectVersion::compare(const ProjectVersion& a, const ProjectVersion& b, Co
return QString::compare(a.getBuild(), b.getBuild());
}
int ProjectVersion::compare(ProjectVersion v1, ProjectVersion v2)
{
return compare(v1, v2, std::min(v1.getCompareType(), v2.getCompareType()));
}

View File

@@ -145,7 +145,7 @@ void Song::masterVolumeChanged()
void Song::setTempo()
{
Engine::mixer()->lockPlayHandleRemoval();
const bpm_t tempo = (bpm_t) m_tempoModel.value();
const bpm_t tempo = ( bpm_t ) m_tempoModel.value();
PlayHandleList & playHandles = Engine::mixer()->playHandles();
for( PlayHandleList::Iterator it = playHandles.begin();
it != playHandles.end(); ++it )
@@ -177,7 +177,8 @@ void Song::setTimeSignature()
emit dataChanged();
m_oldTicksPerTact = ticksPerTact();
m_vstSyncController.setTimeSignature( getTimeSigModel().getNumerator(), getTimeSigModel().getDenominator() );
m_vstSyncController.setTimeSignature(
getTimeSigModel().getNumerator(), getTimeSigModel().getDenominator() );
}
@@ -203,13 +204,13 @@ void Song::processNextBuffer()
return;
}
TrackList track_list;
int tco_num = -1;
TrackList trackList;
int tcoNum = -1;
switch( m_playMode )
{
case Mode_PlaySong:
track_list = tracks();
trackList = tracks();
// at song-start we have to reset the LFOs
if( m_playPos[Mode_PlaySong] == 0 )
{
@@ -218,25 +219,25 @@ void Song::processNextBuffer()
break;
case Mode_PlayTrack:
track_list.push_back( m_trackToPlay );
trackList.push_back( m_trackToPlay );
break;
case Mode_PlayBB:
if( Engine::getBBTrackContainer()->numOfBBs() > 0 )
{
tco_num = Engine::getBBTrackContainer()->
tcoNum = Engine::getBBTrackContainer()->
currentBB();
track_list.push_back( BBTrack::findBBTrack(
tco_num ) );
trackList.push_back( BBTrack::findBBTrack(
tcoNum ) );
}
break;
case Mode_PlayPattern:
if( m_patternToPlay != NULL )
{
tco_num = m_patternToPlay->getTrack()->
tcoNum = m_patternToPlay->getTrack()->
getTCONum( m_patternToPlay );
track_list.push_back(
trackList.push_back(
m_patternToPlay->getTrack() );
}
break;
@@ -246,41 +247,44 @@ void Song::processNextBuffer()
}
if( track_list.empty() == true )
if( trackList.empty() == true )
{
return;
}
// check for looping-mode and act if necessary
TimeLineWidget * tl = m_playPos[m_playMode].m_timeLine;
bool check_loop = tl != NULL && m_exporting == false &&
tl->loopPointsEnabled();
if( check_loop )
bool checkLoop =
tl != NULL && m_exporting == false && tl->loopPointsEnabled();
if( checkLoop )
{
if( m_playPos[m_playMode] < tl->loopBegin() ||
m_playPos[m_playMode] >= tl->loopEnd() )
{
m_elapsedMilliSeconds = (tl->loopBegin().getTicks()*60*1000/48)/getTempo();
m_elapsedMilliSeconds =
( tl->loopBegin().getTicks() * 60 * 1000 / 48 ) / getTempo();
m_playPos[m_playMode].setTicks(
tl->loopBegin().getTicks() );
}
}
f_cnt_t total_frames_played = 0;
const float frames_per_tick = Engine::framesPerTick();
f_cnt_t totalFramesPlayed = 0;
const float framesPerTick = Engine::framesPerTick();
while( total_frames_played
< Engine::mixer()->framesPerPeriod() )
while( totalFramesPlayed < Engine::mixer()->framesPerPeriod() )
{
m_vstSyncController.update();
f_cnt_t played_frames = Engine::mixer()->framesPerPeriod() - total_frames_played;
f_cnt_t playedFrames = Engine::mixer()->framesPerPeriod() -
totalFramesPlayed;
float current_frame = m_playPos[m_playMode].currentFrame();
float currentFrame = m_playPos[m_playMode].currentFrame();
// did we play a tick?
if( current_frame >= frames_per_tick )
if( currentFrame >= framesPerTick )
{
int ticks = m_playPos[m_playMode].getTicks() + (int)( current_frame / frames_per_tick );
int ticks = m_playPos[m_playMode].getTicks() +
( int )( currentFrame / framesPerTick );
m_vstSyncController.setAbsolutePosition( ticks );
@@ -290,14 +294,14 @@ void Song::processNextBuffer()
// per default we just continue playing even if
// there's no more stuff to play
// (song-play-mode)
int max_tact = m_playPos[m_playMode].getTact()
int maxTact = m_playPos[m_playMode].getTact()
+ 2;
// then decide whether to go over to next tact
// or to loop back to first tact
if( m_playMode == Mode_PlayBB )
{
max_tact = Engine::getBBTrackContainer()
maxTact = Engine::getBBTrackContainer()
->lengthOfCurrentBB();
}
else if( m_playMode == Mode_PlayPattern &&
@@ -305,34 +309,39 @@ void Song::processNextBuffer()
tl != NULL &&
tl->loopPointsEnabled() == false )
{
max_tact = m_patternToPlay->length()
maxTact = m_patternToPlay->length()
.getTact();
}
// end of played object reached?
if( m_playPos[m_playMode].getTact() + 1
>= max_tact )
>= maxTact )
{
// then start from beginning and keep
// offset
ticks = ticks % ( max_tact * MidiTime::ticksPerTact() );
ticks %= ( maxTact * MidiTime::ticksPerTact() );
// wrap milli second counter
m_elapsedMilliSeconds = ( ticks * 60 * 1000 / 48 ) / getTempo();
m_elapsedMilliSeconds =
( ticks * 60 * 1000 / 48 ) / getTempo();
m_vstSyncController.setAbsolutePosition( ticks );
}
}
m_playPos[m_playMode].setTicks( ticks );
if( check_loop )
if( checkLoop )
{
m_vstSyncController.startCycle( tl->loopBegin().getTicks(), tl->loopEnd().getTicks() );
m_vstSyncController.startCycle(
tl->loopBegin().getTicks(), tl->loopEnd().getTicks() );
if( m_playPos[m_playMode] >= tl->loopEnd() )
{
m_playPos[m_playMode].setTicks( tl->loopBegin().getTicks() );
m_elapsedMilliSeconds = ((tl->loopBegin().getTicks())*60*1000/48)/getTempo();
m_elapsedMilliSeconds =
( ( tl->loopBegin().getTicks() ) * 60 * 1000 / 48 ) /
getTempo();
}
}
else
@@ -340,55 +349,57 @@ void Song::processNextBuffer()
m_vstSyncController.stopCycle();
}
current_frame = fmodf( current_frame, frames_per_tick );
m_playPos[m_playMode].setCurrentFrame( current_frame );
currentFrame = fmodf( currentFrame, framesPerTick );
m_playPos[m_playMode].setCurrentFrame( currentFrame );
}
f_cnt_t last_frames = (f_cnt_t)frames_per_tick -
(f_cnt_t) current_frame;
f_cnt_t lastFrames = ( f_cnt_t )framesPerTick -
( f_cnt_t )currentFrame;
// skip last frame fraction
if( last_frames == 0 )
if( lastFrames == 0 )
{
++total_frames_played;
m_playPos[m_playMode].setCurrentFrame( current_frame
++totalFramesPlayed;
m_playPos[m_playMode].setCurrentFrame( currentFrame
+ 1.0f );
continue;
}
// do we have some samples left in this tick but these are
// less then samples we have to play?
if( last_frames < played_frames )
if( lastFrames < playedFrames )
{
// then set played_samples to remaining samples, the
// rest will be played in next loop
played_frames = last_frames;
playedFrames = lastFrames;
}
if( (f_cnt_t) current_frame == 0 )
if( ( f_cnt_t ) currentFrame == 0 )
{
if( m_playMode == Mode_PlaySong )
{
m_globalAutomationTrack->play(
m_playPos[m_playMode],
played_frames,
total_frames_played, tco_num );
playedFrames,
totalFramesPlayed, tcoNum );
}
// loop through all tracks and play them
for( int i = 0; i < track_list.size(); ++i )
for( int i = 0; i < trackList.size(); ++i )
{
track_list[i]->play( m_playPos[m_playMode],
played_frames,
total_frames_played, tco_num );
trackList[i]->play( m_playPos[m_playMode],
playedFrames,
totalFramesPlayed, tcoNum );
}
}
// update frame-counters
total_frames_played += played_frames;
m_playPos[m_playMode].setCurrentFrame( played_frames +
current_frame );
m_elapsedMilliSeconds += (((played_frames/frames_per_tick)*60*1000/48)/getTempo());
totalFramesPlayed += playedFrames;
m_playPos[m_playMode].setCurrentFrame( playedFrames +
currentFrame );
m_elapsedMilliSeconds +=
( ( playedFrames / framesPerTick ) * 60 * 1000 / 48 )
/ getTempo();
m_elapsedTacts = m_playPos[Mode_PlaySong].getTact();
m_elapsedTicks = (m_playPos[Mode_PlaySong].getTicks()%ticksPerTact())/48;
m_elapsedTicks = ( m_playPos[Mode_PlaySong].getTicks() % ticksPerTact() ) / 48;
}
}
@@ -397,17 +408,21 @@ bool Song::isExportDone() const
if ( m_renderBetweenMarkers )
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTicks() >= m_playPos[Mode_PlaySong].m_timeLine->loopEnd().getTicks();
m_playPos[Mode_PlaySong].getTicks() >=
m_playPos[Mode_PlaySong].m_timeLine->loopEnd().getTicks();
}
if( m_exportLoop)
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTicks() >= length() * ticksPerTact();
m_playPos[Mode_PlaySong].getTicks() >=
length() * ticksPerTact();
}
else
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTicks() >= ( length() + 1 ) * ticksPerTact();
m_playPos[Mode_PlaySong].getTicks() >=
( length() + 1 ) * ticksPerTact();
}
}
@@ -455,13 +470,13 @@ void Song::playAndRecord()
void Song::playTrack( Track * _trackToPlay )
void Song::playTrack( Track * trackToPlay )
{
if( isStopped() == false )
{
stop();
}
m_trackToPlay = _trackToPlay;
m_trackToPlay = trackToPlay;
m_playMode = Mode_PlayTrack;
m_playing = true;
@@ -498,7 +513,7 @@ void Song::playBB()
void Song::playPattern( const Pattern* patternToPlay, bool _loop )
void Song::playPattern( const Pattern* patternToPlay, bool loop )
{
if( isStopped() == false )
{
@@ -506,7 +521,7 @@ void Song::playPattern( const Pattern* patternToPlay, bool _loop )
}
m_patternToPlay = patternToPlay;
m_loopPattern = _loop;
m_loopPattern = loop;
if( m_patternToPlay != NULL )
{
@@ -544,12 +559,14 @@ void Song::updateLength()
void Song::setPlayPos( tick_t _ticks, PlayModes _play_mode )
void Song::setPlayPos( tick_t ticks, PlayModes playMode )
{
m_elapsedTicks += m_playPos[_play_mode].getTicks() - _ticks;
m_elapsedMilliSeconds += (((( _ticks - m_playPos[_play_mode].getTicks()))*60*1000/48)/getTempo());
m_playPos[_play_mode].setTicks( _ticks );
m_playPos[_play_mode].setCurrentFrame( 0.0f );
m_elapsedTicks += m_playPos[playMode].getTicks() - ticks;
m_elapsedMilliSeconds +=
( ( ( ( ticks - m_playPos[playMode].getTicks() ) ) * 60 * 1000 / 48) /
getTempo() );
m_playPos[playMode].setTicks( ticks );
m_playPos[playMode].setCurrentFrame( 0.0f );
// send a signal if playposition changes during playback
if( isPlaying() )
@@ -609,7 +626,9 @@ void Song::stop()
if( tl->savedPos() >= 0 )
{
m_playPos[m_playMode].setTicks( tl->savedPos().getTicks() );
m_elapsedMilliSeconds = (((tl->savedPos().getTicks())*60*1000/48)/getTempo());
m_elapsedMilliSeconds =
( ( ( tl->savedPos().getTicks() ) * 60 * 1000 / 48 ) /
getTempo() );
tl->savePos( -1 );
}
break;
@@ -714,7 +733,7 @@ void Song::addBBTrack()
void Song::addSampleTrack()
{
(void) Track::create( Track::SampleTrack, this );
( void )Track::create( Track::SampleTrack, this );
}
@@ -722,7 +741,7 @@ void Song::addSampleTrack()
void Song::addAutomationTrack()
{
(void) Track::create( Track::AutomationTrack, this );
( void )Track::create( Track::AutomationTrack, this );
}
@@ -730,7 +749,7 @@ void Song::addAutomationTrack()
bpm_t Song::getTempo()
{
return (bpm_t) m_tempoModel.value();
return ( bpm_t )m_tempoModel.value();
}
@@ -825,24 +844,23 @@ void Song::clearProject()
// create new file
void Song::createNewProject()
{
QString default_template = ConfigManager::inst()->userProjectsDir()
QString defaultTemplate = ConfigManager::inst()->userProjectsDir()
+ "templates/default.mpt";
if( QFile::exists( default_template ) )
if( QFile::exists( defaultTemplate ) )
{
createNewProjectFromTemplate( default_template );
createNewProjectFromTemplate( defaultTemplate );
return;
}
default_template = ConfigManager::inst()->factoryProjectsDir()
defaultTemplate = ConfigManager::inst()->factoryProjectsDir()
+ "templates/default.mpt";
if( QFile::exists( default_template ) )
if( QFile::exists( defaultTemplate ) )
{
createNewProjectFromTemplate( default_template );
createNewProjectFromTemplate( defaultTemplate );
return;
}
@@ -892,9 +910,9 @@ void Song::createNewProject()
void Song::createNewProjectFromTemplate( const QString & _template )
void Song::createNewProjectFromTemplate( const QString & templ )
{
loadProject( _template );
loadProject( templ );
// clear file-name so that user doesn't overwrite template when
// saving...
m_fileName = m_oldFileName = "";
@@ -910,7 +928,7 @@ void Song::createNewProjectFromTemplate( const QString & _template )
// load given song
void Song::loadProject( const QString & _file_name )
void Song::loadProject( const QString & fileName )
{
QDomNode node;
@@ -918,8 +936,8 @@ void Song::loadProject( const QString & _file_name )
Engine::projectJournal()->setJournalling( false );
m_fileName = _file_name;
m_oldFileName = _file_name;
m_fileName = fileName;
m_oldFileName = fileName;
DataFile dataFile( m_fileName );
// if file could not be opened, head-node is null and we create
@@ -1024,7 +1042,7 @@ void Song::loadProject( const QString & _file_name )
Engine::mixer()->unlock();
ConfigManager::inst()->addRecentlyOpenedProject( _file_name );
ConfigManager::inst()->addRecentlyOpenedProject( fileName );
Engine::projectJournal()->setJournalling( true );
@@ -1054,7 +1072,7 @@ void Song::loadProject( const QString & _file_name )
// only save current song as _filename and do nothing else
bool Song::saveProjectFile( const QString & _filename )
bool Song::saveProjectFile( const QString & filename )
{
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeSave );
@@ -1080,7 +1098,7 @@ bool Song::saveProjectFile( const QString & _filename )
saveControllerStates( dataFile, dataFile.content() );
return dataFile.writeFile( _filename );
return dataFile.writeFile( filename );
}
@@ -1158,23 +1176,23 @@ void Song::importProject()
void Song::saveControllerStates( QDomDocument & _doc, QDomElement & _this )
void Song::saveControllerStates( QDomDocument & doc, QDomElement & element )
{
// save settings of controllers
QDomElement controllersNode =_doc.createElement( "controllers" );
_this.appendChild( controllersNode );
QDomElement controllersNode = doc.createElement( "controllers" );
element.appendChild( controllersNode );
for( int i = 0; i < m_controllers.size(); ++i )
{
m_controllers[i]->saveState( _doc, controllersNode );
m_controllers[i]->saveState( doc, controllersNode );
}
}
void Song::restoreControllerStates( const QDomElement & _this )
void Song::restoreControllerStates( const QDomElement & element )
{
QDomNode node = _this.firstChild();
QDomNode node = element.firstChild();
while( !node.isNull() )
{
Controller * c = Controller::create( node.toElement(), this );
@@ -1195,10 +1213,10 @@ void Song::restoreControllerStates( const QDomElement & _this )
void Song::exportProjectTracks()
{
exportProject(true);
exportProject( true );
}
void Song::exportProject(bool multiExport)
void Song::exportProject( bool multiExport )
{
if( isEmpty() )
{
@@ -1211,7 +1229,8 @@ void Song::exportProject(bool multiExport)
}
FileDialog efd( gui->mainWindow() );
if (multiExport)
if ( multiExport )
{
efd.setFileMode( FileDialog::Directory);
efd.setWindowTitle( tr( "Select directory for writing exported tracks..." ) );
@@ -1231,18 +1250,18 @@ void Song::exportProject(bool multiExport)
++idx;
}
efd.setNameFilters( types );
QString base_filename;
QString baseFilename;
if( !m_fileName.isEmpty() )
{
efd.setDirectory( QFileInfo( m_fileName ).absolutePath() );
base_filename = QFileInfo( m_fileName ).completeBaseName();
baseFilename = QFileInfo( m_fileName ).completeBaseName();
}
else
{
efd.setDirectory( ConfigManager::inst()->userProjectsDir() );
base_filename = tr( "untitled" );
baseFilename = tr( "untitled" );
}
efd.selectFile( base_filename + __fileEncodeDevices[0].m_extension );
efd.selectFile( baseFilename + __fileEncodeDevices[0].m_extension );
efd.setWindowTitle( tr( "Select file for project-export..." ) );
}
@@ -1269,8 +1288,8 @@ void Song::exportProject(bool multiExport)
}
}
const QString export_file_name = efd.selectedFiles()[0] + suffix;
ExportProjectDialog epd( export_file_name, gui->mainWindow(), multiExport );
const QString exportFileName = efd.selectedFiles()[0] + suffix;
ExportProjectDialog epd( exportFileName, gui->mainWindow(), multiExport );
epd.exec();
}
}
@@ -1360,11 +1379,11 @@ void Song::setModified()
void Song::addController( Controller * _c )
void Song::addController( Controller * c )
{
if( _c != NULL && !m_controllers.contains( _c ) )
if( c != NULL && m_controllers.contains( c ) == false )
{
m_controllers.append( _c );
m_controllers.append( c );
emit dataChanged();
}
}
@@ -1372,9 +1391,9 @@ void Song::addController( Controller * _c )
void Song::removeController( Controller * _controller )
void Song::removeController( Controller * controller )
{
int index = m_controllers.indexOf( _controller );
int index = m_controllers.indexOf( controller );
if( index != -1 )
{
m_controllers.remove( index );
@@ -1389,6 +1408,7 @@ void Song::removeController( Controller * _controller )
void Song::clearErrors()
{
m_errors->clear();
@@ -1424,3 +1444,7 @@ QString* Song::errorSummary()
return errors;
}

View File

File diff suppressed because it is too large Load Diff

View File

@@ -52,19 +52,19 @@ QPixmap * TimeLineWidget::s_posMarkerPixmap = NULL;
QPixmap * TimeLineWidget::s_loopPointBeginPixmap = NULL;
QPixmap * TimeLineWidget::s_loopPointEndPixmap = NULL;
TimeLineWidget::TimeLineWidget( const int _xoff, const int _yoff, const float _ppt,
Song::playPos & _pos, const MidiTime & _begin,
QWidget * _parent ) :
QWidget( _parent ),
TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppt,
Song::PlayPos & pos, const MidiTime & begin,
QWidget * parent ) :
QWidget( parent ),
m_autoScroll( AutoScrollEnabled ),
m_loopPoints( LoopPointsDisabled ),
m_behaviourAtStop( BackToZero ),
m_changedPosition( true ),
m_xOffset( _xoff ),
m_xOffset( xoff ),
m_posMarkerX( 0 ),
m_ppt( _ppt ),
m_pos( _pos ),
m_begin( _begin ),
m_ppt( ppt ),
m_pos( pos ),
m_begin( begin ),
m_savedPos( -1 ),
m_hint( NULL ),
m_action( NoAction ),
@@ -95,17 +95,17 @@ TimeLineWidget::TimeLineWidget( const int _xoff, const int _yoff, const float _p
}
setAttribute( Qt::WA_OpaquePaintEvent, true );
move( 0, _yoff );
move( 0, yoff );
setFixedHeight( s_timeLinePixmap->height() );
m_xOffset -= s_posMarkerPixmap->width() / 2;
m_pos.m_timeLine = this;
QTimer * update_timer = new QTimer( this );
connect( update_timer, SIGNAL( timeout() ),
QTimer * updateTimer = new QTimer( this );
connect( updateTimer, SIGNAL( timeout() ),
this, SLOT( updatePosition() ) );
update_timer->start( 50 );
updateTimer->start( 50 );
}
@@ -401,7 +401,3 @@ void TimeLineWidget::mouseReleaseEvent( QMouseEvent* event )