Fixed various types to be suffixed with "_t".

This commit ensures that all defined data types in include/lmms_basics.h are
suffxed with "_t" to keep consistency as well as to fix issues on systems
with older STL/libstdc++.
This commit is contained in:
Tobias Doerffel
2009-03-15 16:28:13 +01:00
parent d981b32480
commit 7449c4f731
32 changed files with 154 additions and 150 deletions

View File

@@ -207,17 +207,17 @@ private:
Actions m_action;
tick m_selectStartTick;
tick m_selectedTick;
tick_t m_selectStartTick;
tick_t m_selectedTick;
float m_selectStartLevel;
float m_selectedLevels;
float m_moveStartLevel;
tick m_moveStartTick;
tick_t m_moveStartTick;
int m_moveXOffset;
float m_drawLastLevel;
tick m_drawLastTick;
tick_t m_drawLastTick;
int m_ppt;
int m_y_delta;

View File

@@ -1,7 +1,7 @@
/*
* bb_track_container.h - model-component of BB-Editor
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -46,11 +46,11 @@ public:
inline virtual QString nodeName( void ) const
{
return( "bbtrackcontainer" );
return "bbtrackcontainer";
}
tact lengthOfBB( int _bb );
inline tact lengthOfCurrentBB( void )
tact_t lengthOfBB( int _bb );
inline tact_t lengthOfCurrentBB( void )
{
return lengthOfBB( currentBB() );
}

View File

@@ -85,7 +85,7 @@ protected slots:
protected:
QPointF m_lastPos;
QPointF m_lastDest;
tact m_length;
tact_t m_length;
QGraphicsItemAnimation * m_snapBackAnimation;
static QTimeLine s_snapBackTimeLine;

View File

@@ -1,7 +1,7 @@
/*
* lmms_basics.h - common basics for the whole App
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -40,12 +40,12 @@ typedef unsigned int Uint32;
typedef signed int Sint32;
typedef Uint32 minute;
typedef Sint8 second;
typedef Sint32 tact;
typedef Sint32 tick;
typedef Uint8 volume;
typedef Sint8 panning;
typedef Uint32 minute_t;
typedef Sint8 second_t;
typedef Sint32 tact_t;
typedef Sint32 tick_t;
typedef Uint8 volume_t;
typedef Sint8 panning_t;
typedef float sample_t; // standard sample-type

View File

@@ -120,7 +120,7 @@ class LmmsStyleOptionTCO
bool selected;
bool hovered;
QColor userColor;
tick duration;
tick_t duration;
};

View File

@@ -1,7 +1,7 @@
/*
* midi.h - constants, structs etc. concerning MIDI
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -154,14 +154,14 @@ struct midiEvent
return m_data.m_param[1];
}
inline volume getVolume( void ) const
inline volume_t getVolume( void ) const
{
return (volume)( velocity() * 100 / MidiMaxVelocity );
return (volume_t)( velocity() * 100 / MidiMaxVelocity );
}
inline panning getPanning( void ) const
inline panning_t getPanning( void ) const
{
return (panning) ( PanningLeft +
return (panning_t) ( PanningLeft +
( (float)( midiPanning() - MidiMinPanning ) ) /
( (float)( MidiMaxPanning - MidiMinPanning ) ) *
( (float)( PanningRight - PanningLeft ) ) );

View File

@@ -2,7 +2,7 @@
* midi_time.h - declaration of class midiTime which provides data-type for
* position- and length-variables
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -38,12 +38,12 @@ const int DefaultBeatsPerTact = DefaultTicksPerTact / DefaultStepsPerTact;
class EXPORT midiTime
{
public:
inline midiTime( const tact _tact, const tick _ticks ) :
inline midiTime( const tact_t _tact, const tick_t _ticks ) :
m_ticks( _tact * s_ticksPerTact + _ticks )
{
}
inline midiTime( const tick _ticks = 0 ) :
inline midiTime( const tick_t _ticks = 0 ) :
m_ticks( _ticks )
{
}
@@ -57,15 +57,15 @@ public:
{
if( m_ticks % s_ticksPerTact >= s_ticksPerTact/2 )
{
return( ( getTact() + 1 ) * s_ticksPerTact );
return ( getTact() + 1 ) * s_ticksPerTact;
}
return( getTact() * s_ticksPerTact );
return getTact() * s_ticksPerTact;
}
inline midiTime & operator=( const midiTime & _t )
{
m_ticks = _t.m_ticks;
return( *this );
return *this;
}
inline midiTime & operator+=( const midiTime & _t )
@@ -80,33 +80,33 @@ public:
return *this;
}
inline tact getTact( void ) const
inline tact_t getTact( void ) const
{
return( m_ticks / s_ticksPerTact );
return m_ticks / s_ticksPerTact;
}
inline tact nextFullTact( void ) const
inline tact_t nextFullTact( void ) const
{
if( m_ticks % s_ticksPerTact == 0 )
{
return( m_ticks / s_ticksPerTact );
return m_ticks / s_ticksPerTact;
}
return( m_ticks / s_ticksPerTact + 1 );
return m_ticks / s_ticksPerTact + 1;
}
inline void setTicks( tick _t )
inline void setTicks( tick_t _t )
{
m_ticks = _t;
}
inline tick getTicks( void ) const
inline tick_t getTicks( void ) const
{
return( m_ticks );
return m_ticks;
}
inline operator int( void ) const
{
return( m_ticks );
return m_ticks;
}
// calculate number of frame that are needed this time
@@ -114,39 +114,39 @@ public:
{
if( m_ticks >= 0 )
{
return( static_cast<f_cnt_t>( m_ticks *
_frames_per_tick ) );
return static_cast<f_cnt_t>( m_ticks *
_frames_per_tick );
}
return( 0 );
return 0;
}
static inline midiTime fromFrames( const f_cnt_t _frames,
const float _frames_per_tick )
{
return( midiTime( static_cast<int>( _frames /
_frames_per_tick ) ) );
return midiTime( static_cast<int>( _frames /
_frames_per_tick ) );
}
static tick ticksPerTact( void )
static tick_t ticksPerTact( void )
{
return( s_ticksPerTact );
return s_ticksPerTact;
}
static int stepsPerTact( void )
{
return( ticksPerTact() / DefaultBeatsPerTact );
return ticksPerTact() / DefaultBeatsPerTact;
}
static void setTicksPerTact( tick _tpt )
static void setTicksPerTact( tick_t _tpt )
{
s_ticksPerTact = _tpt;
}
private:
tick m_ticks;
tick_t m_ticks;
static tick s_ticksPerTact;
static tick_t s_ticksPerTact;
} ;

View File

@@ -85,8 +85,8 @@ public:
note( const midiTime & _length = midiTime( 0 ),
const midiTime & _pos = midiTime( 0 ),
int key = DefaultKey,
volume _volume = DefaultVolume,
panning _panning = DefaultPanning,
volume_t _volume = DefaultVolume,
panning_t _panning = DefaultPanning,
detuningHelper * _detuning = NULL );
note( const note & _note );
virtual ~note();
@@ -108,12 +108,12 @@ public:
void setLength( const midiTime & _length );
void setPos( const midiTime & _pos );
void setKey( const int _key );
virtual void setVolume( const volume _volume = DefaultVolume );
void setPanning( const panning _panning = DefaultPanning );
virtual void setVolume( const volume_t _volume = DefaultVolume );
void setPanning( const panning_t _panning = DefaultPanning );
void quantizeLength( const int _q_grid );
void quantizePos( const int _q_grid );
static inline bool lessThan(note * &lhs, note * &rhs)
static inline bool lessThan( note * &lhs, note * &rhs )
{
// function to compare two notes - must be called explictly when
// using qSort
@@ -172,12 +172,12 @@ public:
return m_key;
}
inline volume getVolume( void ) const
inline volume_t getVolume( void ) const
{
return m_volume;
}
inline panning getPanning( void ) const
inline panning_t getPanning( void ) const
{
return m_panning;
}
@@ -232,8 +232,8 @@ private:
bool m_isPlaying;
int m_key;
volume m_volume;
panning m_panning;
volume_t m_volume;
panning_t m_panning;
midiTime m_length;
midiTime m_pos;
detuningHelper * m_detuning;

View File

@@ -55,7 +55,7 @@ public:
const bool _part_of_arp = false );
virtual ~notePlayHandle();
virtual void setVolume( const volume _volume = DefaultVolume );
virtual void setVolume( const volume_t _volume = DefaultVolume );
int getMidiVelocity( void ) const;

View File

@@ -2,7 +2,7 @@
* panning.h - declaration of some types, concerning the
* panning of a note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -32,7 +32,7 @@
#include "panning_constants.h"
#include "midi.h"
inline stereoVolumeVector panningToVolumeVector( panning _p,
inline stereoVolumeVector panningToVolumeVector( panning_t _p,
float _scale = 1.0f )
{
stereoVolumeVector v = { { _scale, _scale } };
@@ -41,7 +41,7 @@ inline stereoVolumeVector panningToVolumeVector( panning _p,
return v;
}
inline Sint16 panningToMidi( panning _p )
inline Sint16 panningToMidi( panning_t _p )
{
return MidiMinPanning +
( (float)( _p - PanningLeft ) ) /

View File

@@ -2,7 +2,7 @@
* panning_constants.h - declaration of some constants, concerning the
* panning of a note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -26,9 +26,9 @@
#ifndef _PANNING_CONSTANTS_H
#define _PANNING_CONSTANTS_H
const panning PanningRight = ( 0 + 100 );
const panning PanningLeft = - PanningRight;
const panning PanningCenter = 0;
const panning DefaultPanning = PanningCenter;
const panning_t PanningRight = ( 0 + 100 );
const panning_t PanningLeft = - PanningRight;
const panning_t PanningCenter = 0;
const panning_t DefaultPanning = PanningCenter;
#endif

View File

@@ -293,8 +293,8 @@ private:
// remember these values to use them
// for the next note that is set
midiTime m_lenOfNewNotes;
volume m_lastNoteVolume;
panning m_lastNotePanning;
volume_t m_lastNoteVolume;
panning_t m_lastNotePanning;
int m_startKey; // first key when drawing
int m_lastKey;

View File

@@ -1,7 +1,7 @@
/*
* song.h - class song - the root of the model-tree
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -42,7 +42,7 @@ class timeLine;
const bpm_t MinTempo = 10;
const bpm_t DefaultTempo = 140;
const bpm_t MaxTempo = 999;
const tick MaxSongLength = 9999 * DefaultTicksPerTact;
const tick_t MaxSongLength = 9999 * DefaultTicksPerTact;
class EXPORT song : public trackContainer
@@ -70,7 +70,7 @@ public:
playPos( const int _abs = 0 ) :
midiTime( _abs ),
m_timeLine( NULL ),
m_timeLineUpdate( TRUE ),
m_timeLineUpdate( true ),
m_currentFrame( 0.0f )
{
}
@@ -80,7 +80,7 @@ public:
}
inline float currentFrame( void ) const
{
return( m_currentFrame );
return m_currentFrame;
}
timeLine * m_timeLine;
bool m_timeLineUpdate;
@@ -97,46 +97,46 @@ public:
inline bool isPaused( void ) const
{
return( m_paused );
return m_paused;
}
inline bool isPlaying( void ) const
{
return( m_playing && m_exporting == FALSE );
return m_playing && m_exporting == false;
}
inline bool isExporting( void ) const
{
return( m_exporting );
return m_exporting;
}
inline bool isRecording( void ) const
{
return( m_recording );
return m_recording;
}
bool realTimeTask( void ) const;
inline bool isExportDone( void ) const
{
return( m_exporting == TRUE &&
m_playPos[Mode_PlaySong].getTact() >= length() + 1 );
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTact() >= length() + 1;
}
inline PlayModes playMode( void ) const
{
return( m_playMode );
return m_playMode;
}
inline playPos & getPlayPos( PlayModes _pm )
{
return( m_playPos[_pm] );
return m_playPos[_pm];
}
void updateLength( void );
tact length( void ) const
tact_t length( void ) const
{
return( m_length );
return m_length;
}
@@ -145,7 +145,7 @@ public:
automationTrack * globalAutomationTrack( void )
{
return( m_globalAutomationTrack );
return m_globalAutomationTrack;
}
// file management
@@ -156,25 +156,25 @@ public:
bool saveProjectAs( const QString & _file_name );
inline const QString & projectFileName( void ) const
{
return( m_fileName );
return m_fileName;
}
inline bool isLoadingProject( void ) const
{
return( m_loadingProject );
return m_loadingProject;
}
inline bool isModified( void ) const
{
return( m_modified );
return m_modified;
}
inline virtual QString nodeName( void ) const
{
return( "song" );
return "song";
}
virtual inline bool fixedTCOs( void ) const
{
return( FALSE );
return false;
}
void addController( controller * _c );
@@ -189,7 +189,7 @@ public:
meterModel & getTimeSigModel( void )
{
return( m_timeSigModel );
return m_timeSigModel;
}
@@ -200,7 +200,7 @@ public slots:
void stop( void );
void playTrack( track * _trackToPlay );
void playBB( void );
void playPattern( pattern * _patternToPlay, bool _loop = TRUE );
void playPattern( pattern * _patternToPlay, bool _loop = true );
void pause( void );
void resumeFromPause( void );
@@ -242,21 +242,21 @@ private:
inline int ticksPerTact( void ) const
{
return( DefaultTicksPerTact *
return DefaultTicksPerTact *
m_timeSigModel.getNumerator() /
m_timeSigModel.getDenominator() );
m_timeSigModel.getDenominator();
}
inline tact currentTact( void ) const
inline tact_t currentTact( void ) const
{
return( m_playPos[m_playMode].getTact() );
return m_playPos[m_playMode].getTact();
}
inline tick currentTick( void ) const
inline tick_t currentTick( void ) const
{
return( m_playPos[m_playMode].getTicks() );
return m_playPos[m_playMode].getTicks();
}
void setPlayPos( tick _ticks, PlayModes _play_mode );
void setPlayPos( tick_t _ticks, PlayModes _play_mode );
void saveControllerStates( QDomDocument & _doc, QDomElement & _this );
void restoreControllerStates( const QDomElement & _this );
@@ -286,7 +286,7 @@ private:
PlayModes m_playMode;
playPos m_playPos[Mode_Count];
tact m_length;
tact_t m_length;
track * m_trackToPlay;
pattern * m_patternToPlay;

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-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -410,7 +410,7 @@ public:
void insertTact( const midiTime & _pos );
void removeTact( const midiTime & _pos );
tact length( void ) const;
tact_t length( void ) const;
inline trackContainer * getTrackContainer( void ) const

View File

@@ -2,7 +2,7 @@
* volume.h - declaration of some constants and types, concerning the volume
* of a note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,9 +30,9 @@
#include "lmms_basics.h"
const volume MinVolume = 0;
const volume MaxVolume = 200;
const volume DefaultVolume = 100;
const volume_t MinVolume = 0;
const volume_t MaxVolume = 200;
const volume_t DefaultVolume = 100;
typedef struct
{

View File

@@ -136,12 +136,12 @@ const automatableModel * automationPattern::firstObject( void ) const
//TODO: Improve this
midiTime automationPattern::length( void ) const
{
tick max_length = 0;
tick_t max_length = 0;
for( timeMap::const_iterator it = m_timeMap.begin();
it != m_timeMap.end(); ++it )
{
max_length = qMax<tick>( max_length, it.key() );
max_length = qMax<tick_t>( max_length, it.key() );
}
return midiTime( qMax( midiTime( max_length ).getTact() + 1, 1 ), 0 );
}

View File

@@ -1,7 +1,7 @@
/*
* bb_track_container.cpp - model-component of BB-Editor
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -93,7 +93,7 @@ void bbTrackContainer::updateAfterTrackAdd( void )
tact bbTrackContainer::lengthOfBB( int _bb )
tact_t bbTrackContainer::lengthOfBB( int _bb )
{
midiTime max_length = midiTime::ticksPerTact();

View File

@@ -3,7 +3,7 @@
/*
* instrument_functions.cpp - models for instrument-function-tab
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -427,7 +427,8 @@ void arpeggiator::processNote( notePlayHandle * _n )
// create new arp-note
note new_note( midiTime( 0 ), midiTime( 0 ),
sub_note_key,
(volume) qRound( _n->getVolume() * vol_level ),
(volume_t)
qRound( _n->getVolume() * vol_level ),
_n->getPanning(), _n->detuning() );
// create sub-note-play-handle, only ptr to note is different

View File

@@ -38,7 +38,7 @@
note::note( const midiTime & _length, const midiTime & _pos,
int _key, volume _volume, panning _panning,
int _key, volume_t _volume, panning_t _panning,
detuningHelper * _detuning ) :
m_selected( false ),
m_oldKey( tLimit( _key, 0, NumKeys ) ),
@@ -134,9 +134,9 @@ void note::setKey( const int _key )
void note::setVolume( const volume _volume )
void note::setVolume( const volume_t _volume )
{
const volume v = tLimit( _volume, MinVolume, MaxVolume );
const volume_t v = tLimit( _volume, MinVolume, MaxVolume );
// addJournalEntry( journalEntry( ChangeVolume, (int) m_volume - v ) );
m_volume = v;
}
@@ -144,9 +144,9 @@ void note::setVolume( const volume _volume )
void note::setPanning( const panning _panning )
void note::setPanning( const panning_t _panning )
{
const panning p = tLimit( _panning, PanningLeft, PanningRight );
const panning_t p = tLimit( _panning, PanningLeft, PanningRight );
// addJournalEntry( journalEntry( ChangePanning, (int) m_panning - p ) );
m_panning = p;
}

View File

@@ -4,7 +4,7 @@
* note_play_handle.cpp - implementation of class notePlayHandle, part of
* rendering engine
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -149,7 +149,7 @@ notePlayHandle::~notePlayHandle()
void notePlayHandle::setVolume( const volume _volume )
void notePlayHandle::setVolume( const volume_t _volume )
{
note::setVolume( _volume );
m_instrumentTrack->processOutEvent( midiEvent( MidiKeyPressure,

View File

@@ -75,7 +75,7 @@ void sampleRecordHandle::play( sampleFrame * /*_working_buffer*/ )
writeBuffer( recbuf, frames );
m_framesRecorded += frames;
midiTime len = (tick)( m_framesRecorded / engine::framesPerTick() );
midiTime len = (tick_t)( m_framesRecorded / engine::framesPerTick() );
if( len > m_minLength )
{
// m_tco->changeLength( len );

View File

@@ -1,7 +1,7 @@
/*
* song.cpp - root of the model-tree
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -62,7 +62,7 @@
#include "timeline.h"
tick midiTime::s_ticksPerTact = DefaultTicksPerTact;
tick_t midiTime::s_ticksPerTact = DefaultTicksPerTact;
@@ -568,7 +568,7 @@ void song::updateLength( void )
for( trackList::const_iterator it = tracks().begin();
it != tracks().end(); ++it )
{
const tact cur = ( *it )->length();
const tact_t cur = ( *it )->length();
if( cur > m_length )
{
m_length = cur;
@@ -580,7 +580,7 @@ void song::updateLength( void )
void song::setPlayPos( tick _ticks, PlayModes _play_mode )
void song::setPlayPos( tick_t _ticks, PlayModes _play_mode )
{
m_playPos[_play_mode].setTicks( _ticks );
m_playPos[_play_mode].setCurrentFrame( 0.0f );

View File

@@ -3,7 +3,7 @@
/*
* timeline.cpp - class timeLine, representing a time-line with position marker
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -238,14 +238,15 @@ void timeLine::paintEvent( QPaintEvent * )
p.setOpacity( 1.0 );
tact tact_num = m_begin.getTact();
tact_t tact_num = m_begin.getTact();
int x = m_xOffset + s_posMarkerPixmap->width() / 2 -
( ( static_cast<Sint32>( m_begin * m_ppt ) /
midiTime::ticksPerTact() ) %
static_cast<int>( m_ppt ) );
QColor adas = engine::getLmmsStyle()->color(LmmsStyle::TimelineForecolor);
p.setPen(adas);
QColor adas = engine::getLmmsStyle()->color(
LmmsStyle::TimelineForecolor );
p.setPen( adas );
for( int i = 0; x + i * m_ppt < width(); ++i )
{
const int cx = x + qRound( i * m_ppt );

View File

@@ -1974,21 +1974,21 @@ void track::removeTact( const midiTime & _pos )
* keeping track of the latest time found in ticks. Then we return
* that in bars by dividing by the number of ticks per bar.
*/
tact track::length( void ) const
tact_t track::length( void ) const
{
// find last end-position
tick last = 0;
tick_t last = 0;
for( tcoVector::const_iterator it = m_trackContentObjects.begin();
it != m_trackContentObjects.end(); ++it )
{
const tick cur = ( *it )->endPosition();
const tick_t cur = ( *it )->endPosition();
if( cur > last )
{
last = cur;
}
}
return( last / midiTime::ticksPerTact() );
return last / midiTime::ticksPerTact();
}

View File

@@ -1897,10 +1897,10 @@ void automationEditor::getSelectedValues( timeMap & _selected_values )
++it )
{
//TODO: Add constant
tick len_ticks = DefaultTicksPerTact / 16;
tick_t len_ticks = DefaultTicksPerTact / 16;
float level = it.value();
tick pos_ticks = it.key();
tick_t pos_ticks = it.key();
if( level >= selLevel_start && level <= selLevel_end &&
pos_ticks >= sel_pos_start &&

View File

@@ -1,7 +1,7 @@
/*
* automation_pattern_view.cpp - implementation of view for automationPattern
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -215,7 +215,7 @@ void automationPatternView::paintEvent( QPaintEvent * )
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < m_pat->length().getTact(); ++t )
for( tact_t t = 1; t < m_pat->length().getTact(); ++t )
{
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(

View File

@@ -370,7 +370,7 @@ void ClassicStyle::drawTrackContentObject( QPainter * _painter,
_painter->fillRect( rc, lingrad );
const float cellW = TrackContainerScene::DEFAULT_CELL_WIDTH;
const tick t = _option->duration;
const tick_t t = _option->duration;
if( _model->length() > midiTime::ticksPerTact() && t > 0 )
{
for( int x = t * cellW; x < rc.width()-2; x += t * cellW )
@@ -429,7 +429,7 @@ void ClassicStyle::drawTrackContentObject( QPainter * _painter,
const float x_base = TCO_BORDER_WIDTH;
p->setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < pat->length().getTact(); ++t )
for( tact_t t = 1; t < pat->length().getTact(); ++t )
{
float x = x_base + static_cast<int>( ppt * t ) - 1;
p->drawLine( x, rc.top() + 0.5, x, rc.top() + 4 );

View File

@@ -966,7 +966,7 @@ void CusisStyle::drawTrackContentObject( QPainter * _painter,
drawPath( &painter, path, col0, colBorder, _option->hovered );
const float cellW = TrackContainerScene::DEFAULT_CELL_WIDTH;
const tick t = _option->duration;
const tick_t t = _option->duration;
if( _model->length() > midiTime::ticksPerTact() && t > 0 )
{

View File

@@ -1997,12 +1997,12 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
const noteVector & notes = m_pattern->notes();
// determine what volume/panning to set note to
volume vol = tLimit<int>( MinVolume +
volume_t vol = tLimit<int>( MinVolume +
( ( (float)noteEditBottom() ) - ( (float)_me->y() ) ) /
( (float)( noteEditBottom() - noteEditTop() ) ) *
( MaxVolume - MinVolume ),
MinVolume, MaxVolume );
panning pan = tLimit<int>( PanningLeft +
panning_t pan = tLimit<int>( PanningLeft +
( (float)( noteEditBottom() - _me->y() ) ) /
( (float)( noteEditBottom() - noteEditTop() ) ) *
( (float)( PanningRight - PanningLeft ) ),

View File

@@ -339,7 +339,7 @@ void songEditor::keyPressEvent( QKeyEvent * _ke )
}
else if( _ke->key() == Qt::Key_Left )
{
tick t = m_s->currentTick() - midiTime::ticksPerTact();
tick_t t = m_s->currentTick() - midiTime::ticksPerTact();
if( t >= 0 )
{
m_s->setPlayPos( t, song::Mode_PlaySong );
@@ -347,7 +347,7 @@ void songEditor::keyPressEvent( QKeyEvent * _ke )
}
else if( _ke->key() == Qt::Key_Right )
{
tick t = m_s->currentTick() + midiTime::ticksPerTact();
tick_t t = m_s->currentTick() + midiTime::ticksPerTact();
if( t < MaxSongLength )
{
m_s->setPlayPos( t, song::Mode_PlaySong );

View File

@@ -3,7 +3,7 @@
/*
* bb_track.cpp - implementation of class bbTrack and bbTCO
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -53,7 +53,7 @@ bbTCO::bbTCO( track * _track, unsigned int _color ) :
trackContentObject( _track ),
m_color( _color > 0 ? _color : qRgb( 64, 128, 255 ) )
{
tact t = engine::getBBTrackContainer()->lengthOfBB(
tact_t t = engine::getBBTrackContainer()->lengthOfBB(
bbTrack::numOfBBTrack( getTrack() ) );
if( t > 0 )
{
@@ -193,7 +193,7 @@ void bbTCOView::paintEvent( QPaintEvent * )
lingrad.setColorAt( 1, col.light( 70 ) );
p.fillRect( rect(), lingrad );
tact t = engine::getBBTrackContainer()->lengthOfBB(
tact_t t = engine::getBBTrackContainer()->lengthOfBB(
bbTrack::numOfBBTrack( m_bbTCO->getTrack() ) );
if( m_bbTCO->length() > midiTime::ticksPerTact() && t > 0 )
{

View File

@@ -139,14 +139,14 @@ midiTime pattern::length( void ) const
return beatPatternLength();
}
tick max_length = midiTime::ticksPerTact();
tick_t max_length = midiTime::ticksPerTact();
for( noteVector::const_iterator it = m_notes.begin();
it != m_notes.end(); ++it )
{
if( ( *it )->length() > 0 )
{
max_length = qMax<tick>( max_length,
max_length = qMax<tick_t>( max_length,
( *it )->endPos() );
}
}
@@ -159,14 +159,15 @@ midiTime pattern::length( void ) const
midiTime pattern::beatPatternLength( void ) const
{
tick max_length = midiTime::ticksPerTact();
tick_t max_length = midiTime::ticksPerTact();
for( noteVector::const_iterator it = m_notes.begin();
it != m_notes.end(); ++it )
{
if( ( *it )->length() < 0 )
{
max_length = qMax<tick>( max_length, ( *it )->pos() +
max_length = qMax<tick_t>( max_length,
( *it )->pos() +
midiTime::ticksPerTact() /
midiTime::stepsPerTact() );
}
@@ -618,7 +619,8 @@ void pattern::changeTimeSignature( void )
++it;
}
}
m_steps = qMax<tick>( qMax<tick>( m_steps, midiTime::stepsPerTact() ),
m_steps = qMax<tick_t>(
qMax<tick_t>( m_steps, midiTime::stepsPerTact() ),
last_pos.getTact() * midiTime::stepsPerTact() );
ensureBeatNotes();
}
@@ -1159,7 +1161,7 @@ void patternView::paintEvent( QPaintEvent * )
const int x_base = TCO_BORDER_WIDTH;
p.setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < m_pat->length().getTact(); ++t )
for( tact_t t = 1; t < m_pat->length().getTact(); ++t )
{
p.drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(