committed by
Lukas W
parent
b8e499d6d8
commit
53e6b645c8
@@ -176,8 +176,8 @@ private:
|
||||
static const int TOP_MARGIN = 16;
|
||||
|
||||
static const int DEFAULT_Y_DELTA = 6;
|
||||
static const int DEFAULT_STEPS_PER_TACT = 16;
|
||||
static const int DEFAULT_PPT = 12 * DEFAULT_STEPS_PER_TACT;
|
||||
static const int DEFAULT_STEPS_PER_BAR = 16;
|
||||
static const int DEFAULT_PPB = 12 * DEFAULT_STEPS_PER_BAR;
|
||||
|
||||
static const int VALUES_WIDTH = 64;
|
||||
|
||||
@@ -230,7 +230,7 @@ private:
|
||||
float m_drawLastLevel;
|
||||
tick_t m_drawLastTick;
|
||||
|
||||
int m_ppt;
|
||||
int m_ppb;
|
||||
int m_y_delta;
|
||||
bool m_y_auto;
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
return "bbtrackcontainer";
|
||||
}
|
||||
|
||||
tact_t lengthOfBB( int _bb ) const;
|
||||
inline tact_t lengthOfCurrentBB()
|
||||
bar_t lengthOfBB( int _bb ) const;
|
||||
inline bar_t lengthOfCurrentBB()
|
||||
{
|
||||
return lengthOfBB( currentBB() );
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
#include "lmms_export.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
// note: 1 "Tact" = 1 Measure
|
||||
const int DefaultTicksPerTact = 192;
|
||||
const int DefaultStepsPerTact = 16;
|
||||
const int DefaultBeatsPerTact = DefaultTicksPerTact / DefaultStepsPerTact;
|
||||
// note: a bar was erroneously called "tact" in older versions of LMMS
|
||||
const int DefaultTicksPerBar = 192;
|
||||
const int DefaultStepsPerBar = 16;
|
||||
const int DefaultBeatsPerBar = DefaultTicksPerBar / DefaultStepsPerBar;
|
||||
|
||||
|
||||
class MeterModel;
|
||||
@@ -60,19 +60,19 @@ private:
|
||||
class LMMS_EXPORT MidiTime
|
||||
{
|
||||
public:
|
||||
MidiTime( const tact_t tact, const tick_t ticks );
|
||||
MidiTime( const bar_t bar, const tick_t ticks );
|
||||
MidiTime( const tick_t ticks = 0 );
|
||||
|
||||
MidiTime quantize(float) const;
|
||||
MidiTime toAbsoluteTact() const;
|
||||
MidiTime toAbsoluteBar() const;
|
||||
|
||||
MidiTime& operator+=( const MidiTime& time );
|
||||
MidiTime& operator-=( const MidiTime& time );
|
||||
|
||||
// return the tact, rounded down and 0-based
|
||||
tact_t getTact() const;
|
||||
// return the tact, rounded up and 0-based
|
||||
tact_t nextFullTact() const;
|
||||
// return the bar, rounded down and 0-based
|
||||
bar_t getBar() const;
|
||||
// return the bar, rounded up and 0-based
|
||||
bar_t nextFullBar() const;
|
||||
|
||||
void setTicks( tick_t ticks );
|
||||
tick_t getTicks() const;
|
||||
@@ -90,21 +90,21 @@ public:
|
||||
// calculate number of frame that are needed this time
|
||||
f_cnt_t frames( const float framesPerTick ) const;
|
||||
|
||||
double getTimeInMilliseconds(bpm_t beatsPerMinute) const;
|
||||
double getTimeInMilliseconds( bpm_t beatsPerMinute ) const;
|
||||
|
||||
static MidiTime fromFrames( const f_cnt_t frames, const float framesPerTick );
|
||||
static tick_t ticksPerTact();
|
||||
static tick_t ticksPerTact( const TimeSig &sig );
|
||||
static int stepsPerTact();
|
||||
static void setTicksPerTact( tick_t tpt );
|
||||
static tick_t ticksPerBar();
|
||||
static tick_t ticksPerBar( const TimeSig &sig );
|
||||
static int stepsPerBar();
|
||||
static void setTicksPerBar( tick_t tpt );
|
||||
static MidiTime stepPosition( int step );
|
||||
static double ticksToMilliseconds(tick_t ticks, bpm_t beatsPerMinute);
|
||||
static double ticksToMilliseconds(double ticks, bpm_t beatsPerMinute);
|
||||
static double ticksToMilliseconds( tick_t ticks, bpm_t beatsPerMinute );
|
||||
static double ticksToMilliseconds( double ticks, bpm_t beatsPerMinute );
|
||||
|
||||
private:
|
||||
tick_t m_ticks;
|
||||
|
||||
static tick_t s_ticksPerTact;
|
||||
static tick_t s_ticksPerBar;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ private:
|
||||
|
||||
int m_oldNotesEditHeight;
|
||||
int m_notesEditHeight;
|
||||
int m_ppt; // pixels per tact
|
||||
int m_ppb; // pixels per bar
|
||||
int m_totalKeysToScroll;
|
||||
|
||||
// remember these values to use them
|
||||
|
||||
@@ -45,7 +45,7 @@ class TimeLineWidget;
|
||||
const bpm_t MinTempo = 10;
|
||||
const bpm_t DefaultTempo = 140;
|
||||
const bpm_t MaxTempo = 999;
|
||||
const tick_t MaxSongLength = 9999 * DefaultTicksPerTact;
|
||||
const tick_t MaxSongLength = 9999 * DefaultTicksPerBar;
|
||||
|
||||
|
||||
class LMMS_EXPORT Song : public TrackContainer
|
||||
@@ -155,14 +155,14 @@ public:
|
||||
m_playPos[playMode].setTicks(ticks);
|
||||
}
|
||||
|
||||
inline int getTacts() const
|
||||
inline int getBars() const
|
||||
{
|
||||
return currentTact();
|
||||
return currentBar();
|
||||
}
|
||||
|
||||
inline int ticksPerTact() const
|
||||
inline int ticksPerBar() const
|
||||
{
|
||||
return MidiTime::ticksPerTact(m_timeSigModel);
|
||||
return MidiTime::ticksPerBar(m_timeSigModel);
|
||||
}
|
||||
|
||||
// Returns the beat position inside the bar, 0-based
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
}
|
||||
|
||||
void updateLength();
|
||||
tact_t length() const
|
||||
bar_t length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
@@ -382,9 +382,9 @@ private:
|
||||
virtual ~Song();
|
||||
|
||||
|
||||
inline tact_t currentTact() const
|
||||
inline bar_t currentBar() const
|
||||
{
|
||||
return m_playPos[m_playMode].getTact();
|
||||
return m_playPos[m_playMode].getBar();
|
||||
}
|
||||
|
||||
inline tick_t currentTick() const
|
||||
@@ -415,7 +415,7 @@ private:
|
||||
|
||||
IntModel m_tempoModel;
|
||||
MeterModel m_timeSigModel;
|
||||
int m_oldTicksPerTact;
|
||||
int m_oldTicksPerBar;
|
||||
IntModel m_masterVolumeModel;
|
||||
IntModel m_masterPitchModel;
|
||||
|
||||
@@ -445,14 +445,14 @@ private:
|
||||
|
||||
PlayModes m_playMode;
|
||||
PlayPos m_playPos[Mode_Count];
|
||||
tact_t m_length;
|
||||
bar_t m_length;
|
||||
|
||||
const Pattern* m_patternToPlay;
|
||||
bool m_loopPattern;
|
||||
|
||||
double m_elapsedMilliSeconds[Mode_Count];
|
||||
tick_t m_elapsedTicks;
|
||||
tact_t m_elapsedTacts;
|
||||
bar_t m_elapsedBars;
|
||||
|
||||
VstSyncController m_vstSyncController;
|
||||
|
||||
@@ -473,9 +473,9 @@ signals:
|
||||
void projectLoaded();
|
||||
void playbackStateChanged();
|
||||
void playbackPositionChanged();
|
||||
void lengthChanged( int tacts );
|
||||
void lengthChanged( int bars );
|
||||
void tempoChanged( bpm_t newBPM );
|
||||
void timeSignatureChanged( int oldTicksPerTact, int ticksPerTact );
|
||||
void timeSignatureChanged( int oldTicksPerBar, int ticksPerBar );
|
||||
void controllerAdded( Controller * );
|
||||
void controllerRemoved( Controller * );
|
||||
void updateSampleTracks();
|
||||
|
||||
@@ -36,14 +36,14 @@ class StepRecorderWidget : public QWidget
|
||||
public:
|
||||
StepRecorderWidget(
|
||||
QWidget * parent,
|
||||
const int ppt,
|
||||
const int ppb,
|
||||
const int marginTop,
|
||||
const int marginBottom,
|
||||
const int marginLeft,
|
||||
const int marginRight);
|
||||
|
||||
//API used by PianoRoll
|
||||
void setPixelsPerTact(int ppt);
|
||||
void setPixelsPerBar(int ppb);
|
||||
void setCurrentPosition(MidiTime currentPosition);
|
||||
void setBottomMargin(const int marginBottom);
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
MidiTime m_curStepStartPos;
|
||||
MidiTime m_curStepEndPos;
|
||||
|
||||
int m_ppt; // pixels per tact
|
||||
int m_ppb; // pixels per bar
|
||||
MidiTime m_currentPosition; // current position showed by on PianoRoll
|
||||
|
||||
QColor m_colorLineStart;
|
||||
|
||||
@@ -72,15 +72,15 @@ public:
|
||||
} ;
|
||||
|
||||
|
||||
TimeLineWidget(int xoff, int yoff, float ppt, Song::PlayPos & pos,
|
||||
TimeLineWidget(int xoff, int yoff, float ppb, Song::PlayPos & pos,
|
||||
const MidiTime & begin, Song::PlayModes mode, QWidget * parent);
|
||||
virtual ~TimeLineWidget();
|
||||
|
||||
inline QColor const & getBarLineColor() const { return m_barLineColor; }
|
||||
inline void setBarLineColor(QColor const & tactLineColor) { m_barLineColor = tactLineColor; }
|
||||
inline void setBarLineColor(QColor const & barLineColor) { m_barLineColor = barLineColor; }
|
||||
|
||||
inline QColor const & getBarNumberColor() const { return m_barNumberColor; }
|
||||
inline void setBarNumberColor(QColor const & tactNumberColor) { m_barNumberColor = tactNumberColor; }
|
||||
inline void setBarNumberColor(QColor const & barNumberColor) { m_barNumberColor = barNumberColor; }
|
||||
|
||||
inline QColor const & getInactiveLoopColor() const { return m_inactiveLoopColor; }
|
||||
inline void setInactiveLoopColor(QColor const & inactiveLoopColor) { m_inactiveLoopColor = inactiveLoopColor; }
|
||||
@@ -135,18 +135,18 @@ public:
|
||||
m_loopPos[0] : m_loopPos[1];
|
||||
}
|
||||
|
||||
inline void savePos( const MidiTime & _pos )
|
||||
inline void savePos( const MidiTime & pos )
|
||||
{
|
||||
m_savedPos = _pos;
|
||||
m_savedPos = pos;
|
||||
}
|
||||
inline const MidiTime & savedPos() const
|
||||
{
|
||||
return m_savedPos;
|
||||
}
|
||||
|
||||
inline void setPixelsPerTact( float _ppt )
|
||||
inline void setPixelsPerBar( float ppb )
|
||||
{
|
||||
m_ppt = _ppt;
|
||||
m_ppb = ppb;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
inline int markerX( const MidiTime & _t ) const
|
||||
{
|
||||
return m_xOffset + static_cast<int>( ( _t - m_begin ) *
|
||||
m_ppt / MidiTime::ticksPerTact() );
|
||||
m_ppb / MidiTime::ticksPerBar() );
|
||||
}
|
||||
|
||||
signals:
|
||||
@@ -214,7 +214,7 @@ private:
|
||||
|
||||
int m_xOffset;
|
||||
int m_posMarkerX;
|
||||
float m_ppt;
|
||||
float m_ppb;
|
||||
Song::PlayPos & m_pos;
|
||||
const MidiTime & m_begin;
|
||||
const Song::PlayModes m_mode;
|
||||
|
||||
@@ -266,7 +266,7 @@ protected:
|
||||
selectableObject::resizeEvent( re );
|
||||
}
|
||||
|
||||
float pixelsPerTact();
|
||||
float pixelsPerBar();
|
||||
|
||||
|
||||
DataFile createTCODataFiles(const QVector<TrackContentObjectView *> & tcos) const;
|
||||
@@ -547,10 +547,10 @@ public:
|
||||
void createTCOsForBB( int bb );
|
||||
|
||||
|
||||
void insertTact( const MidiTime & pos );
|
||||
void removeTact( const MidiTime & pos );
|
||||
void insertBar( const MidiTime & pos );
|
||||
void removeBar( const MidiTime & pos );
|
||||
|
||||
tact_t length() const;
|
||||
bar_t length() const;
|
||||
|
||||
|
||||
inline TrackContainer* trackContainer() const
|
||||
|
||||
@@ -54,25 +54,25 @@ public:
|
||||
|
||||
QScrollArea * contentWidget()
|
||||
{
|
||||
return( m_scrollArea );
|
||||
return m_scrollArea;
|
||||
}
|
||||
|
||||
inline const MidiTime & currentPosition() const
|
||||
{
|
||||
return( m_currentPosition );
|
||||
return m_currentPosition;
|
||||
}
|
||||
|
||||
virtual bool fixedTCOs() const
|
||||
{
|
||||
return( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
inline float pixelsPerTact() const
|
||||
inline float pixelsPerBar() const
|
||||
{
|
||||
return( m_ppt );
|
||||
return m_ppb;
|
||||
}
|
||||
|
||||
void setPixelsPerTact( int _ppt );
|
||||
void setPixelsPerBar( int ppb );
|
||||
|
||||
const TrackView * trackViewAt( const int _y ) const;
|
||||
|
||||
@@ -80,12 +80,12 @@ public:
|
||||
|
||||
inline bool rubberBandActive() const
|
||||
{
|
||||
return( m_rubberBand->isEnabled() && m_rubberBand->isVisible() );
|
||||
return m_rubberBand->isEnabled() && m_rubberBand->isVisible();
|
||||
}
|
||||
|
||||
inline QVector<selectableObject *> selectedObjects()
|
||||
{
|
||||
return( m_rubberBand->selectedObjects() );
|
||||
return m_rubberBand->selectedObjects();
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
|
||||
virtual QString nodeName() const
|
||||
{
|
||||
return( "trackcontainerview" );
|
||||
return "trackcontainerview";
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ public slots:
|
||||
|
||||
|
||||
protected:
|
||||
static const int DEFAULT_PIXELS_PER_TACT = 16;
|
||||
static const int DEFAULT_PIXELS_PER_BAR = 16;
|
||||
|
||||
|
||||
virtual void resizeEvent( QResizeEvent * );
|
||||
@@ -176,7 +176,7 @@ private:
|
||||
scrollArea * m_scrollArea;
|
||||
QVBoxLayout * m_scrollLayout;
|
||||
|
||||
float m_ppt;
|
||||
float m_ppb;
|
||||
|
||||
RubberBand * m_rubberBand;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
typedef int32_t tact_t;
|
||||
typedef int32_t bar_t;
|
||||
typedef int32_t tick_t;
|
||||
typedef uint8_t volume_t;
|
||||
typedef int8_t panning_t;
|
||||
|
||||
Reference in New Issue
Block a user