Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "bar" instead of "tact" #4878

Closed
wants to merge 11 commits into from
6 changes: 3 additions & 3 deletions include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ protected slots:
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;

Expand Down Expand Up @@ -230,7 +230,7 @@ protected slots:
float m_drawLastLevel;
tick_t m_drawLastTick;

int m_ppt;
int m_ppb;
int m_y_delta;
bool m_y_auto;

Expand Down
4 changes: 2 additions & 2 deletions include/BBTrackContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class LMMS_EXPORT BBTrackContainer : public TrackContainer
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() );
}
Expand Down
38 changes: 19 additions & 19 deletions include/MidiTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -60,19 +60,19 @@ class LMMS_EXPORT TimeSig
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 toNearestTact() const;
MidiTime toAbsoluteTact() const;
MidiTime toNearestBar() 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;
Expand All @@ -90,21 +90,21 @@ class LMMS_EXPORT MidiTime
// 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;

} ;

Expand Down
2 changes: 1 addition & 1 deletion include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ protected slots:

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
Expand Down
26 changes: 13 additions & 13 deletions include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -144,14 +144,14 @@ class LMMS_EXPORT Song : public TrackContainer
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
Expand Down Expand Up @@ -243,7 +243,7 @@ class LMMS_EXPORT Song : public TrackContainer
}

void updateLength();
tact_t length() const
bar_t length() const
{
return m_length;
}
Expand Down Expand Up @@ -366,9 +366,9 @@ private slots:
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
Expand Down Expand Up @@ -399,7 +399,7 @@ private slots:

IntModel m_tempoModel;
MeterModel m_timeSigModel;
int m_oldTicksPerTact;
int m_oldTicksPerBar;
IntModel m_masterVolumeModel;
IntModel m_masterPitchModel;

Expand All @@ -426,14 +426,14 @@ private slots:

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;

Expand All @@ -454,9 +454,9 @@ private slots:
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();
Expand Down
6 changes: 3 additions & 3 deletions include/StepRecorderWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -68,7 +68,7 @@ class StepRecorderWidget : public QWidget
MidiTime m_curStepStartPos;
MidiTime m_curStepEndPos;

int m_ppt; // pixels per tact
int m_ppb; // pixels per bar
PhysSong marked this conversation as resolved.
Show resolved Hide resolved
MidiTime m_currentPosition; // current position showed by on PianoRoll

QColor m_colorLineStart;
Expand Down
18 changes: 9 additions & 9 deletions include/TimeLineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ class TimeLineWidget : public QWidget, public JournallingObject
} ;


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; }
Expand Down Expand Up @@ -135,18 +135,18 @@ class TimeLineWidget : public QWidget, public JournallingObject
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();
}

Expand All @@ -163,7 +163,7 @@ class TimeLineWidget : public QWidget, public JournallingObject
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:
Expand Down Expand Up @@ -214,7 +214,7 @@ public slots:

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;
Expand Down
8 changes: 4 additions & 4 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public slots:
selectableObject::resizeEvent( re );
}

float pixelsPerTact();
float pixelsPerBar();

inline TrackView * getTrackView()
{
Expand Down Expand Up @@ -540,10 +540,10 @@ class LMMS_EXPORT Track : public Model, public JournallingObject
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
Expand Down
22 changes: 11 additions & 11 deletions include/TrackContainerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,38 @@ class TrackContainerView : public QWidget, public ModelView,

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;

virtual bool allowRubberband() const;

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();
}


Expand Down Expand Up @@ -118,7 +118,7 @@ class TrackContainerView : public QWidget, public ModelView,

virtual QString nodeName() const
{
return( "trackcontainerview" );
return "trackcontainerview";
}


Expand All @@ -144,7 +144,7 @@ public slots:
void stopRubberBand();

protected:
static const int DEFAULT_PIXELS_PER_TACT = 16;
static const int DEFAULT_PIXELS_PER_BAR = 16;

virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
Expand Down Expand Up @@ -183,7 +183,7 @@ public slots:
scrollArea * m_scrollArea;
QVBoxLayout * m_scrollLayout;

float m_ppt;
float m_ppb;

RubberBand * m_rubberBand;
QPoint m_origin;
Expand Down
2 changes: 1 addition & 1 deletion include/lmms_basics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading