diff --git a/ChangeLog b/ChangeLog index 0fa18c756..485c5eef8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,94 @@ +2008-10-02 Tobias Doerffel + + * buildtools/bin2res.cpp: + * include/mmp.h: + * include/knob.h: + * include/effect.h: + * include/templates.h: + * include/track.h: + * include/note.h: + * include/automatable_model.h: + * include/import_filter.h: + * include/mixer.h: + * include/combobox_model.h: + * include/ladspa_manager.h: + * include/instrument.h: + * include/sample_buffer.h: + * include/midi.h: + * include/effect_lib.h: + * include/sample_record_handle.h: + * include/shared_object.h: + * include/plugin.h: + * include/note_play_handle.h: + * include/instrument_sound_shaping.h: + * include/oscillator.h: + * include/tempo_sync_knob.h: + * include/midi_time.h: + * include/remote_plugin.h: + * include/basic_filters.h: + * include/journalling_object.h: + * include/types.h: + * include/dummy_effect.h: + * include/automatable_model_view.h: + * include/inline_automation.h: + * include/audio_device.h: + * include/panning.h: + * include/combobox.h: + * include/ladspa_2_lmms.h: + * src/core/preset_preview_play_handle.cpp: + * src/core/note_play_handle.cpp: + * src/core/song.cpp: + * src/core/serializing_object.cpp: + * src/core/bb_track_container.cpp: + * src/core/remote_plugin.cpp: + * src/core/journalling_object.cpp: + * src/core/automatable_model.cpp: + * src/core/audio/audio_alsa.cpp: + * src/core/audio/audio_sdl.cpp: + * src/core/audio/audio_portaudio.cpp: + * src/core/audio/audio_jack.cpp: + * src/core/main.cpp: + * src/core/instrument_sound_shaping.cpp: + * src/core/effect.cpp: + * src/core/instrument_functions.cpp: + * src/core/controller_connection.cpp: + * src/core/track.cpp: + * src/core/engine.cpp: + * src/core/piano.cpp: + * src/core/timeline.cpp: + * src/core/instrument.cpp: + * src/core/surround_area.cpp: + * src/core/sample_buffer.cpp: + * src/core/oscillator.cpp: + * src/core/automation_pattern.cpp: + * src/core/lfo_controller.cpp: + * src/core/sample_record_handle.cpp: + * src/gui/piano_roll.cpp: + * src/gui/plugin_browser.cpp: + * src/gui/main_window.cpp: + * src/gui/song_editor.cpp: + * src/gui/widgets/kmultitabbar.cpp: + * src/gui/widgets/knob.cpp: + * src/gui/widgets/lcd_spinbox.cpp: + * src/gui/automation_editor.cpp: + * src/tracks/sample_track.cpp: + * src/tracks/bb_track.cpp: + * src/tracks/instrument_track.cpp: + * src/tracks/pattern.cpp: + * plugins/ladspa_effect/tap/CMakeLists.txt: + * plugins/audio_file_processor/audio_file_processor.cpp: + fixed a bunch warnings and remarks issued by Intel Compiler + + * include/fx_mixer.h: + * src/core/fx_mixer.cpp: + * src/core/mixer.cpp: + - use one static jobqueue for not getting problems with cached pointers + - check for job being NULL + - improved performance of master mix + + * CMakeLists.txt: + allow overriding compiler flags + 2008-09-30 Tobias Doerffel * plugins/sid/sid_instrument.h: diff --git a/buildtools/bin2res.cpp b/buildtools/bin2res.cpp index d1cdaf242..54e9483ce 100644 --- a/buildtools/bin2res.cpp +++ b/buildtools/bin2res.cpp @@ -61,7 +61,7 @@ int main( int argc, char * * argv ) stringlist files; for( int i = 1; i < argc; ++i ) { - files.push_back( argv[i] ); + files.push_back( std::string( argv[i] ) ); } for( stringlist::iterator it = files.begin(); it != files.end(); ++it ) { @@ -111,7 +111,8 @@ int main( int argc, char * * argv ) embed * dummy = new embed; dummy->size = 1; dummy->name = "dummy"; - dummy->cname = convertFileNameToCIdentifier( "dummy" ); + dummy->cname = convertFileNameToCIdentifier( + std::string( "dummy" ) ); embedded_data.push_back( dummy ); std::cout << "#include " << std::endl << std::endl; @@ -134,7 +135,7 @@ int main( int argc, char * * argv ) } std::cout << " { 0, 0, 0 }" << std::endl << "};" << std::endl << std::endl - << "const embed::descriptor & " + << "static const embed::descriptor & " "findEmbeddedData( const char * _name )" << std::endl << "{" << std::endl << " for( int i = 0; embed_vec[i].data; " diff --git a/include/audio_device.h b/include/audio_device.h index 0541a90b6..b938a555f 100644 --- a/include/audio_device.h +++ b/include/audio_device.h @@ -121,9 +121,9 @@ public: protected: // subclasses can re-implement this for being used in conjunction with // processNextBuffer() - virtual void writeBuffer( const surroundSampleFrame * _ab, - const fpp_t _frames, - const float _master_gain ) + virtual void writeBuffer( const surroundSampleFrame * /* _buf*/, + const fpp_t /*_frames*/, + const float /*_master_gain*/ ) { } diff --git a/include/automatable_model.h b/include/automatable_model.h index 605698466..9281bbabf 100644 --- a/include/automatable_model.h +++ b/include/automatable_model.h @@ -38,7 +38,7 @@ public: \ inline type getfunc( void ) const \ { \ - return( (type) modelname->value() ); \ + return (type) modelname->value(); \ } \ public slots: \ inline void setfunc( const type _val ) \ @@ -50,12 +50,12 @@ public: \ inline type getfunc( void ) const \ { \ - return( (type) modelname.value() ); \ + return (type) modelname.value(); \ } \ public slots: \ inline void setfunc( const type _val ) \ { \ - modelname.setValue( _val ); \ + modelname.setValue( (float) _val ); \ } @@ -79,7 +79,7 @@ public: const float _max = 0, const float _step = 0, ::model * _parent = NULL, - const QString & _display_name = QString::null, + const QString & _display_name = QString(), bool _default_constructed = FALSE ); virtual ~automatableModel(); @@ -87,7 +87,7 @@ public: static inline float copiedValue( void ) { - return( __copiedValue ); + return __copiedValue; } bool isAutomated( void ) const; @@ -101,32 +101,33 @@ public: void setControllerConnection( controllerConnection * _c ); - template - static inline T minEps( void ) - { - return( 1 ); - } - template static inline T castValue( const float _v ) { - return( static_cast( _v ) ); + return (T)( _v ); } + template + static inline bool castValue( const float _v ) + { + return ( qRound( _v ) != 0 ); + } + + template inline T value( int _frameOffset = 0 ) const { - if( m_controllerConnection != NULL ) + if( unlikely( m_controllerConnection != NULL ) ) { const T v = minValue() + castValue( m_range * m_controllerConnection->currentValue( _frameOffset ) ); - if( m_step == 1 ) + if( typeInfo::isEqual( m_step, 1 ) ) { - return( castValue( roundf( v ) ) ); + return castValue( roundf( (float) v ) ); } - return( v ); + return v; } return castValue( m_value ); @@ -170,7 +171,7 @@ public: inline float range( void ) const { - return( m_range ); + return m_range; } void setRange( const float _min, const float _max, @@ -185,14 +186,14 @@ public: virtual void saveSettings( QDomDocument & _doc, QDomElement & _this, - const QString & _name = "value" ); + const QString & _name = QString( "value" ) ); virtual void loadSettings( const QDomElement & _this, - const QString & _name = "value" ); + const QString & _name = QString( "value" ) ); virtual QString nodeName( void ) const { - return( "automatablemodel" ); + return "automatablemodel"; } void prepareJournalEntryFromOldVal( void ); @@ -204,14 +205,14 @@ public: { switch( m_dataType ) { - case Float: return( QString::number( - castValue( _val ) ) ); - case Integer: return( QString::number( - castValue( _val ) ) ); - case Bool: return( QString::number( - castValue( _val ) ) ); + case Float: return QString::number( + castValue( _val ) ); + case Integer: return QString::number( + castValue( _val ) ); + case Bool: return QString::number( + castValue( _val ) ); } - return( "0" ); + return "0"; } @@ -221,6 +222,7 @@ public slots: virtual void pasteValue( void ); void unlinkControllerConnection( void ); + protected: virtual void redoStep( journalEntry & _je ); virtual void undoStep( journalEntry & _je ); @@ -261,20 +263,23 @@ signals: } ; + + + #define defaultTypedMethods(type) \ inline type value( int _frameOffset = 0 ) const \ { \ - return( automatableModel::value( _frameOffset ) );\ + return automatableModel::value( _frameOffset ); \ } \ \ inline type minValue( void ) const \ { \ - return( automatableModel::minValue() ); \ + return automatableModel::minValue(); \ } \ \ inline type maxValue( void ) const \ { \ - return( automatableModel::maxValue() ); \ + return automatableModel::maxValue(); \ } \ @@ -285,7 +290,7 @@ class floatModel : public automatableModel public: floatModel( float _val = 0, float _min = 0, float _max = 0, float _step = 0, ::model * _parent = NULL, - const QString & _display_name = QString::null, + const QString & _display_name = QString(), bool _default_constructed = FALSE ) : automatableModel( Float, _val, _min, _max, _step, _parent, _display_name, _default_constructed ) @@ -302,7 +307,7 @@ class intModel : public automatableModel public: intModel( int _val = 0, int _min = 0, int _max = 0, ::model * _parent = NULL, - const QString & _display_name = QString::null, + const QString & _display_name = QString(), bool _default_constructed = FALSE ) : automatableModel( Integer, _val, _min, _max, 1, _parent, _display_name, _default_constructed ) @@ -318,7 +323,7 @@ class boolModel : public automatableModel { public: boolModel( const bool _val = FALSE, ::model * _parent = NULL, - const QString & _display_name = QString::null, + const QString & _display_name = QString(), bool _default_constructed = FALSE ) : automatableModel( Bool, _val, FALSE, TRUE, 1, _parent, _display_name, _default_constructed ) diff --git a/include/automatable_model_view.h b/include/automatable_model_view.h index 9138efd67..04311ea3e 100644 --- a/include/automatable_model_view.h +++ b/include/automatable_model_view.h @@ -132,7 +132,7 @@ public: \ { \ return( castModel() ); \ } \ -} ; +} generateTypedModelView(float); diff --git a/include/basic_filters.h b/include/basic_filters.h index eb718922c..779b2a3d8 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -65,8 +65,8 @@ public: inline void setFilterType( const int _idx ) { - m_double_filter = _idx >= SIMPLE_FLT_CNT; - if( !m_double_filter ) + m_doubleFilter = _idx >= SIMPLE_FLT_CNT; + if( !m_doubleFilter ) { m_type = static_cast( _idx ); return; @@ -88,8 +88,8 @@ public: m_b2a0( 0.0f ), m_a1a0( 0.0f ), m_a2a0( 0.0f ), - m_double_filter( FALSE ), - m_sampleRate( _sample_rate ), + m_doubleFilter( false ), + m_sampleRate( (float) _sample_rate ), m_subFilter( NULL ) { clearHistory(); @@ -151,70 +151,6 @@ public: m_y4[_chnl] * ( 1.0f / 6.0f ); break; } -/* case MOOG2: - case DOUBLE_MOOG2: - { - const float x1 = ( _in0 - m_r * - m_oldx[_chnl] ) / MOOG_VOLTAGE; - const float tanh1 = tanhf( x1 ); - const float x2 = m_oldy1[_chnl] / MOOG_VOLTAGE; - const float tanh2 = tanhf( x2 ); - m_y1[_chnl] = m_oldy1[_chnl] + m_p * - ( tanh1 - tanh2 ); - m_oldy1[_chnl] = m_y1[_chnl]; - m_y2[_chnl] = m_oldy2[_chnl] + m_p * - ( tanhf( m_y1[_chnl] / - MOOG_VOLTAGE ) - - tanhf( m_oldy2[_chnl] / - MOOG_VOLTAGE ) ); - m_oldy2[_chnl] = m_y2[_chnl]; - m_y3[_chnl] = m_oldy3[_chnl] + m_p * - ( tanhf( m_y2[_chnl] / - MOOG_VOLTAGE ) - - tanhf( m_oldy3[_chnl] / - MOOG_VOLTAGE ) ); - m_oldy3[_chnl] = m_y3[_chnl]; - m_y4[_chnl] = m_ou1[_chnl] + m_p * - ( tanhf( m_y3[_chnl] / - MOOG_VOLTAGE ) - - tanhf( m_ou1[_chnl] / - MOOG_VOLTAGE ) ); - m_ou1[_chnl] = m_y4[_chnl]; - - m_oldx[_chnl] = ( m_y4[_chnl] + - m_ou2[_chnl] ) * 0.5f; - m_ou2[_chnl] = m_y4[_chnl]; - - // the same code again... - m_y1[_chnl] = m_oldy1[_chnl] + m_p * - ( tanh1 - tanh2 ); - m_oldy1[_chnl] = m_y1[_chnl]; - m_y2[_chnl] = m_oldy2[_chnl] + m_p * - ( tanhf( m_y1[_chnl] / - MOOG_VOLTAGE ) - - tanhf( m_oldy2[_chnl] / - MOOG_VOLTAGE ) ); - m_oldy2[_chnl] = m_y2[_chnl]; - m_y3[_chnl] = m_oldy3[_chnl] + m_p * - ( tanhf( m_y2[_chnl] / - MOOG_VOLTAGE ) - - tanhf( m_oldy3[_chnl] / - MOOG_VOLTAGE ) ); - m_oldy3[_chnl] = m_y3[_chnl]; - m_y4[_chnl] = m_ou1[_chnl] + m_p * - ( tanhf( m_y3[_chnl] / - MOOG_VOLTAGE ) - - tanhf( m_ou1[_chnl] / - MOOG_VOLTAGE ) ); - m_ou1[_chnl] = m_y4[_chnl]; - - m_oldx[_chnl] = ( m_y4[_chnl] + - m_ou2[_chnl] ) * 0.5f; - m_ou2[_chnl] = m_y4[_chnl]; - - out = m_oldx[_chnl]; - break; - }*/ default: // filter @@ -233,7 +169,7 @@ public: break; } - if( m_double_filter ) + if( m_doubleFilter ) { return( m_subFilter->update( out, _chnl ) ); } @@ -244,12 +180,12 @@ public: inline void calcFilterCoeffs( float _freq, float _q - /*, const bool _q_is_bandwidth = FALSE*/ ) + /*, const bool _q_is_bandwidth = false*/ ) { // temp coef vars - _freq = tMax( _freq, 0.01f );// limit freq and q for not getting + _freq = qMax( _freq, 0.01f );// limit freq and q for not getting // bad noise out of the filter... - _q = tMax( _q, minQ() ); + _q = qMax( _q, minQ() ); if( m_type == MOOG ) { @@ -260,7 +196,7 @@ public: m_k = 2.0f * m_p - 1; m_r = _q * powf( M_E, ( 1 - m_p ) * 1.386249f ); - if( m_double_filter ) + if( m_doubleFilter ) { m_subFilter->m_r = m_r; m_subFilter->m_p = m_p; @@ -349,7 +285,7 @@ public: break; } - if( m_double_filter ) + if( m_doubleFilter ) { m_subFilter->m_b0a0 = m_b0a0; m_subFilter->m_b1a0 = m_b1a0; @@ -376,7 +312,7 @@ private: frame m_y1, m_y2, m_y3, m_y4, m_oldx, m_oldy1, m_oldy2, m_oldy3; filterTypes m_type; - bool m_double_filter; + bool m_doubleFilter; float m_sampleRate; basicFilters * m_subFilter; diff --git a/include/combobox.h b/include/combobox.h index 444a0a6a8..85ba3e49f 100644 --- a/include/combobox.h +++ b/include/combobox.h @@ -38,7 +38,7 @@ class comboBox : public QWidget, public intModelView { Q_OBJECT public: - comboBox( QWidget * _parent, const QString & _name = QString::null ); + comboBox( QWidget * _parent, const QString & _name = QString() ); virtual ~comboBox(); comboBoxModel * model( void ) diff --git a/include/combobox_model.h b/include/combobox_model.h index 085510a19..3b644de97 100644 --- a/include/combobox_model.h +++ b/include/combobox_model.h @@ -40,8 +40,8 @@ class comboBoxModel : public intModel Q_OBJECT public: comboBoxModel( ::model * _parent = NULL, - const QString & _display_name = QString::null, - bool _default_constructed = FALSE ) : + const QString & _display_name = QString(), + bool _default_constructed = false ) : intModel( 0, 0, 0, _parent, _display_name, _default_constructed ) { diff --git a/include/dummy_effect.h b/include/dummy_effect.h index 40e6893f0..75dfcddc5 100644 --- a/include/dummy_effect.h +++ b/include/dummy_effect.h @@ -95,12 +95,12 @@ public: inline virtual effectControls * getControls( void ) { - return( &m_controls ); + return &m_controls; } - bool processAudioBuffer( sampleFrame * _buf, const fpp_t _frames ) + bool processAudioBuffer( sampleFrame *, const fpp_t ) { - return( FALSE ); + return false; } diff --git a/include/effect.h b/include/effect.h index 40c6e27a0..7c6d10bc6 100644 --- a/include/effect.h +++ b/include/effect.h @@ -196,7 +196,7 @@ private: void resample( int _i, const sampleFrame * _src_buf, sample_rate_t _src_sr, sampleFrame * _dst_buf, sample_rate_t _dst_sr, - const fpp_t _frames ); + const f_cnt_t _frames ); descriptor::subPluginFeatures::key m_key; diff --git a/include/effect_lib.h b/include/effect_lib.h index 304d40ba2..ae3faceb6 100644 --- a/include/effect_lib.h +++ b/include/effect_lib.h @@ -215,7 +215,7 @@ namespace effectLib template inline SAMPLE saturate( const SAMPLE _x ) { - return( tMin( tMax( -1.0f, _x ), 1.0f ) ); + return( qMin( qMax( -1.0f, _x ), 1.0f ) ); } @@ -228,7 +228,7 @@ namespace effectLib const SAMPLE _ratio, const fastBassBoost & _orig = fastBassBoost() ) : - m_frequency( tMax( _frequency, 10.0 ) ), + m_frequency( qMax( _frequency, 10.0 ) ), m_gain1( 1.0 / ( m_frequency + 1.0 ) ), m_gain2( _gain ), m_ratio( _ratio ), diff --git a/include/import_filter.h b/include/import_filter.h index c02d72871..8f0dbfb5a 100644 --- a/include/import_filter.h +++ b/include/import_filter.h @@ -80,7 +80,7 @@ protected: return( m_file.read( _data, _len ) ); } - inline void ungetChar( int _ch ) + inline void ungetChar( char _ch ) { m_file.ungetChar( _ch ); } diff --git a/include/inline_automation.h b/include/inline_automation.h index 2a208eb81..3f82eaae3 100644 --- a/include/inline_automation.h +++ b/include/inline_automation.h @@ -52,8 +52,10 @@ public: inline bool hasAutomation( void ) const { - return( m_autoPattern != NULL && - m_autoPattern->getTimeMap()[0] != defaultValue() ); + return m_autoPattern != NULL && + !typeInfo::isEqual( + m_autoPattern->getTimeMap()[0], + defaultValue() ); } automationPattern * getAutomationPattern( void ) diff --git a/include/instrument.h b/include/instrument.h index 342fca333..ea73289f0 100644 --- a/include/instrument.h +++ b/include/instrument.h @@ -59,8 +59,8 @@ public: virtual void play( sampleFrame * _working_buffer ); // to be implemented by actual plugin - virtual void playNote( notePlayHandle * _note_to_play, - sampleFrame * _working_buf ) + virtual void playNote( notePlayHandle * /* _note_to_play */, + sampleFrame * /* _working_buf */ ) { } @@ -82,28 +82,28 @@ public: // release virtual f_cnt_t desiredReleaseFrames( void ) const { - return( 0 ); + return 0; } // return false if instrument is not bendable inline virtual bool isBendable( void ) const { - return( true ); + return true; } // return true if instruments reacts to MIDI events passed to // handleMidiEvent() rather than playNote() & Co inline virtual bool isMidiBased( void ) const { - return( false ); + return false; } // sub-classes can re-implement this for receiving all incoming // MIDI-events - inline virtual bool handleMidiEvent( const midiEvent & _me, - const midiTime & _time ) + inline virtual bool handleMidiEvent( const midiEvent &, + const midiTime & ) { - return( false ); + return false; } virtual QString fullDisplayName( void ) const; @@ -123,7 +123,7 @@ public: protected: inline instrumentTrack * getInstrumentTrack( void ) const { - return( m_instrumentTrack ); + return m_instrumentTrack; } // instruments may use this to apply a soft fade out at the end of @@ -131,6 +131,7 @@ protected: // desiredReleaseFrames() frames are left void applyRelease( sampleFrame * buf, const notePlayHandle * _n ); + private: instrumentTrack * m_instrumentTrack; diff --git a/include/instrument_sound_shaping.h b/include/instrument_sound_shaping.h index 873793f4a..2cba120b7 100644 --- a/include/instrument_sound_shaping.h +++ b/include/instrument_sound_shaping.h @@ -54,7 +54,7 @@ public: } ; f_cnt_t envFrames( const bool _only_vol = FALSE ) const; - f_cnt_t releaseFrames( const bool _only_vol = FALSE ) const; + f_cnt_t releaseFrames( void ) const; float volumeLevel( notePlayHandle * _n, const f_cnt_t _frame ); diff --git a/include/journalling_object.h b/include/journalling_object.h index 49d848d1e..0b9aed873 100644 --- a/include/journalling_object.h +++ b/include/journalling_object.h @@ -157,10 +157,10 @@ protected: void addJournalEntry( const journalEntry & _je ); // to be implemented by sub-objects - virtual void undoStep( journalEntry & _je ) + virtual void undoStep( journalEntry & ) { } - virtual void redoStep( journalEntry & _je ) + virtual void redoStep( journalEntry & ) { } diff --git a/include/knob.h b/include/knob.h index 6a085d902..90260fd93 100644 --- a/include/knob.h +++ b/include/knob.h @@ -60,7 +60,7 @@ class EXPORT knob : public QWidget, public floatModelView Q_PROPERTY(QColor outerColor READ outerColor WRITE setOuterColor) mapPropertyFromModel(bool,isVolumeKnob,setVolumeKnob,m_volumeKnob); public: - knob( int _knob_num, QWidget * _parent, const QString & _name = QString::null ); + knob( int _knob_num, QWidget * _parent, const QString & _name = QString() ); virtual ~knob(); // TODO: remove @@ -132,7 +132,7 @@ private: inline float pageSize( void ) const { - return( tMax( ( model()->maxValue() - + return( qMax( ( model()->maxValue() - model()->minValue() ) / 100.0f, modelUntyped()->step() ) ); } diff --git a/include/ladspa_2_lmms.h b/include/ladspa_2_lmms.h index 4ec32604d..2c172b150 100644 --- a/include/ladspa_2_lmms.h +++ b/include/ladspa_2_lmms.h @@ -63,7 +63,7 @@ public: private: ladspa2LMMS( void ); - ~ladspa2LMMS(); + virtual ~ladspa2LMMS(); l_sortable_plugin_t m_instruments; l_sortable_plugin_t m_validEffects; diff --git a/include/ladspa_manager.h b/include/ladspa_manager.h index 404572e1b..ed6449a35 100644 --- a/include/ladspa_manager.h +++ b/include/ladspa_manager.h @@ -85,7 +85,7 @@ class EXPORT ladspaManager public: ladspaManager( void ); - ~ladspaManager(); + virtual ~ladspaManager(); l_sortable_plugin_t getSortedPlugins(); ladspaManagerDescription * getDescription( const ladspa_key_t & diff --git a/include/midi.h b/include/midi.h index dbbc15898..58b8d13c0 100644 --- a/include/midi.h +++ b/include/midi.h @@ -122,27 +122,27 @@ struct midiEvent inline Sint16 key( void ) const { - return( m_data.m_param[0] ); + return m_data.m_param[0]; } inline Sint16 & key( void ) { - return( m_data.m_param[0] ); + return m_data.m_param[0]; } inline Sint16 velocity( void ) const { - return( m_data.m_param[1] ); + return m_data.m_param[1]; } inline Sint16 & velocity( void ) { - return( m_data.m_param[1] ); + return m_data.m_param[1]; } inline volume getVolume( void ) const { - return( velocity() * 100 / MidiMaxVelocity ); + return (volume)( velocity() * 100 / MidiMaxVelocity ); } diff --git a/include/midi_time.h b/include/midi_time.h index 13991139d..0a7762dec 100644 --- a/include/midi_time.h +++ b/include/midi_time.h @@ -70,14 +70,14 @@ public: inline midiTime & operator+=( const midiTime & _t ) { - return( *this = static_cast( *this ) + - static_cast( _t ) ); + m_ticks += _t.m_ticks; + return *this; } inline midiTime & operator-=( const midiTime & _t ) { - return( *this = static_cast( *this ) - - static_cast( _t ) ); + m_ticks -= _t.m_ticks; + return *this; } inline tact getTact( void ) const diff --git a/include/mixer.h b/include/mixer.h index 47997394e..3828787e4 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -57,10 +57,10 @@ class audioPort; const fpp_t DEFAULT_BUFFER_SIZE = 256; -const Uint8 BYTES_PER_SAMPLE = sizeof( sample_t ); -const Uint8 BYTES_PER_INT_SAMPLE = sizeof( int_sample_t ); -const Uint8 BYTES_PER_FRAME = sizeof( sampleFrame ); -const Uint8 BYTES_PER_SURROUND_FRAME = sizeof( surroundSampleFrame ); +const int BYTES_PER_SAMPLE = sizeof( sample_t ); +const int BYTES_PER_INT_SAMPLE = sizeof( int_sample_t ); +const int BYTES_PER_FRAME = sizeof( sampleFrame ); +const int BYTES_PER_SURROUND_FRAME = sizeof( surroundSampleFrame ); const float OUTPUT_SAMPLE_MULTIPLIER = 32767.0f; @@ -270,9 +270,9 @@ public: } - inline Uint8 cpuLoad( void ) const + inline int cpuLoad( void ) const { - return( m_cpuLoad ); + return m_cpuLoad; } const qualitySettings & currentQualitySettings( void ) const @@ -387,7 +387,7 @@ public: return m_inputBuffer[ m_inputBufferRead ]; } - inline const f_cnt_t inputBufferFrames( void ) + inline f_cnt_t inputBufferFrames( void ) const { return m_inputBufferFrames[ m_inputBufferRead ]; } @@ -458,10 +458,10 @@ private: surroundSampleFrame * m_writeBuf; QVector m_bufferPool; - Uint8 m_readBuffer; - Uint8 m_writeBuffer; - Uint8 m_analBuffer; - Uint8 m_poolDepth; + int m_readBuffer; + int m_writeBuffer; + int m_analBuffer; + int m_poolDepth; surroundSampleFrame m_maxClip; surroundSampleFrame m_previousSample; @@ -469,7 +469,7 @@ private: bool m_oldBuffer[SURROUND_CHANNELS]; bool m_newBuffer[SURROUND_CHANNELS]; - Uint8 m_cpuLoad; + int m_cpuLoad; bool m_multiThreaded; QVector m_workers; int m_numWorkers; diff --git a/include/mmp.h b/include/mmp.h index 5e717e7b4..1a3ffad89 100644 --- a/include/mmp.h +++ b/include/mmp.h @@ -56,7 +56,7 @@ public: bool _is_filename = TRUE, bool _upgrade = TRUE ); multimediaProject( ProjectTypes _project_type ); - ~multimediaProject(); + virtual ~multimediaProject(); QString nameWithExtension( const QString & _fn ) const; diff --git a/include/note.h b/include/note.h index e40910792..5cbd287db 100644 --- a/include/note.h +++ b/include/note.h @@ -82,8 +82,8 @@ const float MaxDetuning = 4 * 12.0f; class EXPORT note : public serializingObject { public: - note( const midiTime & _length = 0, - const midiTime & _pos = 0, + note( const midiTime & _length = midiTime( 0 ), + const midiTime & _pos = midiTime( 0 ), int key = DefaultKey, volume _volume = DefaultVolume, panning _panning = DefaultPanning, @@ -101,7 +101,8 @@ public: inline midiTime endPos( void ) const { - return( m_pos + m_length); + const int l = length(); + return pos() + l; } inline const midiTime & length( void ) const @@ -116,7 +117,8 @@ public: inline midiTime pos( midiTime _base_pos ) const { - return( m_pos - _base_pos ); + const int bp = _base_pos; + return m_pos - bp; } inline int key( void ) const diff --git a/include/note_play_handle.h b/include/note_play_handle.h index 29abb9cd1..903e409fd 100644 --- a/include/note_play_handle.h +++ b/include/note_play_handle.h @@ -130,9 +130,9 @@ public: f_cnt_t framesLeft( void ) const; - inline f_cnt_t framesLeftForCurrentPeriod( void ) const + inline fpp_t framesLeftForCurrentPeriod( void ) const { - return( tMin( framesLeft(), + return( (fpp_t) qMin( framesLeft(), engine::getMixer()->framesPerPeriod() ) ); } @@ -239,7 +239,7 @@ public: void processMidiTime( const midiTime & _time ); void resize( const bpm_t _new_tempo ); -#if LMMS_SINGERBOT_SUPPORT +#ifdef LMMS_SINGERBOT_SUPPORT int patternIndex( void ) { return( m_patternIndex ); @@ -297,7 +297,7 @@ private: // sub-note) bool m_muted; // indicates whether note is muted track * m_bbTrack; // related BB track -#if LMMS_SINGERBOT_SUPPORT +#ifdef LMMS_SINGERBOT_SUPPORT int m_patternIndex; // position among relevant notes #endif diff --git a/include/oscillator.h b/include/oscillator.h index 9901514aa..39af3adb2 100644 --- a/include/oscillator.h +++ b/include/oscillator.h @@ -65,7 +65,7 @@ public: SignalMix, SynchronizedBySubOsc, FrequencyModulation, - NumModulationAlgos, + NumModulationAlgos } ; diff --git a/include/panning.h b/include/panning.h index 81b8f15e3..e3a3e405a 100644 --- a/include/panning.h +++ b/include/panning.h @@ -39,8 +39,9 @@ inline stereoVolumeVector panningToVolumeVector( panning _p, float _scale = 1.0f ) { stereoVolumeVector v = { { _scale, _scale } }; - v.vol[_p >= PanningCenter ? 0 : 1] *= 1.0f - tAbs( _p / 100.0f ); - return( v ); + const float pf = _p / 100.0f; + v.vol[_p >= PanningCenter ? 0 : 1] *= 1.0f - qAbs( pf ); + return v; } #endif diff --git a/include/plugin.h b/include/plugin.h index 88efdebd8..83af04cd7 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -77,7 +77,8 @@ public: inline bool supportsFileType( const QString & _ext ) const { return( QString( supportedFileTypes ). - split( ',' ).contains( _ext ) ); + split( QChar( ',' ) ). + contains( _ext ) ); } class EXPORT subPluginFeatures { @@ -87,7 +88,7 @@ public: typedef QMap attributeMap; inline key( plugin::descriptor * _desc = NULL, - const QString & _name = QString::null, + const QString & _name = QString(), const attributeMap & _am = attributeMap() ) : @@ -151,9 +152,9 @@ public: // returns display-name out of descriptor virtual QString displayName( void ) const { - return( model::displayName() != QString::null ? - model::displayName() : - m_descriptor->displayName ); + return( model::displayName().isNull() ? + m_descriptor->displayName : + model::displayName() ); } // return plugin-type diff --git a/include/remote_plugin.h b/include/remote_plugin.h index 6b270b5cc..3bfad533d 100755 --- a/include/remote_plugin.h +++ b/include/remote_plugin.h @@ -237,7 +237,7 @@ public: // do we act as master (i.e. not as remote-process?) inline bool isMaster( void ) const { - return( m_master ); + return m_master; } // recursive lock @@ -294,7 +294,7 @@ public: { int32_t i; read( &i, sizeof( i ) ); - return( i ); + return i; } inline void writeInt( const int32_t & _i ) @@ -312,7 +312,7 @@ public: sc[len] = 0; std::string s( sc ); delete[] sc; - return( s ); + return s; } return std::string(); } @@ -332,18 +332,18 @@ public: lock(); const bool empty = ( m_data->startPtr == m_data->endPtr ); unlock(); - return( !empty ); + return !empty; #else int v; sem_getvalue( m_messageSem, &v ); - return( v > 0 ); + return v > 0; #endif } inline int shmKey( void ) const { - return( m_shmKey ); + return m_shmKey; } @@ -484,7 +484,7 @@ public: inline message & addString( const std::string & _s ) { data.push_back( _s ); - return( *this ); + return *this; } message & addInt( int _i ) @@ -493,7 +493,7 @@ public: buf[0] = 0; sprintf( buf, "%d", _i ); data.push_back( std::string( buf ) ); - return( *this ); + return *this; } message & addFloat( float _f ) @@ -502,29 +502,29 @@ public: buf[0] = 0; sprintf( buf, "%f", _f ); data.push_back( std::string( buf ) ); - return( *this ); + return *this; } inline std::string getString( int _p = 0 ) const { - return( data[_p] ); + return data[_p]; } #ifndef BUILD_REMOTE_PLUGIN_CLIENT inline QString getQString( int _p = 0 ) const { - return( QString::fromStdString( getString( _p ) ) ); + return QString::fromStdString( getString( _p ) ); } #endif inline int getInt( int _p = 0 ) const { - return( atoi( data[_p].c_str() ) ); + return atoi( data[_p].c_str() ); } inline float getFloat( int _p ) const { - return( atof( data[_p].c_str() ) ); + return (float) atof( data[_p].c_str() ); } inline bool operator==( const message & _m ) const @@ -549,7 +549,7 @@ public: inline bool messagesLeft( void ) { - return( m_in->messagesLeft() ); + return m_in->messagesLeft(); } @@ -577,12 +577,12 @@ public: protected: const shmFifo * in( void ) const { - return( m_in ); + return m_in; } const shmFifo * out( void ) const { - return( m_out ); + return m_out; } @@ -637,7 +637,7 @@ public: inline bool failed( void ) const { - return( m_failed ); + return m_failed; } @@ -705,7 +705,7 @@ public: inline float * sharedMemory( void ) { - return( m_shm ); + return m_shm; } virtual void updateSampleRate( void ) @@ -718,12 +718,12 @@ public: inline sample_rate_t sampleRate( void ) const { - return( m_sampleRate ); + return m_sampleRate; } inline fpp_t bufferSize( void ) const { - return( m_bufferSize ); + return m_bufferSize; } void setInputCount( int _i ) @@ -740,12 +740,12 @@ public: virtual int inputCount( void ) const { - return( m_inputCount ); + return m_inputCount; } virtual int outputCount( void ) const { - return( m_outputCount ); + return m_outputCount; } @@ -832,7 +832,7 @@ remotePluginBase::message remotePluginBase::receiveMessage( void ) m.data.push_back( m_in->readString() ); } m_in->unlock(); - return( m ); + return m; } @@ -856,11 +856,11 @@ remotePluginBase::message remotePluginBase::waitForMessage( processMessage( m ); if( m.id == _wm.id ) { - return( m ); + return m; } else if( m.id == IdGeneralFailure ) { - return( m ); + return m; } } } @@ -913,7 +913,7 @@ bool remotePluginClient::processMessage( const message & _m ) switch( _m.id ) { case IdGeneralFailure: - return( false ); + return false; case IdSampleRateInformation: m_sampleRate = _m.getInt(); @@ -926,7 +926,7 @@ bool remotePluginClient::processMessage( const message & _m ) break; case IdQuit: - return( false ); + return false; case IdMidiEvent: processMidiEvent( @@ -962,7 +962,7 @@ bool remotePluginClient::processMessage( const message & _m ) sendMessage( reply_message ); } - return( true ); + return true; } diff --git a/include/sample_buffer.h b/include/sample_buffer.h index 8218459bc..88971bd19 100644 --- a/include/sample_buffer.h +++ b/include/sample_buffer.h @@ -66,7 +66,7 @@ public: // constructor which either loads sample _audio_file or decodes // base64-data out of string - sampleBuffer( const QString & _audio_file = "", + sampleBuffer( const QString & _audio_file = QString(), bool _is_base64_data = FALSE ); sampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ); sampleBuffer( const f_cnt_t _frames ); diff --git a/include/sample_record_handle.h b/include/sample_record_handle.h index 3cf07d09b..4bf40580e 100644 --- a/include/sample_record_handle.h +++ b/include/sample_record_handle.h @@ -56,9 +56,9 @@ public: private: virtual void writeBuffer( const sampleFrame * _ab, - const fpp_t _frames ); + const f_cnt_t _frames ); - typedef QList > bufferList; + typedef QList > bufferList; bufferList m_buffers; f_cnt_t m_framesRecorded; midiTime m_minLength; diff --git a/include/shared_object.h b/include/shared_object.h index 399373296..095442baa 100644 --- a/include/shared_object.h +++ b/include/shared_object.h @@ -40,6 +40,10 @@ public: { } + virtual ~sharedObject() + { + } + template static T * ref( T * _object ) { diff --git a/include/templates.h b/include/templates.h index 187d68c9b..3c6a917f4 100644 --- a/include/templates.h +++ b/include/templates.h @@ -1,7 +1,7 @@ /* * templates.h - miscellanous templates and algorithms * - * Copyright (c) 2004-2007 Tobias Doerffel + * Copyright (c) 2004-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -30,46 +30,9 @@ template -inline T tAbs( const T & x ) +inline T tLimit( const T x, const T x1, const T x2 ) { - return( x < static_cast( 0 ) ? -x : x ); -} - - - - -template -inline T tMin( const T & x1, const T & x2 ) -{ - if( x1 < x2 ) - { - return( x1 ); - } - return( x2 ); -} - - - - -template -inline T tMax( const T & x1, const T & x2 ) -{ - if( x1 > x2 ) - { - return( x1 ); - } - return( x2 ); -} - - - - -template -inline T tLimit( const T & x, const T & x1, const T & x2 ) -{ - return( tMin( tMax( x, tMin( x1, x2 ) ), - tMax( x1, x2 ) ) ); - + return qBound( x1, x, x2 ); } diff --git a/include/tempo_sync_knob.h b/include/tempo_sync_knob.h index 98f9928e6..77c3187e6 100644 --- a/include/tempo_sync_knob.h +++ b/include/tempo_sync_knob.h @@ -59,7 +59,7 @@ public: tempoSyncKnobModel( const float _val, const float _min, const float _max, const float _step, const float _scale, ::model * _parent, - const QString & _display_name = QString::null ); + const QString & _display_name = QString() ); virtual ~tempoSyncKnobModel(); virtual void saveSettings( QDomDocument & _doc, @@ -112,7 +112,7 @@ class EXPORT tempoSyncKnob : public knob Q_OBJECT public: tempoSyncKnob( int _knob_num, QWidget * _parent, - const QString & _name = QString::null ); + const QString & _name = QString() ); virtual ~tempoSyncKnob(); const QString & getSyncDescription( void ); diff --git a/include/track.h b/include/track.h index 72e1bcb93..9d9c34ac5 100644 --- a/include/track.h +++ b/include/track.h @@ -97,7 +97,8 @@ public: inline midiTime endPosition( void ) const { - return( m_startPosition + m_length ); + const int sp = m_startPosition; + return sp + m_length; } inline const midiTime & length( void ) const @@ -247,7 +248,7 @@ public: public slots: void update( void ); - void changePosition( const midiTime & _new_pos = -1 ); + void changePosition( const midiTime & _new_pos = midiTime( -1 ) ); protected: diff --git a/include/types.h b/include/types.h index c0f3e6d73..2a2780f75 100644 --- a/include/types.h +++ b/include/types.h @@ -27,6 +27,7 @@ #define _TYPES_H #include + #include "lmmsconfig.h" typedef unsigned char Uint8; @@ -61,23 +62,53 @@ typedef Uint32 jo_id_t; // (unique) ID of a journalling object template -struct valueRanges +struct typeInfo { static inline T min( void ) { - return( std::numeric_limits::min() ); + return std::numeric_limits::min(); } static inline T max( void ) { - return( std::numeric_limits::max() ); + return std::numeric_limits::max(); + } + + static inline T minEps( void ) + { + return 1; + } + + static inline bool isEqual( T _x, T _y ) + { + return _x == _y; + } + + static inline T absVal( T t ) + { + return t >= 0 ? t : -t; } } ; +template<> +inline float typeInfo::minEps( void ) +{ + return 1.0e-10; +} + +template<> +inline bool typeInfo::isEqual( float _x, float _y ) +{ + return absVal( _x - _y ) < minEps(); +} + + + const ch_cnt_t DEFAULT_CHANNELS = 2; const ch_cnt_t SURROUND_CHANNELS = +#define LMMS_DISABLE_SURROUND #ifndef LMMS_DISABLE_SURROUND 4; #else @@ -90,4 +121,8 @@ typedef sample_t sampleFrame[DEFAULT_CHANNELS]; typedef sample_t surroundSampleFrame[SURROUND_CHANNELS]; +// use for improved branch prediction +#define likely(x) __builtin_expect((x),1) +#define unlikely(x) __builtin_expect((x),0) + #endif diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index b58d8ee33..8df817333 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -255,8 +255,8 @@ void audioFileProcessor::loopPointChanged( void ) ( m_sampleBuffer.frames()-1 ) ); const f_cnt_t f2 = static_cast( m_endPointModel.value() * ( m_sampleBuffer.frames()-1 ) ); - m_sampleBuffer.setStartFrame( tMin( f1, f2 ) ); - m_sampleBuffer.setEndFrame( tMax( f1, f2 ) ); + m_sampleBuffer.setStartFrame( qMin( f1, f2 ) ); + m_sampleBuffer.setEndFrame( qMax( f1, f2 ) ); emit dataChanged(); } @@ -473,7 +473,7 @@ void audioFileProcessorView::paintEvent( QPaintEvent * ) p.setPen( QColor( 0xFF, 0xAA, 0x00 ) ); const QRect graph_rect( 4, 174, 241, 70 ); - const f_cnt_t frames = tMax( a->m_sampleBuffer.frames(), + const f_cnt_t frames = qMax( a->m_sampleBuffer.frames(), static_cast( 1 ) ); const int start_frame_x = a->m_sampleBuffer.startFrame() * graph_rect.width() / frames; diff --git a/plugins/ladspa_effect/tap/CMakeLists.txt b/plugins/ladspa_effect/tap/CMakeLists.txt index 588b251e6..aa054ff1e 100644 --- a/plugins/ladspa_effect/tap/CMakeLists.txt +++ b/plugins/ladspa_effect/tap/CMakeLists.txt @@ -1,6 +1,6 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") FILE(GLOB PLUGIN_SOURCES *.c) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-write-strings -Wall -fomit-frame-pointer -fno-strict-aliasing -fstrength-reduce -funroll-loops -ffast-math") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-write-strings -fomit-frame-pointer -fno-strict-aliasing -fstrength-reduce -funroll-loops -ffast-math") FOREACH(_item ${PLUGIN_SOURCES}) GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE) ADD_LIBRARY(${_plugin} MODULE ${_item}) diff --git a/src/core/audio/audio_alsa.cpp b/src/core/audio/audio_alsa.cpp index 823184782..52d311189 100644 --- a/src/core/audio/audio_alsa.cpp +++ b/src/core/audio/audio_alsa.cpp @@ -264,7 +264,7 @@ void audioALSA::run( void ) outbuf, m_convertEndian ); } - int min_len = tMin( len, outbuf_size - outbuf_pos ); + int min_len = qMin( len, outbuf_size - outbuf_pos ); memcpy( ptr, outbuf + outbuf_pos, min_len * sizeof( int_sample_t ) ); ptr += min_len; diff --git a/src/core/audio/audio_jack.cpp b/src/core/audio/audio_jack.cpp index d73a8d6d2..f668dcc66 100644 --- a/src/core/audio/audio_jack.cpp +++ b/src/core/audio/audio_jack.cpp @@ -334,7 +334,7 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata ) } #ifdef AUDIO_PORT_SUPPORT - const Uint32 frames = tMin( _nframes, + const Uint32 frames = qMin( _nframes, _this->getMixer()->framesPerPeriod() ); for( jackPortMap::iterator it = _this->m_portMap.begin(); it != _this->m_portMap.end(); ++it ) @@ -360,7 +360,7 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata ) jack_nframes_t done = 0; while( done < _nframes && _this->m_stopped == FALSE ) { - jack_nframes_t todo = tMin( + jack_nframes_t todo = qMin( _nframes, _this->m_framesToDoInCurBuf - _this->m_framesDoneInCurBuf ); diff --git a/src/core/audio/audio_portaudio.cpp b/src/core/audio/audio_portaudio.cpp index b979a8ce9..6276e0cea 100644 --- a/src/core/audio/audio_portaudio.cpp +++ b/src/core/audio/audio_portaudio.cpp @@ -321,7 +321,7 @@ int audioPortAudio::process_callback( } m_outBufSize = frames; } - const int min_len = tMin( (int)_framesPerBuffer, + const int min_len = qMin( (int)_framesPerBuffer, m_outBufSize - m_outBufPos ); float master_gain = getMixer()->masterGain(); @@ -487,12 +487,12 @@ audioPortAudio::setupWidget::setupWidget( QWidget * _parent ) : const QString& device = configManager::inst()->value( "audioportaudio", "device" ); - int i = tMax( 0, m_setupUtil.m_backendModel.findText( backend ) ); + int i = qMax( 0, m_setupUtil.m_backendModel.findText( backend ) ); m_setupUtil.m_backendModel.setValue( i ); m_setupUtil.updateDevices(); - i = tMax( 0, m_setupUtil.m_deviceModel.findText( device ) ); + i = qMax( 0, m_setupUtil.m_deviceModel.findText( device ) ); m_setupUtil.m_deviceModel.setValue( i ); connect( &m_setupUtil.m_backendModel, SIGNAL( dataChanged() ), diff --git a/src/core/audio/audio_sdl.cpp b/src/core/audio/audio_sdl.cpp index c372d1dfe..af7935d49 100644 --- a/src/core/audio/audio_sdl.cpp +++ b/src/core/audio/audio_sdl.cpp @@ -198,7 +198,7 @@ void audioSDL::sdlAudioCallback( Uint8 * _buf, int _len ) (int_sample_t *)m_convertedBuf, m_convertEndian ); } - const int min_len = tMin( _len, m_convertedBufSize + const int min_len = qMin( _len, m_convertedBufSize - m_convertedBufPos ); memcpy( _buf, m_convertedBuf + m_convertedBufPos, min_len ); _buf += min_len; diff --git a/src/core/automatable_model.cpp b/src/core/automatable_model.cpp index 8212788e2..e8959c23c 100644 --- a/src/core/automatable_model.cpp +++ b/src/core/automatable_model.cpp @@ -35,14 +35,6 @@ float automatableModel::__copiedValue = 0; -template<> -inline float automatableModel::minEps( void ) -{ - return( 1.0e-10 ); -} - - - automatableModel::automatableModel( DataType _type, const float _val, @@ -292,19 +284,20 @@ float automatableModel::fittedValue( float _value ) const } // correct rounding error at the border - if( tAbs( _value - m_maxValue ) < - minEps() * tAbs( m_step ) ) + if( qAbs( _value - m_maxValue ) < + typeInfo::minEps() * qAbs( m_step ) ) { _value = m_maxValue; } // correct rounding error if value = 0 - if( tAbs( _value ) < minEps() * tAbs( m_step ) ) + if( qAbs( _value ) < typeInfo::minEps() * + qAbs( m_step ) ) { _value = 0; } - return( _value ); + return _value; } @@ -314,7 +307,7 @@ float automatableModel::fittedValue( float _value ) const void automatableModel::redoStep( journalEntry & _je ) { bool journalling = testAndSetJournalling( FALSE ); - setValue( value() + _je.data().toDouble() ); + setValue( value() + (float) _je.data().toDouble() ); setJournalling( journalling ); } diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index 06dd91a1a..9ca92f9a1 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -146,9 +146,9 @@ midiTime automationPattern::length( void ) const for( timeMap::const_iterator it = m_timeMap.begin(); it != m_timeMap.end(); ++it ) { - max_length = tMax( max_length, it.key() ); + max_length = qMax( max_length, it.key() ); } - return( midiTime( tMax( midiTime( max_length ).getTact() + 1, 1 ), + return( midiTime( qMax( midiTime( max_length ).getTact() + 1, 1 ), 0 ) ); } @@ -718,7 +718,7 @@ void automationPatternView::paintEvent( QPaintEvent * ) } else { - x2 = width() - TCO_BORDER_WIDTH; + x2 = (float)( width() - TCO_BORDER_WIDTH ); } p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ), lin2grad ); diff --git a/src/core/bb_track_container.cpp b/src/core/bb_track_container.cpp index 110b0f656..3203d13ac 100644 --- a/src/core/bb_track_container.cpp +++ b/src/core/bb_track_container.cpp @@ -84,7 +84,7 @@ bool bbTrackContainer::play( midiTime _start, fpp_t _frames, void bbTrackContainer::updateAfterTrackAdd( void ) { // make sure, new track(s) have TCOs for every beat/bassline - for( int i = 0; i < tMax( 1, numOfBBs() ); ++i ) + for( int i = 0; i < qMax( 1, numOfBBs() ); ++i ) { createTCOsForBB( i ); } @@ -100,7 +100,7 @@ tact bbTrackContainer::lengthOfBB( int _bb ) const trackList & tl = tracks(); for( trackList::const_iterator it = tl.begin(); it != tl.end(); ++it ) { - max_length = tMax( max_length, + max_length = qMax( max_length, ( *it )->getTCO( _bb )->length() ); } @@ -128,7 +128,7 @@ void bbTrackContainer::removeBB( int _bb ) } if( _bb <= currentBB() ) { - setCurrentBB( tMax( currentBB() - 1, 0 ) ); + setCurrentBB( qMax( currentBB() - 1, 0 ) ); } } diff --git a/src/core/controller_connection.cpp b/src/core/controller_connection.cpp index 813ae62c0..dc6a2c781 100644 --- a/src/core/controller_connection.cpp +++ b/src/core/controller_connection.cpp @@ -81,7 +81,7 @@ controllerConnection::~controllerConnection() -void controllerConnection::setController( int _controllerId ) +void controllerConnection::setController( int /*_controllerId*/ ) { } diff --git a/src/core/effect.cpp b/src/core/effect.cpp index 70d02980b..83070a23f 100644 --- a/src/core/effect.cpp +++ b/src/core/effect.cpp @@ -85,7 +85,7 @@ void effect::saveSettings( QDomDocument & _doc, QDomElement & _this ) void effect::loadSettings( const QDomElement & _this ) { - m_enabledModel.setValue( _this.attribute( "on" ).toInt() ); + m_enabledModel.setValue( (float) _this.attribute( "on" ).toInt() ); m_wetDryModel.setValue( _this.attribute( "wet" ).toFloat() ); m_autoQuitModel.setValue( _this.attribute( "autoquit" ).toFloat() ); m_gateModel.setValue( _this.attribute( "gate" ).toFloat() ); @@ -183,7 +183,7 @@ void effect::reinitSRC( void ) void effect::resample( int _i, const sampleFrame * _src_buf, sample_rate_t _src_sr, sampleFrame * _dst_buf, sample_rate_t _dst_sr, - fpp_t _frames ) + f_cnt_t _frames ) { if( m_srcState[_i] == NULL ) { diff --git a/src/core/engine.cpp b/src/core/engine.cpp index ded865e40..3bf0d0945 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -177,7 +177,8 @@ void engine::initPluginFileHandling( void ) if( it->type == plugin::Instrument ) { const QStringList & ext = - QString( it->supportedFileTypes ).split( ',' ); + QString( it->supportedFileTypes ). + split( QChar( ',' ) ); for( QStringList::const_iterator itExt = ext.begin(); itExt != ext.end(); ++itExt ) { diff --git a/src/core/instrument.cpp b/src/core/instrument.cpp index e992bad51..53c7b191a 100644 --- a/src/core/instrument.cpp +++ b/src/core/instrument.cpp @@ -106,9 +106,9 @@ void instrument::applyRelease( sampleFrame * buf, const notePlayHandle * _n ) const f_cnt_t fl = _n->framesLeft(); if( fl <= desiredReleaseFrames()+fpp ) { - for( fpp_t f = fl > desiredReleaseFrames() ? - ( tMax( fpp - desiredReleaseFrames(), 0 ) + - fl % fpp ) : 0; f < frames; ++f ) + for( fpp_t f = (fpp_t)( ( fl > desiredReleaseFrames() ) ? + ( qMax( fpp - desiredReleaseFrames(), 0 ) + + fl % fpp ) : 0 ); f < frames; ++f ) { const float fac = (float)( fl-f-1 ) / desiredReleaseFrames(); diff --git a/src/core/instrument_functions.cpp b/src/core/instrument_functions.cpp index ac8ad9846..c19a75245 100644 --- a/src/core/instrument_functions.cpp +++ b/src/core/instrument_functions.cpp @@ -443,8 +443,7 @@ void arpeggiator::processNote( notePlayHandle * _n ) // create new arp-note note new_note( midiTime( 0 ), midiTime( 0 ), sub_note_key, - static_cast( _n->getVolume() * - vol_level ), + (volume) 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/instrument_sound_shaping.cpp b/src/core/instrument_sound_shaping.cpp index 420a39872..de4912d04 100644 --- a/src/core/instrument_sound_shaping.cpp +++ b/src/core/instrument_sound_shaping.cpp @@ -63,7 +63,7 @@ instrumentSoundShaping::instrumentSoundShaping( instrumentTrack * _instrument_track ) : model( _instrument_track, tr( "Envelopes/LFOs" ) ), m_instrumentTrack( _instrument_track ), - m_filterEnabledModel( FALSE, this ), + m_filterEnabledModel( false, this ), m_filterModel( this, tr( "Filter type" ) ), m_filterCutModel( 14000.0, 1.0, 14000.0, 1.0, this, tr( "Cutoff frequency" ) ), @@ -118,7 +118,7 @@ float instrumentSoundShaping::volumeLevel( notePlayHandle * _n, f_cnt_t release_begin = _frame - _n->releaseFramesDone() + _n->framesBeforeRelease(); - if( _n->released() == FALSE ) + if( _n->released() == false ) { release_begin += engine::getMixer()->framesPerPeriod(); } @@ -141,7 +141,7 @@ void instrumentSoundShaping::processAudioBuffer( sampleFrame * _ab, f_cnt_t release_begin = total_frames - _n->releaseFramesDone() + _n->framesBeforeRelease(); - if( _n->released() == FALSE ) + if( _n->released() == false ) { release_begin += engine::getMixer()->framesPerPeriod(); } @@ -282,7 +282,7 @@ void instrumentSoundShaping::processAudioBuffer( sampleFrame * _ab, delete[] vol_buf; } -/* else if( m_envLFOParameters[Volume]->used() == FALSE && m_envLFOParameters[PANNING]->used() ) +/* else if( m_envLFOParameters[Volume]->used() == false && m_envLFOParameters[PANNING]->used() ) { // only use panning-envelope... for( fpp_t frame = 0; frame < _frames; ++frame ) @@ -304,7 +304,7 @@ f_cnt_t instrumentSoundShaping::envFrames( const bool _only_vol ) const { f_cnt_t ret_val = m_envLFOParameters[Volume]->PAHD_Frames(); - if( _only_vol == FALSE ) + if( _only_vol == false ) { for( int i = Volume+1; i < NumTargets; ++i ) { @@ -321,7 +321,7 @@ f_cnt_t instrumentSoundShaping::envFrames( const bool _only_vol ) const -f_cnt_t instrumentSoundShaping::releaseFrames( const bool _only_vol ) const +f_cnt_t instrumentSoundShaping::releaseFrames(void ) const { f_cnt_t ret_val = m_envLFOParameters[Volume]->used() ? m_envLFOParameters[Volume]->releaseFrames() : 0; @@ -332,7 +332,7 @@ f_cnt_t instrumentSoundShaping::releaseFrames( const bool _only_vol ) const desiredReleaseFrames(); } - if( m_envLFOParameters[Volume]->used() == FALSE ) + if( m_envLFOParameters[Volume]->used() == false ) { for( int i = Volume+1; i < NumTargets; ++i ) { diff --git a/src/core/journalling_object.cpp b/src/core/journalling_object.cpp index 2d42370d1..26d8d788f 100644 --- a/src/core/journalling_object.cpp +++ b/src/core/journalling_object.cpp @@ -155,7 +155,7 @@ void journallingObject::changeID( jo_id_t _id ) dynamic_cast( jo )-> displayName(); } - printf( "JO-ID %d already in use by %s!\n", _id, + printf( "JO-ID %d already in use by %s!\n", (int) _id, used_by.toAscii().constData() ); return; } diff --git a/src/core/lfo_controller.cpp b/src/core/lfo_controller.cpp index 8475afb46..94b9901a2 100644 --- a/src/core/lfo_controller.cpp +++ b/src/core/lfo_controller.cpp @@ -37,7 +37,7 @@ #include "lfo_controller.h" #include "controller_dialog.h" -const float TWO_PI = 6.28318531f; +//const float TWO_PI = 6.28318531f; lfoController::lfoController( model * _parent ) : controller( LfoController, _parent, tr( "LFO Controller" ) ), @@ -108,14 +108,14 @@ float lfoController::value( int _offset ) break; } - m_phaseOffset = static_cast( + m_phaseOffset = qRound( m_phaseModel.value() * newDurationF / 360.0 ); int newDuration = static_cast( newDurationF ); if (newDuration != m_duration) { // frame offset // (Samples - Samples) = Samples - float oldFramePhase = (frame % m_duration); + float oldFramePhase = float(frame % m_duration); // Phase between 0 and 1 // (Samples/Samples) = factor diff --git a/src/core/main.cpp b/src/core/main.cpp index a54ba013f..91566d379 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -278,8 +278,8 @@ int main( int argc, char * * argv ) ( QString( argv[i] ) == "--oversampling" || QString( argv[i] ) == "-x" ) ) { - int os = QString( argv[i + 1] ).toUInt(); - switch( os ) + int o = QString( argv[i + 1] ).toUInt(); + switch( o ) { case 1: qs.oversampling = mixer::qualitySettings::Oversampling_None; diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index f3791ac6a..44923abcc 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -70,7 +70,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, m_partOfArpeggio( _part_of_arp ), m_muted( FALSE ), m_bbTrack( NULL ), -#if LMMS_SINGERBOT_SUPPORT +#ifdef LMMS_SINGERBOT_SUPPORT m_patternIndex( 0 ), #endif m_origTempo( engine::getSong()->getTempo() ) @@ -92,7 +92,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, _parent->isBaseNote(); m_bbTrack = _parent->m_bbTrack; -#if LMMS_SINGERBOT_SUPPORT +#ifdef LMMS_SINGERBOT_SUPPORT m_patternIndex = _parent->m_patternIndex; #endif } @@ -324,7 +324,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s ) // then set some variables indicating release-state m_framesBeforeRelease = _s; - m_releaseFramesToDo = tMax( 0, // 10, + m_releaseFramesToDo = qMax( 0, // 10, m_instrumentTrack->m_soundShaping.releaseFrames() ); if( !isBaseNote() || !getInstrumentTrack()->arpeggiatorEnabled() ) @@ -345,8 +345,8 @@ void notePlayHandle::noteOff( const f_cnt_t _s ) f_cnt_t notePlayHandle::actualReleaseFramesToDo( void ) const { - return( m_instrumentTrack->m_soundShaping.releaseFrames( - isArpeggioBaseNote() ) ); + return( m_instrumentTrack->m_soundShaping.releaseFrames(/* + isArpeggioBaseNote()*/ ) ); } @@ -463,7 +463,7 @@ void notePlayHandle::updateFrequency( void ) ( key() - m_instrumentTrack->baseNoteModel()->value() + engine::getSong()->masterPitch() ) / 12.0f; m_frequency = BaseFreq * powf( 2.0f, pitch + - m_instrumentTrack->m_pitchModel.value() / ( 100 * 12.0 ) ); + m_instrumentTrack->m_pitchModel.value() / ( 100 * 12.0f ) ); m_unpitchedFrequency = BaseFreq * powf( 2.0f, pitch ); for( notePlayHandleVector::iterator it = m_subNotes.begin(); @@ -480,9 +480,9 @@ void notePlayHandle::processMidiTime( const midiTime & _time ) { if( _time >= pos() ) { - float v = detuning()->getAutomationPattern()->valueAt( _time - - pos() ); - if( v != m_baseDetuning->value() ) + const float v = detuning()->getAutomationPattern()-> + valueAt( _time - pos() ); + if( !typeInfo::isEqual( v, m_baseDetuning->value() ) ) { m_baseDetuning->setValue( v ); updateFrequency(); diff --git a/src/core/oscillator.cpp b/src/core/oscillator.cpp index b0902c869..bf47d1ce6 100644 --- a/src/core/oscillator.cpp +++ b/src/core/oscillator.cpp @@ -311,7 +311,7 @@ void oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames, // should be called every time phase-offset is changed... inline void oscillator::recalcPhase( void ) { - if( m_phaseOffset != m_ext_phaseOffset ) + if( !typeInfo::isEqual( m_phaseOffset, m_ext_phaseOffset ) ) { m_phase -= m_phaseOffset; m_phaseOffset = m_ext_phaseOffset; diff --git a/src/core/piano.cpp b/src/core/piano.cpp index 298cf3516..af2c91356 100644 --- a/src/core/piano.cpp +++ b/src/core/piano.cpp @@ -515,8 +515,9 @@ void pianoView::mousePressEvent( QMouseEvent * _me ) } else { - m_piano->m_instrumentTrack->baseNoteModel()-> - setInitValue( key_num ); + m_piano->m_instrumentTrack-> + baseNoteModel()-> + setInitValue( (float) key_num ); } } @@ -536,7 +537,7 @@ void pianoView::mousePressEvent( QMouseEvent * _me ) * * \param _me the mousePressEvent to handle. */ -void pianoView::mouseReleaseEvent( QMouseEvent * _me ) +void pianoView::mouseReleaseEvent( QMouseEvent * ) { if( m_lastKey != -1 ) { @@ -624,8 +625,9 @@ void pianoView::mouseMoveEvent( QMouseEvent * _me ) } else { - m_piano->m_instrumentTrack->baseNoteModel()-> - setInitValue( key_num ); + m_piano->m_instrumentTrack-> + baseNoteModel()-> + setInitValue( (float) key_num ); } } // and let the user see that he pressed a key... :) diff --git a/src/core/preset_preview_play_handle.cpp b/src/core/preset_preview_play_handle.cpp index b5ac574ca..0812f64e2 100644 --- a/src/core/preset_preview_play_handle.cpp +++ b/src/core/preset_preview_play_handle.cpp @@ -157,7 +157,7 @@ presetPreviewPlayHandle::presetPreviewPlayHandle( const QString & _preset_file, // create note-play-handle for it m_previewNote = new notePlayHandle( s_previewTC->previewInstrumentTrack(), 0, - valueRanges::max() / 2, + typeInfo::max() / 2, note( 0, 0, DefaultKey, 100 ) ); diff --git a/src/core/remote_plugin.cpp b/src/core/remote_plugin.cpp index 88e42f365..2f9c847ea 100644 --- a/src/core/remote_plugin.cpp +++ b/src/core/remote_plugin.cpp @@ -137,7 +137,7 @@ bool remotePlugin::process( const sampleFrame * _in_buf, memset( m_shm, 0, m_shmSize ); - ch_cnt_t inputs = tMin( m_inputCount, DEFAULT_CHANNELS ); + ch_cnt_t inputs = qMin( m_inputCount, DEFAULT_CHANNELS ); if( _in_buf != NULL && inputs > 0 ) { @@ -182,7 +182,7 @@ bool remotePlugin::process( const sampleFrame * _in_buf, waitForMessage( IdProcessingDone ); unlock(); - const ch_cnt_t outputs = tMin( m_outputCount, + const ch_cnt_t outputs = qMin( m_outputCount, DEFAULT_CHANNELS ); if( m_splitChannels ) { diff --git a/src/core/sample_buffer.cpp b/src/core/sample_buffer.cpp index f7783592f..74ddef4bb 100644 --- a/src/core/sample_buffer.cpp +++ b/src/core/sample_buffer.cpp @@ -652,7 +652,7 @@ sampleFrame * sampleBuffer::getSampleFragment( f_cnt_t _start, f_cnt_t loop_frames = m_loopEndFrame - m_loopStartFrame; while( _frames - copied > 0 ) { - f_cnt_t todo = tMin( _frames - copied, loop_frames ); + f_cnt_t todo = qMin( _frames - copied, loop_frames ); memcpy( *_tmp + copied, m_data + m_loopStartFrame, todo * BYTES_PER_FRAME ); copied += todo; @@ -850,7 +850,7 @@ QString & sampleBuffer::toBase64( QString & _dst ) const f_cnt_t frame_cnt = 0; while( frame_cnt < m_frames ) { - f_cnt_t remaining = tMin( FRAMES_PER_BUF, + f_cnt_t remaining = qMin( FRAMES_PER_BUF, m_frames - frame_cnt ); FLAC__int32 buf[FRAMES_PER_BUF * DEFAULT_CHANNELS]; for( f_cnt_t f = 0; f < remaining; ++f ) @@ -911,7 +911,6 @@ sampleBuffer * sampleBuffer::resample( sampleFrame * _data, src_data.input_frames = _frames; src_data.output_frames = dst_frames; src_data.src_ratio = (double) _dst_sr / _src_sr; - int error; if( ( error = src_process( state, &src_data ) ) ) { printf( "sampleBuffer: error while resampling: %s\n", diff --git a/src/core/sample_record_handle.cpp b/src/core/sample_record_handle.cpp index 5610ebec3..bd17f7aa1 100644 --- a/src/core/sample_record_handle.cpp +++ b/src/core/sample_record_handle.cpp @@ -68,10 +68,10 @@ sampleRecordHandle::~sampleRecordHandle() -void sampleRecordHandle::play( sampleFrame * _working_buffer ) +void sampleRecordHandle::play( sampleFrame * /*_working_buffer*/ ) { const sampleFrame * recbuf = engine::getMixer()->inputBuffer(); - const fpp_t frames = engine::getMixer()->inputBufferFrames(); + const f_cnt_t frames = engine::getMixer()->inputBufferFrames(); writeBuffer( recbuf, frames ); m_framesRecorded += frames; @@ -88,7 +88,7 @@ void sampleRecordHandle::play( sampleFrame * _working_buffer ) bool sampleRecordHandle::done( void ) const { - return( FALSE ); + return false; } @@ -139,10 +139,10 @@ void sampleRecordHandle::createSampleBuffer( sampleBuffer * * _sample_buf ) void sampleRecordHandle::writeBuffer( const sampleFrame * _ab, - const fpp_t _frames ) + const f_cnt_t _frames ) { sampleFrame * buf = new sampleFrame[_frames]; - for( fpp_t frame = 0; frame < _frames; ++frame ) + for( f_cnt_t frame = 0; frame < _frames; ++frame ) { for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl ) { diff --git a/src/core/serializing_object.cpp b/src/core/serializing_object.cpp index ec7ad13e4..f7779e5af 100644 --- a/src/core/serializing_object.cpp +++ b/src/core/serializing_object.cpp @@ -92,14 +92,15 @@ void serializingObject::setHook( serializingObjectHook * _hook ) -void serializingObject::saveSettings( QDomDocument & _doc, QDomElement & _this ) +void serializingObject::saveSettings( QDomDocument &/* _doc*/, + QDomElement &/* _this*/ ) { } -void serializingObject::loadSettings( const QDomElement & _this ) +void serializingObject::loadSettings( const QDomElement & /* _this*/ ) { } diff --git a/src/core/song.cpp b/src/core/song.cpp index 292deb5f0..6f3d95fa9 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -136,7 +136,7 @@ void song::masterVolumeChanged( void ) void song::setTempo( void ) { - const bpm_t tempo = m_tempoModel.value(); + const bpm_t tempo = (bpm_t) m_tempoModel.value(); playHandleVector & phv = engine::getMixer()->playHandles(); for( playHandleVector::iterator it = phv.begin(); it != phv.end(); ++it ) @@ -291,7 +291,7 @@ void song::processNextBuffer( void ) } trackList track_list; - Sint16 tco_num = -1; + int tco_num = -1; switch( m_playMode ) { @@ -700,7 +700,7 @@ void song::addAutomationTrack( void ) bpm_t song::getTempo( void ) { - return( m_tempoModel.value() ); + return (bpm_t) m_tempoModel.value(); } diff --git a/src/core/surround_area.cpp b/src/core/surround_area.cpp index 3e922024a..d096341cd 100644 --- a/src/core/surround_area.cpp +++ b/src/core/surround_area.cpp @@ -202,7 +202,7 @@ surroundAreaModel::surroundAreaModel( ::model * _parent, surroundVolumeVector surroundAreaModel::getVolumeVector( float _v_scale ) const { surroundVolumeVector v = { { _v_scale, _v_scale -#ifndef DISABLE_SURROUND +#ifndef LMMS_DISABLE_SURROUND , _v_scale, _v_scale #endif } } ; @@ -210,14 +210,14 @@ surroundVolumeVector surroundAreaModel::getVolumeVector( float _v_scale ) const if( x() >= 0 ) { v.vol[0] *= 1.0f - x() / (float)SURROUND_AREA_SIZE; -#ifndef DISABLE_SURROUND +#ifndef LMMS_DISABLE_SURROUND v.vol[2] *= 1.0f - x() / (float)SURROUND_AREA_SIZE; #endif } else { v.vol[1] *= 1.0f + x() / (float)SURROUND_AREA_SIZE; -#ifndef DISABLE_SURROUND +#ifndef LMMS_DISABLE_SURROUND v.vol[3] *= 1.0f + x() / (float)SURROUND_AREA_SIZE; #endif } @@ -227,7 +227,7 @@ surroundVolumeVector surroundAreaModel::getVolumeVector( float _v_scale ) const v.vol[0] *= 1.0f - y() / (float)SURROUND_AREA_SIZE; v.vol[1] *= 1.0f - y() / (float)SURROUND_AREA_SIZE; } -#ifndef DISABLE_SURROUND +#ifndef LMMS_DISABLE_SURROUND else { v.vol[2] *= 1.0f + y() / (float)SURROUND_AREA_SIZE; @@ -257,8 +257,8 @@ void surroundAreaModel::loadSettings( const QDomElement & _this, if( _this.hasAttribute( _name ) ) { const int i = _this.attribute( _name ).toInt(); - m_posX.setValue( ( i & 0xFFFF ) - 2 * SURROUND_AREA_SIZE ); - m_posY.setValue( ( i >> 16 ) - 2 * SURROUND_AREA_SIZE ); + m_posX.setValue( (float)( ( i & 0xFFFF ) - 2 * SURROUND_AREA_SIZE ) ); + m_posY.setValue( (float)( ( i >> 16 ) - 2 * SURROUND_AREA_SIZE ) ); } else { diff --git a/src/core/timeline.cpp b/src/core/timeline.cpp index a62ddc55a..22f8c28da 100644 --- a/src/core/timeline.cpp +++ b/src/core/timeline.cpp @@ -253,7 +253,7 @@ void timeLine::paintEvent( QPaintEvent * ) p.drawLine( cx, 5, cx, height() - 6 ); ++tact_num; if( ( tact_num - 1 ) % - tMax( 1, qRound( 1.0f / 3.0f * + qMax( 1, qRound( 1.0f / 3.0f * midiTime::ticksPerTact() / m_ppt ) ) == 0 ) { const QString s = QString::number( tact_num ); @@ -321,7 +321,7 @@ void timeLine::mousePressEvent( QMouseEvent * _me ) void timeLine::mouseMoveEvent( QMouseEvent * _me ) { - const midiTime t = m_begin + static_cast( tMax( _me->x() - + const midiTime t = m_begin + static_cast( qMax( _me->x() - m_xOffset - m_moveXOff, 0 ) * midiTime::ticksPerTact() / m_ppt ); switch( m_action ) diff --git a/src/core/track.cpp b/src/core/track.cpp index ec1366a49..048bfdcf4 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -658,7 +658,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me ) if( m_action == Move ) { const int x = mapToParent( _me->pos() ).x() - m_initialMouseX; - midiTime t = tMax( 0, (int) + midiTime t = qMax( 0, (int) m_trackView->getTrackContainerView()->currentPosition()+ static_cast( x * midiTime::ticksPerTact() / ppt ) ); @@ -696,7 +696,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me ) } trackContentObject * tco = tcov->m_tco; tcos.push_back( tco ); - smallest_pos = tMin( smallest_pos, + smallest_pos = qMin( smallest_pos, (int)tco->startPosition() + static_cast( dx * midiTime::ticksPerTact() / ppt ) ); @@ -712,7 +712,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me ) } else if( m_action == Resize ) { - midiTime t = tMax( midiTime::ticksPerTact(), + midiTime t = qMax( midiTime::ticksPerTact(), static_cast( _me->x() * midiTime::ticksPerTact() / ppt ) ); if( engine::getMainWindow()->isCtrlPressed() == @@ -1987,7 +1987,7 @@ void track::removeTact( const midiTime & _pos ) { if( ( *it )->startPosition() >= _pos ) { - ( *it )->movePosition( tMax( ( *it )->startPosition() - + ( *it )->movePosition( qMax( ( *it )->startPosition() - midiTime::ticksPerTact(), 0 ) ); } } @@ -2235,7 +2235,7 @@ void trackView::undoStep( journalEntry & _je ) } break; case ResizeTrack: - setFixedHeight( tMax( height() + + setFixedHeight( qMax( height() + _je.data().toInt(), MINIMAL_TRACK_HEIGHT ) ); m_trackContainerView->realignTracks(); @@ -2397,7 +2397,7 @@ void trackView::mouseMoveEvent( QMouseEvent * _me ) } else if( m_action == ResizeTrack ) { - setFixedHeight( tMax( _me->y(), MINIMAL_TRACK_HEIGHT ) ); + setFixedHeight( qMax( _me->y(), MINIMAL_TRACK_HEIGHT ) ); m_trackContainerView->realignTracks(); } } diff --git a/src/gui/automation_editor.cpp b/src/gui/automation_editor.cpp index b3de5d00c..3cb652b31 100644 --- a/src/gui/automation_editor.cpp +++ b/src/gui/automation_editor.cpp @@ -641,8 +641,8 @@ void automationEditor::leaveEvent( QEvent * _e ) void automationEditor::drawLine( int _x0, float _y0, int _x1, float _y1 ) { - int deltax = static_cast( tAbs( _x1 - _x0 ) ); - float deltay = tAbs( _y1 - _y0 ); + int deltax = qRound( qAbs( _x1 - _x0 ) ); + float deltay = qAbs( _y1 - _y0 ); int x = _x0; float y = _y0; int xstep; @@ -1006,8 +1006,7 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) m_selectedTick = pos_ticks - m_selectStartTick; if( (int) m_selectStartTick + m_selectedTick < 0 ) { - m_selectedTick = -static_cast( - m_selectStartTick ); + m_selectedTick = -qRound( m_selectStartTick ); } m_selectedLevels = level - m_selectStartLevel; if( level <= m_selectStartLevel ) @@ -1169,8 +1168,7 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me ) if( (int) m_selectStartTick + m_selectedTick < 0 ) { - m_selectedTick = -static_cast( - m_selectStartTick ); + m_selectedTick = -qRound( m_selectStartTick ); } float level = getLevel( _me->y() ); @@ -1274,7 +1272,7 @@ void automationEditor::paintEvent( QPaintEvent * _pe ) { int y = grid_bottom; int level = (int) m_bottomLevel; - int printable = tMax( 1, 5 * DEFAULT_Y_DELTA + int printable = qMax( 1, 5 * DEFAULT_Y_DELTA / m_y_delta ); int module = level % printable; if( module ) @@ -1614,7 +1612,7 @@ void automationEditor::wheelEvent( QWheelEvent * _we ) { if( _we->delta() > 0 ) { - m_ppt = tMin( m_ppt * 2, m_y_delta * + m_ppt = qMin( m_ppt * 2, m_y_delta * DEFAULT_STEPS_PER_TACT * 8 ); } else if( m_ppt >= 72 ) @@ -1624,7 +1622,7 @@ void automationEditor::wheelEvent( QWheelEvent * _we ) // update combobox with zooming-factor m_zoomingXComboBox->model()->setValue( m_zoomingXComboBox->model()->findText( QString::number( - static_cast( m_ppt * 100 / + qRound( m_ppt * 100 / DEFAULT_PPT ) ) +"%" ) ); // update timeline m_timeLine->setPixelsPerTact( m_ppt ); @@ -2043,7 +2041,7 @@ void automationEditor::updatePosition( const midiTime & _t ) } else if( _t < m_currentPosition ) { - midiTime t = tMax( _t - w * DefaultTicksPerTact * + midiTime t = qMax( _t - w * DefaultTicksPerTact * DefaultTicksPerTact / m_ppt, 0 ); m_leftRightScroll->setValue( t.getTact() * DefaultTicksPerTact ); diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp index 2c2ef51d3..b11a8cfc0 100644 --- a/src/gui/main_window.cpp +++ b/src/gui/main_window.cpp @@ -600,10 +600,10 @@ void mainWindow::saveWidgetState( QWidget * _w, QDomElement & _de ) void mainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de ) { - QRect r( tMax( 0, _de.attribute( "x" ).toInt() ), - tMax( 0, _de.attribute( "y" ).toInt() ), - tMax( 100, _de.attribute( "width" ).toInt() ), - tMax( 100, _de.attribute( "height" ).toInt() ) ); + QRect r( qMax( 0, _de.attribute( "x" ).toInt() ), + qMax( 0, _de.attribute( "y" ).toInt() ), + qMax( 100, _de.attribute( "width" ).toInt() ), + qMax( 100, _de.attribute( "height" ).toInt() ) ); if( _de.hasAttribute( "visible" ) && !r.isNull() ) { if ( _w->parentWidget() != NULL && diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index b51c9808f..7bb0e9c31 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -2060,7 +2060,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe ) } // draw volume-line of note QColor color = QColor::fromHsv( 120, 221, - tMin(255, 60 + ( *it )->getVolume() ) ); + qMin(255, 60 + ( *it )->getVolume() ) ); p.setPen( QPen( color, NE_LINE_WIDTH ) ); p.drawLine( x + WHITE_KEY_WIDTH, @@ -2191,7 +2191,7 @@ void pianoRoll::wheelEvent( QWheelEvent * _we ) { if( _we->delta() > 0 ) { - m_ppt = tMin( m_ppt * 2, KEY_LINE_HEIGHT * + m_ppt = qMin( m_ppt * 2, KEY_LINE_HEIGHT * DefaultStepsPerTact * 8 ); } else if( m_ppt >= 72 ) @@ -2682,7 +2682,7 @@ void pianoRoll::updatePosition( const midiTime & _t ) } else if( _t < m_currentPosition ) { - midiTime t = tMax( _t - w * midiTime::ticksPerTact() * + midiTime t = qMax( _t - w * midiTime::ticksPerTact() * midiTime::ticksPerTact() / m_ppt, 0 ); m_leftRightScroll->setValue( t.getTact() * midiTime::ticksPerTact() ); diff --git a/src/gui/plugin_browser.cpp b/src/gui/plugin_browser.cpp index bff0a5e32..a2ccec7af 100644 --- a/src/gui/plugin_browser.cpp +++ b/src/gui/plugin_browser.cpp @@ -154,7 +154,7 @@ void pluginDescWidget::paintEvent( QPaintEvent * ) &br ); if( m_mouseOver ) { - m_targetHeight = tMax( 60, 25 + br.height() ); + m_targetHeight = qMax( 60, 25 + br.height() ); } } diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index d16907040..881c2efbc 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -521,7 +521,7 @@ void songEditor::wheelEvent( QWheelEvent * _we ) { if( _we->delta() > 0 ) { - setPixelsPerTact( (int) tMin( pixelsPerTact() * 2, + setPixelsPerTact( (int) qMin( pixelsPerTact() * 2, 256.0f ) ); } else if( pixelsPerTact() >= 8 ) @@ -657,7 +657,7 @@ void songEditor::updatePosition( const midiTime & _t ) } else if( _t < m_currentPosition ) { - midiTime t = tMax( + midiTime t = qMax( (int)( _t - w * midiTime::ticksPerTact() / pixelsPerTact() ), 0 ); diff --git a/src/gui/widgets/kmultitabbar.cpp b/src/gui/widgets/kmultitabbar.cpp index 9bbd4b0e2..a815bb6de 100644 --- a/src/gui/widgets/kmultitabbar.cpp +++ b/src/gui/widgets/kmultitabbar.cpp @@ -394,7 +394,7 @@ QSize KMultiTabBarButton::sizeHint() const iw = 20; ih = 16; w += iw; - h = tMax( h, ih ); + h = qMax( h, ih ); } QStyleOptionButton sob; if ( menu() != 0 ) diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index d1108f2fc..d02c65590 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -108,7 +108,7 @@ void knob::setLabel( const QString & _txt ) m_label = _txt; if( m_knobPixmap ) { - setFixedSize( tMax( m_knobPixmap->width(), + setFixedSize( qMax( m_knobPixmap->width(), QFontMetrics( pointSizeF( font(), 6 ) ).width( m_label ) ), m_knobPixmap->height() + 10 ); @@ -265,7 +265,7 @@ bool knob::updateAngle( void ) m_totalAngle; angle = static_cast( a ) % 360; } - if( tAbs( angle - m_angle ) > 3 ) + if( qAbs( angle - m_angle ) > 3 ) { m_angle = angle; return( TRUE ); @@ -346,9 +346,9 @@ void knob::drawKnob( QPainter * _p ) } case knobDark_28: { - const float rb = tMax( ( radius - 10 ) / 3.0, + const float rb = qMax( ( radius - 10 ) / 3.0, 0.0 ); - const float re = tMax( ( radius - 4 ), 0.0 ); + const float re = qMax( ( radius - 4 ), 0.0 ); QLineF ln = calculateLine( mid, re, rb ); ln.translate( 1, 1 ); p.drawLine( ln ); diff --git a/src/gui/widgets/lcd_spinbox.cpp b/src/gui/widgets/lcd_spinbox.cpp index 989c0a9e9..ccd0e15fd 100644 --- a/src/gui/widgets/lcd_spinbox.cpp +++ b/src/gui/widgets/lcd_spinbox.cpp @@ -250,7 +250,7 @@ void lcdSpinBox::updateSize() m_cellHeight + (2*margin) ); } else { - setFixedSize( tMax( + setFixedSize( qMax( m_cellWidth * m_numDigits + 2*(margin+m_marginWidth), QFontMetrics( pointSize<6>( font() ) ).width( m_label ) ), m_cellHeight + (2*margin) + 10 ); diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 91458f381..52831f139 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -183,8 +183,8 @@ void bbTCOView::paintEvent( QPaintEvent * ) } if( isSelected() == TRUE ) { - col = QColor( tMax( col.red() - 128, 0 ), - tMax( col.green() - 128, 0 ), 255 ); + col = QColor( qMax( col.red() - 128, 0 ), + qMax( col.green() - 128, 0 ), 255 ); } QPainter p( this ); diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 80d2e4c1f..1b18571e4 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -176,7 +176,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf, m_audioPort.setNextFxChannel( m_effectChannelModel.value() ); engine::getMixer()->bufferToPort( _buf, - ( _n != NULL ) ? tMin( + ( _n != NULL ) ? qMin( _n->framesLeftForCurrentPeriod(), _frames ) : _frames, ( _n != NULL ) ? _n->offset() : 0, @@ -237,7 +237,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me, notePlayHandle( this, _time.frames( engine::framesPerTick() ), - valueRanges::max() / 2, + typeInfo::max() / 2, n ); if( engine::getMixer()->addPlayHandle( nph ) ) diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index 558e72811..6176bbaad 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -146,7 +146,7 @@ midiTime pattern::length( void ) const { if( ( *it )->length() > 0 ) { - max_length = tMax( max_length, + max_length = qMax( max_length, ( *it )->endPos() ); } } @@ -166,7 +166,7 @@ midiTime pattern::beatPatternLength( void ) const { if( ( *it )->length() < 0 ) { - max_length = tMax( max_length, ( *it )->pos() + + max_length = qMax( max_length, ( *it )->pos() + midiTime::ticksPerTact() / midiTime::stepsPerTact() ); } diff --git a/src/tracks/sample_track.cpp b/src/tracks/sample_track.cpp index f77ea025e..3c3b73474 100644 --- a/src/tracks/sample_track.cpp +++ b/src/tracks/sample_track.cpp @@ -78,7 +78,7 @@ sampleTCO::~sampleTCO() void sampleTCO::changeLength( const midiTime & _length ) { - trackContentObject::changeLength( tMax( static_cast( _length ), + trackContentObject::changeLength( qMax( static_cast( _length ), DefaultTicksPerTact ) ); } @@ -352,7 +352,7 @@ void sampleTCOView::paintEvent( QPaintEvent * _pe ) p.setPen( QColor( 64, 224, 160 ) ); } QRect r = QRect( 1, 1, - tMax( static_cast( m_tco->sampleLength() * + qMax( static_cast( m_tco->sampleLength() * pixelsPerTact() / DefaultTicksPerTact ), 1 ), height() - 4 ); p.setClipRect( QRect( 1, 1, width() - 2, height() - 2 ) );