From ec07aef5ac2496f557c8be8b4d935abe91e046ec Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 15 Mar 2009 16:28:13 +0100 Subject: [PATCH] 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++. (cherry picked from commit 7449c4f73116ac94f2db16a943ebcda0db94ca8f) --- include/automation_editor.h | 8 ++-- include/bb_track_container.h | 8 ++-- include/lmms_basics.h | 14 +++---- include/midi.h | 10 ++--- include/midi_time.h | 52 ++++++++++++------------- include/note.h | 18 ++++----- include/note_play_handle.h | 2 +- include/panning.h | 6 +-- include/panning_constants.h | 10 ++--- include/piano_roll.h | 4 +- include/song.h | 60 ++++++++++++++--------------- include/track.h | 4 +- include/volume.h | 8 ++-- src/core/automation_pattern.cpp | 4 +- src/core/bb_track_container.cpp | 4 +- src/core/instrument_functions.cpp | 5 ++- src/core/note.cpp | 10 ++--- src/core/note_play_handle.cpp | 4 +- src/core/sample_record_handle.cpp | 2 +- src/core/song.cpp | 8 ++-- src/core/timeline.cpp | 2 +- src/core/track.cpp | 8 ++-- src/gui/automation_editor.cpp | 4 +- src/gui/automation_pattern_view.cpp | 4 +- src/gui/piano_roll.cpp | 4 +- src/gui/song_editor.cpp | 4 +- src/tracks/bb_track.cpp | 6 +-- src/tracks/pattern.cpp | 14 ++++--- 28 files changed, 145 insertions(+), 142 deletions(-) diff --git a/include/automation_editor.h b/include/automation_editor.h index 0dbeba78db..c522c6411a 100644 --- a/include/automation_editor.h +++ b/include/automation_editor.h @@ -204,17 +204,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; diff --git a/include/bb_track_container.h b/include/bb_track_container.h index 597aea67af..a698190372 100644 --- a/include/bb_track_container.h +++ b/include/bb_track_container.h @@ -1,7 +1,7 @@ /* * bb_track_container.h - model-component of BB-Editor * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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() ); } diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 0deefee664..8575148ead 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -1,7 +1,7 @@ /* * types.h - typedefs for common types that are used in the whole app * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -42,12 +42,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 diff --git a/include/midi.h b/include/midi.h index adc88dfb28..de67654a65 100644 --- a/include/midi.h +++ b/include/midi.h @@ -1,7 +1,7 @@ /* * midi.h - constants, structs etc. concerning MIDI * - * Copyright (c) 2005-2008 Tobias Doerffel + * Copyright (c) 2005-2009 Tobias Doerffel * * 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 ) ) ); diff --git a/include/midi_time.h b/include/midi_time.h index bb3d2e2091..dfb8a1c907 100644 --- a/include/midi_time.h +++ b/include/midi_time.h @@ -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 + * Copyright (c) 2004-2009 Tobias Doerffel * * 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( m_ticks * - _frames_per_tick ) ); + return static_cast( 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( _frames / - _frames_per_tick ) ) ); + return midiTime( static_cast( _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; } ; diff --git a/include/note.h b/include/note.h index acfe6267e3..746c8450a8 100644 --- a/include/note.h +++ b/include/note.h @@ -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; diff --git a/include/note_play_handle.h b/include/note_play_handle.h index 903e409fd4..ba7ccf6ec9 100644 --- a/include/note_play_handle.h +++ b/include/note_play_handle.h @@ -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; diff --git a/include/panning.h b/include/panning.h index ea656f5626..3548ffc83b 100644 --- a/include/panning.h +++ b/include/panning.h @@ -2,7 +2,7 @@ * panning.h - declaration of some types, concerning the * panning of a note * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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 ) ) / diff --git a/include/panning_constants.h b/include/panning_constants.h index 90fc016730..7bb58c7de0 100644 --- a/include/panning_constants.h +++ b/include/panning_constants.h @@ -2,7 +2,7 @@ * panning_constants.h - declaration of some constants, concerning the * panning of a note * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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 diff --git a/include/piano_roll.h b/include/piano_roll.h index a57735f5d8..98793b51b1 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -291,8 +291,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; diff --git a/include/song.h b/include/song.h index fc8e850429..a27a9f16f1 100644 --- a/include/song.h +++ b/include/song.h @@ -1,7 +1,7 @@ /* * song.h - class song - the root of the model-tree * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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; diff --git a/include/track.h b/include/track.h index 4df4ee2e6d..59216f4394 100644 --- a/include/track.h +++ b/include/track.h @@ -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 + * Copyright (c) 2004-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -409,7 +409,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 diff --git a/include/volume.h b/include/volume.h index f72ca19880..e393dd8f54 100644 --- a/include/volume.h +++ b/include/volume.h @@ -2,7 +2,7 @@ * volume.h - declaration of some constants and types, concerning the volume * of a note * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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 { diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index 78139f1c4d..6040709141 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -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( max_length, it.key() ); + max_length = qMax( max_length, it.key() ); } return midiTime( qMax( midiTime( max_length ).getTact() + 1, 1 ), 0 ); } diff --git a/src/core/bb_track_container.cpp b/src/core/bb_track_container.cpp index 3203d13ac4..6a75f6c70a 100644 --- a/src/core/bb_track_container.cpp +++ b/src/core/bb_track_container.cpp @@ -1,7 +1,7 @@ /* * bb_track_container.cpp - model-component of BB-Editor * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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(); diff --git a/src/core/instrument_functions.cpp b/src/core/instrument_functions.cpp index 07a73ba6a9..f0f879afb6 100644 --- a/src/core/instrument_functions.cpp +++ b/src/core/instrument_functions.cpp @@ -3,7 +3,7 @@ /* * instrument_functions.cpp - models for instrument-function-tab * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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 diff --git a/src/core/note.cpp b/src/core/note.cpp index 5f2f40f908..cf3c6530ae 100644 --- a/src/core/note.cpp +++ b/src/core/note.cpp @@ -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; } diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index 2738dcf573..5996ed4f32 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -4,7 +4,7 @@ * note_play_handle.cpp - implementation of class notePlayHandle, part of * rendering engine * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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, diff --git a/src/core/sample_record_handle.cpp b/src/core/sample_record_handle.cpp index bd17f7aa12..0cb8114f40 100644 --- a/src/core/sample_record_handle.cpp +++ b/src/core/sample_record_handle.cpp @@ -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 ); diff --git a/src/core/song.cpp b/src/core/song.cpp index c415edbe91..6bfa4523bb 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1,7 +1,7 @@ /* * song.cpp - root of the model-tree * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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 ); diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index 6f703e0352..39e3edbe37 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -238,7 +238,7 @@ 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( m_begin * m_ppt ) / midiTime::ticksPerTact() ) % diff --git a/src/core/track.cpp b/src/core/track.cpp index 6afd95fb6d..e5558d933f 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -1996,21 +1996,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(); } diff --git a/src/gui/automation_editor.cpp b/src/gui/automation_editor.cpp index afe484c557..21cca5ae93 100644 --- a/src/gui/automation_editor.cpp +++ b/src/gui/automation_editor.cpp @@ -1903,10 +1903,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 && diff --git a/src/gui/automation_pattern_view.cpp b/src/gui/automation_pattern_view.cpp index 8202230672..fc765b4da3 100644 --- a/src/gui/automation_pattern_view.cpp +++ b/src/gui/automation_pattern_view.cpp @@ -1,7 +1,7 @@ /* * automation_pattern_view.cpp - implementation of view for automationPattern * - * Copyright (c) 2008 Tobias Doerffel + * Copyright (c) 2008-2009 Tobias Doerffel * * 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( ppt * t ) - 1, TCO_BORDER_WIDTH, x_base + static_cast( diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index d5a86293bc..af4f881a9b 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -1989,12 +1989,12 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) const noteVector & notes = m_pattern->notes(); // determine what volume/panning to set note to - volume vol = tLimit( MinVolume + + volume_t vol = tLimit( MinVolume + ( ( (float)noteEditBottom() ) - ( (float)_me->y() ) ) / ( (float)( noteEditBottom() - noteEditTop() ) ) * ( MaxVolume - MinVolume ), MinVolume, MaxVolume ); - panning pan = tLimit( PanningLeft + + panning_t pan = tLimit( PanningLeft + ( (float)( noteEditBottom() - _me->y() ) ) / ( (float)( noteEditBottom() - noteEditTop() ) ) * ( (float)( PanningRight - PanningLeft ) ), diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index 15e15e6e38..5045120c6e 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -471,7 +471,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 ); @@ -479,7 +479,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 ); diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 0761eb2d52..c05fef43fb 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -3,7 +3,7 @@ /* * bb_track.cpp - implementation of class bbTrack and bbTCO * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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 ) { diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index d732e8d21b..1914d19d2f 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -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( max_length, + max_length = qMax( 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( max_length, ( *it )->pos() + + max_length = qMax( max_length, + ( *it )->pos() + midiTime::ticksPerTact() / midiTime::stepsPerTact() ); } @@ -618,7 +619,8 @@ void pattern::changeTimeSignature( void ) ++it; } } - m_steps = qMax( qMax( m_steps, midiTime::stepsPerTact() ), + m_steps = qMax( + qMax( 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( ppt * t ) - 1, TCO_BORDER_WIDTH, x_base + static_cast(