diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eee7ae803..11094720a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -284,6 +284,7 @@ jobs: --toolchain C:/vcpkg/scripts/buildsystems/vcpkg.cmake ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` -DUSE_COMPILE_CACHE=ON ` + -DUSE_WERROR=ON ` -DVCPKG_TARGET_TRIPLET="${{ matrix.arch }}-windows" ` -DVCPKG_HOST_TRIPLET="${{ matrix.arch }}-windows" ` -DVCPKG_MANIFEST_INSTALL="${{ env.should_install_manifest }}" diff --git a/CMakeLists.txt b/CMakeLists.txt index 9da4fc243..a9dbda4cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -675,6 +675,11 @@ elseif(MSVC) "/external:W0" # Don't emit warnings for third-party code "/external:anglebrackets" # Consider headers included with angle brackets to be third-party "/external:templates-" # Still emit warnings from first-party instantiations of third-party templates + # Silence "class X needs to have DLL-interface to be used by clients of + # class Y" warnings. These aren't trivial to address, and don't pose a + # problem for us since we build all modules with the same compiler and + # options, and dynamically link the CRT. + "/wd4251" ) set(THIRD_PARTY_COMPILE_ERROR_FLAGS "/W0" # Disable all warnings diff --git a/plugins/CarlaBase/Carla.h b/plugins/CarlaBase/Carla.h index c1190e5e7..da0ae67cc 100644 --- a/plugins/CarlaBase/Carla.h +++ b/plugins/CarlaBase/Carla.h @@ -81,7 +81,7 @@ class CarlaParamFloatModel : public FloatModel { public: CarlaParamFloatModel(Model * parent): - FloatModel(0.0, 0.0, 1.0, 0.001, parent, "Unused"), + FloatModel(0.f, 0.f, 1.f, 0.001f, parent, "Unused"), m_isOutput(false), m_isEnabled(false) { diff --git a/plugins/Compressor/Compressor.h b/plugins/Compressor/Compressor.h index 3fc90b752..4d6c05d7e 100755 --- a/plugins/Compressor/Compressor.h +++ b/plugins/Compressor/Compressor.h @@ -35,7 +35,7 @@ namespace lmms { -constexpr float COMP_LOG = -2.2; +constexpr float COMP_LOG = -2.2f; class CompressorEffect : public Effect { diff --git a/plugins/Compressor/CompressorControlDialog.h b/plugins/Compressor/CompressorControlDialog.h index cedba4b04..108c421a0 100755 --- a/plugins/Compressor/CompressorControlDialog.h +++ b/plugins/Compressor/CompressorControlDialog.h @@ -36,7 +36,7 @@ class QLabel; namespace lmms { -constexpr float COMP_NOISE_FLOOR = 0.000001;// -120 dbFs +constexpr float COMP_NOISE_FLOOR = 0.000001f;// -120 dbFs class CompressorControls; diff --git a/plugins/Delay/DelayControls.cpp b/plugins/Delay/DelayControls.cpp index b31488f72..c1ad73153 100644 --- a/plugins/Delay/DelayControls.cpp +++ b/plugins/Delay/DelayControls.cpp @@ -34,11 +34,11 @@ namespace lmms DelayControls::DelayControls( DelayEffect* effect ): EffectControls( effect ), m_effect ( effect ), - m_delayTimeModel( 0.5, 0.01, 5.0, 0.0001, 5000.0, this, tr( "Delay samples" )) , - m_feedbackModel(0.0f,0.0f,1.0f,0.01f,this,tr( "Feedback" ) ), - m_lfoTimeModel(2.0, 0.01, 5.0, 0.0001, 20000.0, this, tr( "LFO frequency" ) ), - m_lfoAmountModel(0.0, 0.0, 0.5, 0.0001, 2000.0, this, tr ( "LFO amount" ) ), - m_outGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Output gain" ) ) + m_delayTimeModel(0.5f, 0.01f, 5.f, 0.0001f, 5000.f, this, tr("Delay samples")) , + m_feedbackModel(0.0f, 0.0f, 1.0f, 0.01f, this, tr("Feedback")), + m_lfoTimeModel(2.f, 0.01f, 5.f, 0.0001f, 20000.f, this, tr("LFO frequency")), + m_lfoAmountModel(0.f, 0.f, 0.5f, 0.0001f, 2000.f, this, tr("LFO amount")), + m_outGainModel(0.f, -60.f, 20.f, 0.01f, this, tr("Output gain")) { connect( Engine::audioEngine(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) ); m_outPeakL = 0.0; @@ -77,4 +77,4 @@ void DelayControls::changeSampleRate() } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/plugins/Delay/StereoDelay.cpp b/plugins/Delay/StereoDelay.cpp index e4b8b5641..c03cf68d0 100644 --- a/plugins/Delay/StereoDelay.cpp +++ b/plugins/Delay/StereoDelay.cpp @@ -32,9 +32,9 @@ namespace lmms StereoDelay::StereoDelay( int maxTime, int sampleRate ) { m_buffer = 0; - m_maxTime = maxTime; + m_maxTime = static_cast(maxTime); m_maxLength = maxTime * sampleRate; - m_length = m_maxLength; + m_length = static_cast(m_maxLength); m_writeIndex = 0; m_feedback = 0.0f; @@ -58,7 +58,7 @@ StereoDelay::~StereoDelay() void StereoDelay::tick( sampleFrame& frame ) { m_writeIndex = ( m_writeIndex + 1 ) % ( int )m_maxLength; - int readIndex = m_writeIndex - m_length; + int readIndex = m_writeIndex - static_cast(m_length); if (readIndex < 0 ) { readIndex += m_maxLength; } float lOut = m_buffer[ readIndex ][ 0 ]; float rOut = m_buffer[ readIndex ] [1 ]; diff --git a/plugins/Dispersion/DispersionControls.cpp b/plugins/Dispersion/DispersionControls.cpp index 771ffb89d..f97fc0e37 100644 --- a/plugins/Dispersion/DispersionControls.cpp +++ b/plugins/Dispersion/DispersionControls.cpp @@ -35,9 +35,9 @@ DispersionControls::DispersionControls(DispersionEffect* effect) : EffectControls(effect), m_effect(effect), m_amountModel(0, 0, MAX_DISPERSION_FILTERS, this, tr("Amount")), - m_freqModel(200, 20, 20000, 0.001, this, tr("Frequency")), - m_resoModel(0.707, 0.01, 8, 0.0001, this, tr("Resonance")), - m_feedbackModel(0.f, -1.f, 1.f, 0.0001, this, tr("Feedback")), + m_freqModel(200, 20, 20000, 0.001f, this, tr("Frequency")), + m_resoModel(0.707f, 0.01f, 8, 0.0001f, this, tr("Resonance")), + m_feedbackModel(0.f, -1.f, 1.f, 0.0001f, this, tr("Feedback")), m_dcModel(false, this, tr("DC Offset Removal")) { m_freqModel.setScaleLogarithmic(true); diff --git a/plugins/DualFilter/DualFilterControls.cpp b/plugins/DualFilter/DualFilterControls.cpp index 4a4091aa2..75478c9d7 100644 --- a/plugins/DualFilter/DualFilterControls.cpp +++ b/plugins/DualFilter/DualFilterControls.cpp @@ -43,7 +43,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) : m_enabled1Model( true, this, tr( "Filter 1 enabled" ) ), m_filter1Model( this, tr( "Filter 1 type" ) ), m_cut1Model( 7000.0f, 1.0f, 20000.0f, 1.0f, this, tr( "Cutoff frequency 1" ) ), - m_res1Model( 0.5, BasicFilters<>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 1" ) ), + m_res1Model(0.5f, BasicFilters<>::minQ(), 10.f, 0.01f, this, tr("Q/Resonance 1")), m_gain1Model( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Gain 1" ) ), m_mixModel( 0.0f, -1.0f, 1.0f, 0.01f, this, tr( "Mix" ) ), @@ -51,7 +51,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) : m_enabled2Model( true, this, tr( "Filter 2 enabled" ) ), m_filter2Model( this, tr( "Filter 2 type" ) ), m_cut2Model( 7000.0f, 1.0f, 20000.0f, 1.0f, this, tr( "Cutoff frequency 2" ) ), - m_res2Model( 0.5, BasicFilters<>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 2" ) ), + m_res2Model(0.5f, BasicFilters<>::minQ(), 10.f, 0.01f, this, tr("Q/Resonance 2")), m_gain2Model( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Gain 2" ) ) { m_filter1Model.addItem( tr( "Low-pass" ), std::make_unique( "filter_lp" ) ); diff --git a/plugins/Eq/EqControls.cpp b/plugins/Eq/EqControls.cpp index 04fb9bd3a..ea5b2947f 100644 --- a/plugins/Eq/EqControls.cpp +++ b/plugins/Eq/EqControls.cpp @@ -37,30 +37,30 @@ namespace lmms EqControls::EqControls( EqEffect *effect ) : EffectControls( effect ), m_effect( effect ), - m_inGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Input gain") ), - m_outGainModel( -.0, -60.0, 20.0, 0.01, this, tr( "Output gain" ) ), - m_lowShelfGainModel( 0.0 , -18, 18, 0.001, this, tr( "Low-shelf gain" ) ), - m_para1GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 1 gain" ) ), - m_para2GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 2 gain" ) ), - m_para3GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 3 gain" ) ), - m_para4GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 4 gain" ) ), - m_highShelfGainModel( 0.0 , -18, 18, 0.001, this, tr( "High-shelf gain" ) ), - m_hpResModel( 0.707,0.003, 10.0 , 0.001, this, tr( "HP res" ) ), - m_lowShelfResModel( 0.707, 0.55, 10.0 , 0.001, this , tr( "Low-shelf res" ) ), - m_para1BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 1 BW" ) ), - m_para2BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 2 BW" ) ), - m_para3BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 3 BW" ) ), - m_para4BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 4 BW" ) ), - m_highShelfResModel( 0.707, 0.55, 10.0 , 0.001, this , tr( "High-shelf res" ) ), - m_lpResModel( 0.707,0.003, 10.0 , 0.001, this , tr( "LP res" ) ), - m_hpFeqModel( 31.0, 20.0, 20000, 0.001, this , tr( "HP freq" ) ), - m_lowShelfFreqModel( 80.0, 20.0, 20000, 0.001, this , tr( "Low-shelf freq" ) ), - m_para1FreqModel( 120.0, 20.0, 20000, 0.001, this , tr( "Peak 1 freq" ) ), - m_para2FreqModel( 250.0, 20.0, 20000, 0.001, this, tr( "Peak 2 freq" ) ), - m_para3FreqModel( 2000.0, 20.0, 20000, 0.001, this , tr( "Peak 3 freq" ) ), - m_para4FreqModel( 4000.0, 20.0, 20000, 0.001, this , tr( "Peak 4 freq" ) ), - m_highShelfFreqModel( 12000.0, 20.0, 20000, 0.001, this , tr( "High-shelf freq" ) ), - m_lpFreqModel( 18000.0, 20.0, 20000, 0.001, this , tr( "LP freq" ) ), + m_inGainModel(0.f, -60.f, 20.f, 0.01f, this, tr("Input gain")), + m_outGainModel(-0.f, -60.f, 20.f, 0.01f, this, tr("Output gain")), + m_lowShelfGainModel( 0.f, -18, 18, 0.001f, this, tr("Low-shelf gain")), + m_para1GainModel(0.f, -18, 18, 0.001f, this, tr("Peak 1 gain")), + m_para2GainModel(0.f, -18, 18, 0.001f, this, tr("Peak 2 gain")), + m_para3GainModel(0.f, -18, 18, 0.001f, this, tr("Peak 3 gain")), + m_para4GainModel(0.f, -18, 18, 0.001f, this, tr("Peak 4 gain")), + m_highShelfGainModel(0.f, -18, 18, 0.001f, this, tr("High-shelf gain")), + m_hpResModel(0.707f,0.003f, 10.f, 0.001f, this, tr("HP res")), + m_lowShelfResModel(0.707f, 0.55f, 10.f, 0.001f, this, tr("Low-shelf res")), + m_para1BwModel(0.3f, 0.1f, 4, 0.001f, this, tr("Peak 1 BW")), + m_para2BwModel(0.3f, 0.1f, 4, 0.001f, this, tr("Peak 2 BW")), + m_para3BwModel(0.3f, 0.1f, 4, 0.001f, this, tr("Peak 3 BW")), + m_para4BwModel(0.3f, 0.1f, 4, 0.001f, this, tr("Peak 4 BW")), + m_highShelfResModel(0.707f, 0.55f, 10.f, 0.001f, this, tr("High-shelf res")), + m_lpResModel(0.707f,0.003f, 10.f, 0.001f, this, tr("LP res")), + m_hpFeqModel(31.f, 20.f, 20000, 0.001f, this, tr("HP freq")), + m_lowShelfFreqModel(80.f, 20.f, 20000, 0.001f, this, tr("Low-shelf freq")), + m_para1FreqModel(120.f, 20.f, 20000, 0.001f, this, tr("Peak 1 freq")), + m_para2FreqModel(250.f, 20.f, 20000, 0.001f, this, tr("Peak 2 freq")), + m_para3FreqModel(2000.f, 20.f, 20000, 0.001f, this, tr("Peak 3 freq")), + m_para4FreqModel(4000.f, 20.f, 20000, 0.001f, this, tr("Peak 4 freq")), + m_highShelfFreqModel(12000.f, 20.f, 20000, 0.001f, this, tr("High-shelf freq")), + m_lpFreqModel(18000.f, 20.f, 20000, 0.001f, this, tr("LP freq")), m_hpActiveModel( false, this , tr( "HP active" ) ), m_lowShelfActiveModel( false, this , tr( "Low-shelf active" ) ), m_para1ActiveModel( false, this , tr( "Peak 1 active" ) ), diff --git a/plugins/Eq/EqCurve.cpp b/plugins/Eq/EqCurve.cpp index e1d28ca0a..fcf78609b 100644 --- a/plugins/Eq/EqCurve.cpp +++ b/plugins/Eq/EqCurve.cpp @@ -581,17 +581,8 @@ void EqHandle::wheelEvent( QGraphicsSceneWheelEvent *wevent ) if( wevent->orientation() == Qt::Vertical ) { - m_resonance = m_resonance + ( numSteps ); + m_resonance = std::clamp(m_resonance + numSteps, 0.1f, highestBandwich); - if( m_resonance < 0.1 ) - { - m_resonance = 0.1; - } - - if( m_resonance > highestBandwich ) - { - m_resonance = highestBandwich; - } emit positionChanged(); } wevent->accept(); diff --git a/plugins/Eq/EqFader.h b/plugins/Eq/EqFader.h index d8897af5c..3185d0879 100644 --- a/plugins/Eq/EqFader.h +++ b/plugins/Eq/EqFader.h @@ -67,7 +67,7 @@ private slots: { const float opl = getPeak_L(); const float opr = getPeak_R(); - const float fallOff = 1.07; + const float fallOff = 1.07f; if( *m_lPeak > opl ) { setPeak_L( *m_lPeak ); diff --git a/plugins/Eq/EqSpectrumView.cpp b/plugins/Eq/EqSpectrumView.cpp index f91b3ebc3..427fff796 100644 --- a/plugins/Eq/EqSpectrumView.cpp +++ b/plugins/Eq/EqSpectrumView.cpp @@ -49,10 +49,10 @@ EqAnalyser::EqAnalyser() : //initialize Blackman-Harris window, constants taken from //https://en.wikipedia.org/wiki/Window_function#A_list_of_window_functions - const float a0 = 0.35875; - const float a1 = 0.48829; - const float a2 = 0.14128; - const float a3 = 0.01168; + const float a0 = 0.35875f; + const float a1 = 0.48829f; + const float a2 = 0.14128f; + const float a3 = 0.01168f; for (int i = 0; i < FFT_BUFFER_SIZE; i++) { @@ -230,7 +230,7 @@ void EqSpectrumView::paintEvent(QPaintEvent *event) float *bands = m_analyser->m_bands; m_path.moveTo( 0, height() ); m_peakSum = 0; - const float fallOff = 1.07; + const float fallOff = 1.07f; for( int x = 0; x < MAX_BANDS; ++x, ++bands ) { float peak = *bands != 0. ? (fh * 2.0 / 3.0 * (20. * log10(*bands / energy) - LOWER_Y) / (-LOWER_Y)) : 0.; @@ -305,4 +305,4 @@ void EqSpectrumView::periodicalUpdate() } // namespace gui -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/plugins/Flanger/FlangerControls.cpp b/plugins/Flanger/FlangerControls.cpp index 5550cdfb7..c5606380c 100644 --- a/plugins/Flanger/FlangerControls.cpp +++ b/plugins/Flanger/FlangerControls.cpp @@ -36,12 +36,12 @@ namespace lmms FlangerControls::FlangerControls( FlangerEffect *effect ) : EffectControls ( effect ), m_effect ( effect ), - m_delayTimeModel(0.001, 0.0001, 0.050, 0.0001, this, tr( "Delay samples" ) ), - m_lfoFrequencyModel( 0.25, 0.01, 60, 0.0001, 60000.0, this, tr( "LFO frequency" ) ), - m_lfoAmountModel( 0.0, 0.0, 0.0025, 0.0001, this, tr( "Amount" ) ), - m_lfoPhaseModel( 90.0, 0.0, 360.0, 0.0001, this, tr( "Stereo phase" ) ), - m_feedbackModel( 0.0, -1.0, 1.0, 0.0001, this, tr( "Feedback" ) ), - m_whiteNoiseAmountModel( 0.0, 0.0, 0.05, 0.0001, this, tr( "Noise" ) ), + m_delayTimeModel(0.001f, 0.0001f, 0.050f, 0.0001f, this, tr("Delay samples")), + m_lfoFrequencyModel(0.25f, 0.01f, 60, 0.0001f, 60000.f, this, tr("LFO frequency")), + m_lfoAmountModel(0.f, 0.f, 0.0025f, 0.0001f, this, tr("Amount")), + m_lfoPhaseModel(90.f, 0.f, 360.f, 0.0001f, this, tr("Stereo phase")), + m_feedbackModel(0.f, -1.f, 1.f, 0.0001f, this, tr("Feedback")), + m_whiteNoiseAmountModel(0.f, 0.f, 0.05f, 0.0001f, this, tr("Noise")), m_invertFeedbackModel ( false, this, tr( "Invert" ) ) { diff --git a/plugins/Flanger/MonoDelay.cpp b/plugins/Flanger/MonoDelay.cpp index 3ec028968..269b77323 100644 --- a/plugins/Flanger/MonoDelay.cpp +++ b/plugins/Flanger/MonoDelay.cpp @@ -32,9 +32,9 @@ namespace lmms MonoDelay::MonoDelay( int maxTime , int sampleRate ) { m_buffer = 0; - m_maxTime = maxTime; + m_maxTime = static_cast(maxTime); m_maxLength = maxTime * sampleRate; - m_length = m_maxLength; + m_length = static_cast(m_maxLength); m_writeIndex = 0; m_feedback = 0.0f; @@ -57,7 +57,7 @@ MonoDelay::~MonoDelay() void MonoDelay::tick( sample_t* sample ) { m_writeIndex = ( m_writeIndex + 1 ) % ( int )m_maxLength; - int readIndex = m_writeIndex - m_length; + int readIndex = m_writeIndex - static_cast(m_length); if (readIndex < 0 ) { readIndex += m_maxLength; } float out = m_buffer[ readIndex ]; m_buffer[ m_writeIndex ] = *sample + ( out * m_feedback ); diff --git a/plugins/LOMM/LOMM.cpp b/plugins/LOMM/LOMM.cpp index bffcfb9cb..e24171cea 100644 --- a/plugins/LOMM/LOMM.cpp +++ b/plugins/LOMM/LOMM.cpp @@ -57,8 +57,8 @@ LOMMEffect::LOMMEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* m_hp2(m_sampleRate), m_ap(m_sampleRate), m_needsUpdate(true), - m_coeffPrecalc(-0.05), - m_crestTimeConst(0.999), + m_coeffPrecalc(-0.05f), + m_crestTimeConst(0.999f), m_lookWrite(0), m_lookBufLength(2) { @@ -111,7 +111,7 @@ bool LOMMEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames) { m_lp1.setLowpass(m_lommControls.m_split1Model.value()); m_hp1.setHighpass(m_lommControls.m_split1Model.value()); - m_ap.calcFilterCoeffs(m_lommControls.m_split1Model.value(), 0.70710678118); + m_ap.calcFilterCoeffs(m_lommControls.m_split1Model.value(), 0.70710678118f); } if (m_needsUpdate || m_lommControls.m_split2Model.isValueChanged()) { diff --git a/plugins/LOMM/LOMM.h b/plugins/LOMM/LOMM.h index 196d0a09d..9e03dc343 100644 --- a/plugins/LOMM/LOMM.h +++ b/plugins/LOMM/LOMM.h @@ -35,7 +35,7 @@ namespace lmms { -constexpr inline float LOMM_MIN_FLOOR = 0.00012589;// -72 dBFS +constexpr inline float LOMM_MIN_FLOOR = 0.00012589f;// -72 dBFS constexpr inline float LOMM_MAX_LOOKAHEAD = 20.f; constexpr inline float LOMM_AUTO_TIME_ADJUST = 5.f; diff --git a/plugins/LOMM/LOMMControls.cpp b/plugins/LOMM/LOMMControls.cpp index d695cf483..3ede0ddf2 100644 --- a/plugins/LOMM/LOMMControls.cpp +++ b/plugins/LOMM/LOMMControls.cpp @@ -35,55 +35,55 @@ namespace lmms LOMMControls::LOMMControls(LOMMEffect* effect) : EffectControls(effect), m_effect(effect), - m_depthModel(0.4, 0, 1, 0.00001, this, tr("Depth")), - m_timeModel(1, 0, 10, 0.00001, this, tr("Time")), - m_inVolModel(0, -48, 48, 0.00001, this, tr("Input Volume")), - m_outVolModel(8, -48, 48, 0.00001, this, tr("Output Volume")), - m_upwardModel(1, 0, 2, 0.00001, this, tr("Upward Depth")), - m_downwardModel(1, 0, 2, 0.00001, this, tr("Downward Depth")), - m_split1Model(2500, 20, 20000, 0.01, this, tr("High/Mid Split")), - m_split2Model(88.3, 20, 20000, 0.01, this, tr("Mid/Low Split")), + m_depthModel(0.4f, 0, 1, 0.00001f, this, tr("Depth")), + m_timeModel(1, 0, 10, 0.00001f, this, tr("Time")), + m_inVolModel(0, -48, 48, 0.00001f, this, tr("Input Volume")), + m_outVolModel(8, -48, 48, 0.00001f, this, tr("Output Volume")), + m_upwardModel(1, 0, 2, 0.00001f, this, tr("Upward Depth")), + m_downwardModel(1, 0, 2, 0.00001f, this, tr("Downward Depth")), + m_split1Model(2500, 20, 20000, 0.01f, this, tr("High/Mid Split")), + m_split2Model(88.3f, 20, 20000, 0.01f, this, tr("Mid/Low Split")), m_split1EnabledModel(true, this, tr("Enable High/Mid Split")), m_split2EnabledModel(true, this, tr("Enable Mid/Low Split")), m_band1EnabledModel(true, this, tr("Enable High Band")), m_band2EnabledModel(true, this, tr("Enable Mid Band")), m_band3EnabledModel(true, this, tr("Enable Low Band")), - m_inHighModel(0, -48, 48, 0.00001, this, tr("High Input Volume")), - m_inMidModel(0, -48, 48, 0.00001, this, tr("Mid Input Volume")), - m_inLowModel(0, -48, 48, 0.00001, this, tr("Low Input Volume")), - m_outHighModel(4.6, -48, 48, 0.00001, this, tr("High Output Volume")), - m_outMidModel(0.0, -48, 48, 0.00001, this, tr("Mid Output Volume")), - m_outLowModel(4.6, -48, 48, 0.00001, this, tr("Low Output Volume")), - m_aThreshHModel(-30.3, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001, this, tr("Above Threshold High")), - m_aThreshMModel(-25.0, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001, this, tr("Above Threshold Mid")), - m_aThreshLModel(-28.6, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001, this, tr("Above Threshold Low")), - m_aRatioHModel(99.99, 1, 99.99, 0.01, this, tr("Above Ratio High")), - m_aRatioMModel(66.7, 1, 99.99, 0.01, this, tr("Above Ratio Mid")), - m_aRatioLModel(66.7, 1, 99.99, 0.01, this, tr("Above Ratio Low")), - m_bThreshHModel(-35.6, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001, this, tr("Below Threshold High")), - m_bThreshMModel(-36.6, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001, this, tr("Below Threshold Mid")), - m_bThreshLModel(-35.6, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001, this, tr("Below Threshold Low")), - m_bRatioHModel(4.17, 1, 99.99, 0.01, this, tr("Below Ratio High")), - m_bRatioMModel(4.17, 1, 99.99, 0.01, this, tr("Below Ratio Mid")), - m_bRatioLModel(4.17, 1, 99.99, 0.01, this, tr("Below Ratio Low")), - m_atkHModel(13.5, 0, 1000, 0.001, this, tr("Attack High")), - m_atkMModel(22.4, 0, 1000, 0.001, this, tr("Attack Mid")), - m_atkLModel(47.8, 0, 1000, 0.001, this, tr("Attack Low")), - m_relHModel(132, 0, 1000, 0.001, this, tr("Release High")), - m_relMModel(282, 0, 1000, 0.001, this, tr("Release Mid")), - m_relLModel(282, 0, 1000, 0.001, this, tr("Release Low")), - m_rmsTimeModel(10, 0, 500, 0.001, this, tr("RMS Time")), - m_kneeModel(6, 0, 36, 0.00001, this, tr("Knee")), - m_rangeModel(36, 0, 96, 0.00001, this, tr("Range")), - m_balanceModel(0, -18, 18, 0.00001, this, tr("Balance")), + m_inHighModel(0, -48, 48, 0.00001f, this, tr("High Input Volume")), + m_inMidModel(0, -48, 48, 0.00001f, this, tr("Mid Input Volume")), + m_inLowModel(0, -48, 48, 0.00001f, this, tr("Low Input Volume")), + m_outHighModel(4.6f, -48, 48, 0.00001f, this, tr("High Output Volume")), + m_outMidModel(0.f, -48, 48, 0.00001f, this, tr("Mid Output Volume")), + m_outLowModel(4.6f, -48, 48, 0.00001f, this, tr("Low Output Volume")), + m_aThreshHModel(-30.3f, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001f, this, tr("Above Threshold High")), + m_aThreshMModel(-25.f, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001f, this, tr("Above Threshold Mid")), + m_aThreshLModel(-28.6f, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001f, this, tr("Above Threshold Low")), + m_aRatioHModel(99.99f, 1, 99.99f, 0.01f, this, tr("Above Ratio High")), + m_aRatioMModel(66.7f, 1, 99.99f, 0.01f, this, tr("Above Ratio Mid")), + m_aRatioLModel(66.7f, 1, 99.99f, 0.01f, this, tr("Above Ratio Low")), + m_bThreshHModel(-35.6f, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001f, this, tr("Below Threshold High")), + m_bThreshMModel(-36.6f, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001f, this, tr("Below Threshold Mid")), + m_bThreshLModel(-35.6f, LOMM_DISPLAY_MIN, LOMM_DISPLAY_MAX, 0.001f, this, tr("Below Threshold Low")), + m_bRatioHModel(4.17f, 1, 99.99f, 0.01f, this, tr("Below Ratio High")), + m_bRatioMModel(4.17f, 1, 99.99f, 0.01f, this, tr("Below Ratio Mid")), + m_bRatioLModel(4.17f, 1, 99.99f, 0.01f, this, tr("Below Ratio Low")), + m_atkHModel(13.5f, 0, 1000, 0.001f, this, tr("Attack High")), + m_atkMModel(22.4f, 0, 1000, 0.001f, this, tr("Attack Mid")), + m_atkLModel(47.8f, 0, 1000, 0.001f, this, tr("Attack Low")), + m_relHModel(132, 0, 1000, 0.001f, this, tr("Release High")), + m_relMModel(282, 0, 1000, 0.001f, this, tr("Release Mid")), + m_relLModel(282, 0, 1000, 0.001f, this, tr("Release Low")), + m_rmsTimeModel(10, 0, 500, 0.001f, this, tr("RMS Time")), + m_kneeModel(6, 0, 36, 0.00001f, this, tr("Knee")), + m_rangeModel(36, 0, 96, 0.00001f, this, tr("Range")), + m_balanceModel(0, -18, 18, 0.00001f, this, tr("Balance")), m_depthScalingModel(true, this, tr("Scale output volume with Depth")), m_stereoLinkModel(false, this, tr("Stereo Link")), - m_autoTimeModel(0, 0, 1, 0.00001, this, tr("Auto Time")), - m_mixModel(1, 0, 1, 0.00001, this, tr("Mix")), + m_autoTimeModel(0, 0, 1, 0.00001f, this, tr("Auto Time")), + m_mixModel(1, 0, 1, 0.00001f, this, tr("Mix")), m_feedbackModel(false, this, tr("Feedback")), m_midsideModel(false, this, tr("Mid/Side")), m_lookaheadEnableModel(false, this, tr("Lookahead")), - m_lookaheadModel(0.f, 0.f, LOMM_MAX_LOOKAHEAD, 0.01, this, tr("Lookahead Length")), + m_lookaheadModel(0.f, 0.f, LOMM_MAX_LOOKAHEAD, 0.01f, this, tr("Lookahead Length")), m_lowSideUpwardSuppressModel(false, this, tr("Suppress upward compression for side band")) { auto models = {&m_timeModel, &m_inVolModel, &m_outVolModel, &m_inHighModel, &m_inMidModel, diff --git a/plugins/Lb302/Lb302.cpp b/plugins/Lb302/Lb302.cpp index 5dfbd5992..17c9b7424 100644 --- a/plugins/Lb302/Lb302.cpp +++ b/plugins/Lb302/Lb302.cpp @@ -209,7 +209,7 @@ Lb302Filter3Pole::Lb302Filter3Pole(Lb302FilterKnobState *p_fs) : void Lb302Filter3Pole::recalc() { // DO NOT CALL BASE CLASS - vcf_e0 = 0.000001; + vcf_e0 = 0.000001f; vcf_e1 = 1.0; } @@ -291,7 +291,7 @@ Lb302Synth::Lb302Synth( InstrumentTrack * _instrumentTrack ) : accentToggle( false, this, tr( "Accent" ) ), deadToggle( false, this, tr( "Dead" ) ), db24Toggle( false, this, tr( "24dB/oct Filter" ) ), - vca_attack(1.0 - 0.96406088), + vca_attack(1.f - 0.96406088f), vca_a0(0.5), vca_a(0.), vca_mode(VcaMode::NeverPlayed) diff --git a/plugins/Monstro/Monstro.cpp b/plugins/Monstro/Monstro.cpp index 469b2da21..4278b7cdb 100644 --- a/plugins/Monstro/Monstro.cpp +++ b/plugins/Monstro/Monstro.cpp @@ -865,31 +865,31 @@ inline sample_t MonstroSynth::calcSlope( int slope, sample_t s ) MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &monstro_plugin_descriptor ), - m_osc1Vol( 33.0, 0.0, 200.0, 0.1, this, tr( "Osc 1 volume" ) ), - m_osc1Pan( 0.0, -100.0, 100.0, 0.1, this, tr( "Osc 1 panning" ) ), + m_osc1Vol(33.f, 0.f, 200.f, 0.1f, this, tr("Osc 1 volume")), + m_osc1Pan(0.f, -100.f, 100.f, 0.1f, this, tr("Osc 1 panning")), m_osc1Crs( 0.0, -24.0, 24.0, 1.0, this, tr( "Osc 1 coarse detune" ) ), m_osc1Ftl( 0.0, -100.0, 100.0, 1.0, this, tr( "Osc 1 fine detune left" ) ), m_osc1Ftr( 0.0, -100.0, 100.0, 1.0, this, tr( "Osc 1 fine detune right" ) ), - m_osc1Spo( 0.0, -180.0, 180.0, 0.1, this, tr( "Osc 1 stereo phase offset" ) ), - m_osc1Pw( 50.0, PW_MIN, PW_MAX, 0.01, this, tr( "Osc 1 pulse width" ) ), + m_osc1Spo(0.f, -180.f, 180.f, 0.1f, this, tr("Osc 1 stereo phase offset")), + m_osc1Pw(50.f, PW_MIN, PW_MAX, 0.01f, this, tr("Osc 1 pulse width")), m_osc1SSR( false, this, tr( "Osc 1 sync send on rise" ) ), m_osc1SSF( false, this, tr( "Osc 1 sync send on fall" ) ), - m_osc2Vol( 33.0, 0.0, 200.0, 0.1, this, tr( "Osc 2 volume" ) ), - m_osc2Pan( 0.0, -100.0, 100.0, 0.1, this, tr( "Osc 2 panning" ) ), + m_osc2Vol(33.f, 0.f, 200.f, 0.1f, this, tr("Osc 2 volume")), + m_osc2Pan(0.f, -100.f, 100.f, 0.1f, this, tr("Osc 2 panning")), m_osc2Crs( 0.0, -24.0, 24.0, 1.0, this, tr( "Osc 2 coarse detune" ) ), m_osc2Ftl( 0.0, -100.0, 100.0, 1.0, this, tr( "Osc 2 fine detune left" ) ), m_osc2Ftr( 0.0, -100.0, 100.0, 1.0, this, tr( "Osc 2 fine detune right" ) ), - m_osc2Spo( 0.0, -180.0, 180.0, 0.1, this, tr( "Osc 2 stereo phase offset" ) ), + m_osc2Spo(0.f, -180.f, 180.f, 0.1f, this, tr("Osc 2 stereo phase offset")), m_osc2Wave( this, tr( "Osc 2 waveform" ) ), m_osc2SyncH( false, this, tr( "Osc 2 sync hard" ) ), m_osc2SyncR( false, this, tr( "Osc 2 sync reverse" ) ), - m_osc3Vol( 33.0, 0.0, 200.0, 0.1, this, tr( "Osc 3 volume" ) ), - m_osc3Pan( 0.0, -100.0, 100.0, 0.1, this, tr( "Osc 3 panning" ) ), + m_osc3Vol(33.f, 0.f, 200.f, 0.1f, this, tr("Osc 3 volume")), + m_osc3Pan(0.f, -100.f, 100.f, 0.1f, this, tr("Osc 3 panning")), m_osc3Crs( 0.0, -24.0, 24.0, 1.0, this, tr( "Osc 3 coarse detune" ) ), - m_osc3Spo( 0.0, -180.0, 180.0, 0.1, this, tr( "Osc 3 Stereo phase offset" ) ), - m_osc3Sub( 0.0, -100.0, 100.0, 0.1, this, tr( "Osc 3 sub-oscillator mix" ) ), + m_osc3Spo(0.f, -180.f, 180.f, 0.1f, this, tr("Osc 3 Stereo phase offset")), + m_osc3Sub(0.f, -100.f, 100.f, 0.1f, this, tr("Osc 3 sub-oscillator mix")), m_osc3Wave1( this, tr( "Osc 3 waveform 1" ) ), m_osc3Wave2( this, tr( "Osc 3 waveform 2" ) ), m_osc3SyncH( false, this, tr( "Osc 3 sync hard" ) ), @@ -897,13 +897,13 @@ MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) : m_lfo1Wave( this, tr( "LFO 1 waveform" ) ), m_lfo1Att( 0.0f, 0.0f, 2000.0f, 1.0f, 2000.0f, this, tr( "LFO 1 attack" ) ), - m_lfo1Rate( 1.0f, 0.1, 10000.0, 0.1, 10000.0f, this, tr( "LFO 1 rate" ) ), - m_lfo1Phs( 0.0, -180.0, 180.0, 0.1, this, tr( "LFO 1 phase" ) ), + m_lfo1Rate(1.0f, 0.1f, 10000.f, 0.1f, 10000.0f, this, tr("LFO 1 rate")), + m_lfo1Phs(0.f, -180.f, 180.f, 0.1f, this, tr("LFO 1 phase")), m_lfo2Wave( this, tr( "LFO 2 waveform" ) ), m_lfo2Att( 0.0f, 0.0f, 2000.0f, 1.0f, 2000.0f, this, tr( "LFO 2 attack" ) ), - m_lfo2Rate( 1.0f, 0.1, 10000.0, 0.1, 10000.0f, this, tr( "LFO 2 rate" ) ), - m_lfo2Phs( 0.0, -180.0, 180.0, 0.1, this, tr( "LFO 2 phase" ) ), + m_lfo2Rate(1.0f, 0.1f, 10000.f, 0.1f, 10000.0f, this, tr("LFO 2 rate")), + m_lfo2Phs(0.0, -180.f, 180.f, 0.1f, this, tr("LFO 2 phase")), m_env1Pre( 0.0f, 0.0f, 2000.0f, 1.0f, 2000.0f, this, tr( "Env 1 pre-delay" ) ), m_env1Att( 0.0f, 0.0f, 2000.0f, 1.0f, 2000.0f, this, tr( "Env 1 attack" ) ), diff --git a/plugins/Nes/Nes.h b/plugins/Nes/Nes.h index 39e0a6719..e65cb3b13 100644 --- a/plugins/Nes/Nes.h +++ b/plugins/Nes/Nes.h @@ -60,22 +60,22 @@ namespace lmms { -const float NES_SIMPLE_FILTER = 1.0 / 20.0; // simulate nes analog audio output +const float NES_SIMPLE_FILTER = 1.f / 20.f; // simulate nes analog audio output const float NFB = 895000.0f; const float NOISE_FREQS[16] = { NFB/5, NFB/9, NFB/17, NFB/33, NFB/65, NFB/97, NFB/129, NFB/161, NFB/193, NFB/255, NFB/381, NFB/509, NFB/763, NFB/1017, NFB/2035, NFB/4069 }; const uint16_t LFSR_INIT = 1; const float DUTY_CYCLE[4] = { 0.125, 0.25, 0.5, 0.75 }; -const float DITHER_AMP = 1.0 / 60.0; +const float DITHER_AMP = 1.f / 60.f; const float MIN_FREQ = 10.0; const int TRIANGLE_WAVETABLE[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; const float NES_DIST = 0.9f; // simulate the slight nonlinear distortion in nes audio output -const float NES_MIXING_12 = 1.0 / 20.0; -const float NES_MIXING_34 = 1.0 / 12.0; -const float NES_MIXING_ALL = 1.0 / ( NES_MIXING_12 + NES_MIXING_34 ); // constants to simulate the hardwired mixing values for nes channels +const float NES_MIXING_12 = 1.f / 20.f; +const float NES_MIXING_34 = 1.f / 12.f; +const float NES_MIXING_ALL = 1.f / (NES_MIXING_12 + NES_MIXING_34); // constants to simulate the hardwired mixing values for nes channels const int MIN_WLEN = 4; diff --git a/plugins/OpulenZ/OpulenZ.cpp b/plugins/OpulenZ/OpulenZ.cpp index 607d40883..3c6004477 100644 --- a/plugins/OpulenZ/OpulenZ.cpp +++ b/plugins/OpulenZ/OpulenZ.cpp @@ -770,15 +770,15 @@ void OpulenzInstrumentView::updateKnobHints() // Envelope times in ms: t[0] = 0, t[n] = ( 1<{ - 0.0, 0.2, 0.4, 0.9, 1.8, 3.7, 7.4, - 15.0, 30.0, 60.0, 120.0, 240.0, 480.0, - 950.0, 1900.0, 3800.0 + 0.f, 0.2f, 0.4f, 0.9f, 1.8f, 3.7f, 7.4f, + 15.f, 30.f, 60.f, 120.f, 240.f, 480.f, + 950.f, 1900.f, 3800.f }; const auto dr_times = std::array{ - 0.0, 1.2, 2.5, 5.0, 10.0, 20.0, 40.0, - 80.0, 160.0, 320.0, 640.0, 1300.0, 2600.0, - 5200.0, 10000.0, 20000.0 + 0.f, 1.2f, 2.5f, 5.f, 10.f, 20.f, 40.f, + 80.f, 160.f, 320.f, 640.f, 1300.f, 2600.f, + 5200.f, 10000.f, 20000.f }; const auto fmultipliers = std::array{ diff --git a/plugins/PeakControllerEffect/PeakControllerEffectControls.cpp b/plugins/PeakControllerEffect/PeakControllerEffectControls.cpp index 070c9fbb8..0060b535b 100644 --- a/plugins/PeakControllerEffect/PeakControllerEffectControls.cpp +++ b/plugins/PeakControllerEffect/PeakControllerEffectControls.cpp @@ -38,14 +38,14 @@ PeakControllerEffectControls:: PeakControllerEffectControls( PeakControllerEffect * _eff ) : EffectControls( _eff ), m_effect( _eff ), - m_baseModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Base value" ) ), - m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Modulation amount" ) ), - m_attackModel( 0, 0, 0.999, 0.001, this, tr( "Attack" ) ), - m_decayModel( 0, 0, 0.999, 0.001, this, tr( "Release" ) ), - m_tresholdModel( 0, 0, 1.0, 0.001, this, tr( "Treshold" ) ), + m_baseModel(0.5f, 0.f, 1.f, 0.001f, this, tr("Base value")), + m_amountModel(1.f, -1.f, 1.f, 0.005f, this, tr("Modulation amount")), + m_attackModel(0, 0, 0.999f, 0.001f, this, tr("Attack")), + m_decayModel(0, 0, 0.999f, 0.001f, this, tr("Release")), + m_tresholdModel(0, 0, 1.f, 0.001f, this, tr("Treshold")), m_muteModel( false, this, tr( "Mute output" ) ), m_absModel( true, this, tr("Absolute value") ), - m_amountMultModel( 1.0, 0, 32, 0.2, this, tr("Amount multiplicator") ) + m_amountMultModel(1.f, 0, 32, 0.2f, this, tr("Amount multiplicator")) { } diff --git a/plugins/ReverbSC/dcblock.c b/plugins/ReverbSC/dcblock.c index f38bb73dc..2c8d86950 100644 --- a/plugins/ReverbSC/dcblock.c +++ b/plugins/ReverbSC/dcblock.c @@ -33,7 +33,7 @@ int sp_dcblock_init(sp_data *sp, sp_dcblock *p, int oversampling ) p->inputs = 0.0; p->gain = pow( 0.99, 1.0f / oversampling ); if (p->gain == 0.0 || p->gain>=1.0 || p->gain<=-1.0) - p->gain = 0.99; + p->gain = 0.99f; return SP_OK; } diff --git a/plugins/ReverbSC/revsc.c b/plugins/ReverbSC/revsc.c index d9808963f..54db9a4db 100644 --- a/plugins/ReverbSC/revsc.c +++ b/plugins/ReverbSC/revsc.c @@ -16,7 +16,7 @@ #include "base.h" #include "revsc.h" -#define DEFAULT_SRATE 44100.0 +#define DEFAULT_SRATE 44100.f #define MIN_SRATE 5000.0 #define MAX_SRATE 1000000.0 #define MAX_PITCHMOD 20.0 @@ -34,20 +34,20 @@ /* reverbParams[n][3] = random seed (0 - 32767) */ static const SPFLOAT reverbParams[8][4] = { - { (2473.0 / DEFAULT_SRATE), 0.0010, 3.100, 1966.0 }, - { (2767.0 / DEFAULT_SRATE), 0.0011, 3.500, 29491.0 }, - { (3217.0 / DEFAULT_SRATE), 0.0017, 1.110, 22937.0 }, - { (3557.0 / DEFAULT_SRATE), 0.0006, 3.973, 9830.0 }, - { (3907.0 / DEFAULT_SRATE), 0.0010, 2.341, 20643.0 }, - { (4127.0 / DEFAULT_SRATE), 0.0011, 1.897, 22937.0 }, - { (2143.0 / DEFAULT_SRATE), 0.0017, 0.891, 29491.0 }, - { (1933.0 / DEFAULT_SRATE), 0.0006, 3.221, 14417.0 } + { (2473.f / DEFAULT_SRATE), 0.0010f, 3.100f, 1966.f }, + { (2767.f / DEFAULT_SRATE), 0.0011f, 3.500f, 29491.f }, + { (3217.f / DEFAULT_SRATE), 0.0017f, 1.110f, 22937.f }, + { (3557.f / DEFAULT_SRATE), 0.0006f, 3.973f, 9830.f }, + { (3907.f / DEFAULT_SRATE), 0.0010f, 2.341f, 20643.f }, + { (4127.f / DEFAULT_SRATE), 0.0011f, 1.897f, 22937.f }, + { (2143.f / DEFAULT_SRATE), 0.0017f, 0.891f, 29491.f }, + { (1933.f / DEFAULT_SRATE), 0.0006f, 3.221f, 14417.f } }; static int delay_line_max_samples(SPFLOAT sr, SPFLOAT iPitchMod, int n); static int init_delay_line(sp_revsc *p, sp_revsc_dl *lp, int n); static int delay_line_bytes_alloc(SPFLOAT sr, SPFLOAT iPitchMod, int n); -static const SPFLOAT outputGain = 0.35; +static const SPFLOAT outputGain = 0.35f; static const SPFLOAT jpScale = 0.25; int sp_revsc_create(sp_revsc **p){ *p = malloc(sizeof(sp_revsc)); @@ -56,9 +56,9 @@ int sp_revsc_create(sp_revsc **p){ int sp_revsc_init(sp_data *sp, sp_revsc *p) { - p->iSampleRate = sp->sr; - p->sampleRate = sp->sr; - p->feedback = 0.97; + p->iSampleRate = (float) sp->sr; + p->sampleRate = (float) sp->sr; + p->feedback = 0.97f; p->lpfreq = 10000; p->iPitchMod = 1; p->iSkipInit = 0; @@ -67,14 +67,14 @@ int sp_revsc_init(sp_data *sp, sp_revsc *p) p->initDone = 1; int i, nBytes = 0; for(i = 0; i < 8; i++){ - nBytes += delay_line_bytes_alloc(sp->sr, 1, i); + nBytes += delay_line_bytes_alloc((float) sp->sr, 1, i); } sp_auxdata_alloc(&p->aux, nBytes); nBytes = 0; for (i = 0; i < 8; i++) { p->delayLines[i].buf = (SPFLOAT*) (((char*) p->aux.ptr) + nBytes); init_delay_line(p, &p->delayLines[i], i); - nBytes += delay_line_bytes_alloc(sp->sr, 1, i); + nBytes += delay_line_bytes_alloc((float) sp->sr, 1, i); } return SP_OK; @@ -217,7 +217,7 @@ int sp_revsc_compute(sp_data *sp, sp_revsc *p, SPFLOAT *in1, SPFLOAT *in2, SPFLO /* calculate interpolation coefficients */ - a2 = frac * frac; a2 -= 1.0; a2 *= (1.0 / 6.0); + a2 = frac * frac; a2 -= 1.0; a2 *= (1.f / 6.f); a1 = frac; a1 += 1.0; a1 *= 0.5; am1 = a1 - 1.0; a0 = 3.0 * a2; a1 -= a0; am1 -= a2; a0 -= frac; diff --git a/plugins/Sf2Player/Sf2Player.cpp b/plugins/Sf2Player/Sf2Player.cpp index dd544dcf4..c2a9eca98 100644 --- a/plugins/Sf2Player/Sf2Player.cpp +++ b/plugins/Sf2Player/Sf2Player.cpp @@ -136,14 +136,14 @@ Sf2Instrument::Sf2Instrument( InstrumentTrack * _instrument_track ) : m_gain( 1.0f, 0.0f, 5.0f, 0.01f, this, tr( "Gain" ) ), m_reverbOn( false, this, tr( "Reverb" ) ), m_reverbRoomSize( FLUID_REVERB_DEFAULT_ROOMSIZE, 0, 1.0, 0.01f, this, tr( "Reverb room size" ) ), - m_reverbDamping( FLUID_REVERB_DEFAULT_DAMP, 0, 1.0, 0.01, this, tr( "Reverb damping" ) ), + m_reverbDamping(FLUID_REVERB_DEFAULT_DAMP, 0, 1.f, 0.01f, this, tr("Reverb damping")), m_reverbWidth( FLUID_REVERB_DEFAULT_WIDTH, 0, 1.0, 0.01f, this, tr( "Reverb width" ) ), m_reverbLevel( FLUID_REVERB_DEFAULT_LEVEL, 0, 1.0, 0.01f, this, tr( "Reverb level" ) ), m_chorusOn( false, this, tr( "Chorus" ) ), m_chorusNum( FLUID_CHORUS_DEFAULT_N, 0, 10.0, 1.0, this, tr( "Chorus voices" ) ), - m_chorusLevel( FLUID_CHORUS_DEFAULT_LEVEL, 0, 10.0, 0.01, this, tr( "Chorus level" ) ), - m_chorusSpeed( FLUID_CHORUS_DEFAULT_SPEED, 0.29, 5.0, 0.01, this, tr( "Chorus speed" ) ), - m_chorusDepth( FLUID_CHORUS_DEFAULT_DEPTH, 0, 46.0, 0.05, this, tr( "Chorus depth" ) ) + m_chorusLevel(FLUID_CHORUS_DEFAULT_LEVEL, 0, 10.f, 0.01f, this, tr("Chorus level")), + m_chorusSpeed(FLUID_CHORUS_DEFAULT_SPEED, 0.29f, 5.f, 0.01f, this, tr("Chorus speed")), + m_chorusDepth(FLUID_CHORUS_DEFAULT_DEPTH, 0, 46.f, 0.05f, this, tr("Chorus depth")) { diff --git a/plugins/Sfxr/Sfxr.h b/plugins/Sfxr/Sfxr.h index 8af8984c9..1340cee5e 100644 --- a/plugins/Sfxr/Sfxr.h +++ b/plugins/Sfxr/Sfxr.h @@ -135,7 +135,7 @@ class SfxrZeroToOneFloatModel : public FloatModel { public: SfxrZeroToOneFloatModel( float val, Model * parent, const QString& displayName ): - FloatModel( val, 0.0, 1.0, 0.001, parent, displayName ) + FloatModel(val, 0.f, 1.f, 0.001f, parent, displayName) { } /* purpose: prevent the initial value of the model from being changed */ @@ -156,7 +156,7 @@ class SfxrNegPosOneFloatModel : public FloatModel { public: SfxrNegPosOneFloatModel(float val, Model * parent, const QString& displayName ): - FloatModel( val, -1.0, 1.0, 0.001, parent, displayName ) + FloatModel(val, -1.f, 1.f, 0.001f, parent, displayName) { } /* purpose: prevent the initial value of the model from being changed */ diff --git a/plugins/SlicerT/SlicerT.cpp b/plugins/SlicerT/SlicerT.cpp index 493dde6c3..d01cdfc36 100644 --- a/plugins/SlicerT/SlicerT.cpp +++ b/plugins/SlicerT/SlicerT.cpp @@ -197,7 +197,7 @@ void SlicerT::findSlices() int lastPoint = -minDist - 1; // to always store 0 first float spectralFlux = 0; - float prevFlux = 1E-10; // small value, no divison by zero + float prevFlux = 1E-10f; // small value, no divison by zero for (int i = 0; i < singleChannel.size() - windowSize; i += windowSize) { @@ -227,7 +227,7 @@ void SlicerT::findSlices() } prevFlux = spectralFlux; - spectralFlux = 1E-10; // again for no divison by zero + spectralFlux = 1E-10f; // again for no divison by zero } m_slicePoints.push_back(m_originalSample.sampleSize()); diff --git a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp index 7f73ed7cc..452e1e90f 100644 --- a/plugins/SpectrumAnalyzer/SaSpectrumView.cpp +++ b/plugins/SpectrumAnalyzer/SaSpectrumView.cpp @@ -742,7 +742,7 @@ std::vector> SaSpectrumView::makeLogAmpTics(int lo // Generate n dB increments, start checking at -90 dB. Limits are tweaked // just a little bit to make sure float comparisons do not miss edges. - for (float i = 0.000000001; 10 * log10(i) <= (high + 0.001); i *= increment) + for (float i = 0.000000001f; 10 * log10(i) <= (high + 0.001); i *= increment) { if (10 * log10(i) >= (low - 0.001)) { diff --git a/plugins/SpectrumAnalyzer/SaWaterfallView.cpp b/plugins/SpectrumAnalyzer/SaWaterfallView.cpp index 024c3aea4..5169a4b49 100644 --- a/plugins/SpectrumAnalyzer/SaWaterfallView.cpp +++ b/plugins/SpectrumAnalyzer/SaWaterfallView.cpp @@ -218,8 +218,7 @@ std::vector> SaWaterfallView::makeTimeTics() float limit = yPixelToTime(m_displayBottom, m_displayHeight); // set increment to about 30 pixels (but min. 0.1 s) - float increment = std::round(10 * limit / (m_displayHeight / 30)) / 10; - if (increment < 0.1) {increment = 0.1;} + const float increment = std::max(std::round(10 * limit / (m_displayHeight / 30)) / 10, 0.1f); // NOTE: labels positions are rounded to match the (rounded) label value for (float i = 0; i <= limit; i += increment) diff --git a/plugins/Stk/Mallets/Mallets.cpp b/plugins/Stk/Mallets/Mallets.cpp index 7f4548ba4..4a3068d1c 100644 --- a/plugins/Stk/Mallets/Mallets.cpp +++ b/plugins/Stk/Mallets/Mallets.cpp @@ -114,7 +114,7 @@ MalletsInstrument::MalletsInstrument( InstrumentTrack * _instrument_track ): // TubeBell m_presetsModel.addItem( tr( "Tubular bells" ) ); - m_scalers.append( 1.8 ); + m_scalers.append(1.8f); // BandedWG m_presetsModel.addItem( tr( "Uniform bar" ) ); diff --git a/src/common/SharedMemory.cpp b/src/common/SharedMemory.cpp index 470016530..19d3dba1b 100644 --- a/src/common/SharedMemory.cpp +++ b/src/common/SharedMemory.cpp @@ -132,9 +132,10 @@ private: namespace { -auto sizeToHighAndLow(std::size_t size) -> std::pair +template +auto sizeToHighAndLow(T size) -> std::pair { - if constexpr(sizeof(std::size_t) <= sizeof(DWORD)) { + if constexpr (sizeof(T) <= sizeof(DWORD)) { return {0, size}; } else { return {static_cast(size >> 32), static_cast(size)}; diff --git a/src/core/AutomationClip.cpp b/src/core/AutomationClip.cpp index 0e4271822..dc496fa04 100644 --- a/src/core/AutomationClip.cpp +++ b/src/core/AutomationClip.cpp @@ -189,7 +189,7 @@ const AutomatableModel * AutomationClip::firstObject() const return model; } - static FloatModel fm(0, DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, 0.001); + static FloatModel fm(0, DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, 0.001f); return &fm; } diff --git a/src/core/EnvelopeAndLfoParameters.cpp b/src/core/EnvelopeAndLfoParameters.cpp index 861a62b51..9c0a4596a 100644 --- a/src/core/EnvelopeAndLfoParameters.cpp +++ b/src/core/EnvelopeAndLfoParameters.cpp @@ -97,13 +97,13 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters( Model * _parent ) : Model( _parent ), m_used( false ), - m_predelayModel( 0.0, 0.0, 2.0, 0.001, this, tr( "Env pre-delay" ) ), - m_attackModel( 0.0, 0.0, 2.0, 0.001, this, tr( "Env attack" ) ), - m_holdModel( 0.5, 0.0, 2.0, 0.001, this, tr( "Env hold" ) ), - m_decayModel( 0.5, 0.0, 2.0, 0.001, this, tr( "Env decay" ) ), - m_sustainModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Env sustain" ) ), - m_releaseModel( 0.1, 0.0, 2.0, 0.001, this, tr( "Env release" ) ), - m_amountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "Env mod amount" ) ), + m_predelayModel(0.f, 0.f, 2.f, 0.001f, this, tr("Env pre-delay")), + m_attackModel(0.f, 0.f, 2.f, 0.001f, this, tr("Env attack")), + m_holdModel(0.5f, 0.f, 2.f, 0.001f, this, tr("Env hold")), + m_decayModel(0.5f, 0.f, 2.f, 0.001f, this, tr("Env decay")), + m_sustainModel(0.5f, 0.f, 1.f, 0.001f, this, tr("Env sustain")), + m_releaseModel(0.1f, 0.f, 2.f, 0.001f, this, tr("Env release")), + m_amountModel(0.f, -1.f, 1.f, 0.005f, this, tr("Env mod amount")), m_valueForZeroAmount( _value_for_zero_amount ), m_pahdFrames( 0 ), m_rFrames( 0 ), @@ -111,12 +111,12 @@ EnvelopeAndLfoParameters::EnvelopeAndLfoParameters( m_rEnv( nullptr ), m_pahdBufSize( 0 ), m_rBufSize( 0 ), - m_lfoPredelayModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO pre-delay" ) ), - m_lfoAttackModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO attack" ) ), - m_lfoSpeedModel( 0.1, 0.001, 1.0, 0.0001, - SECS_PER_LFO_OSCILLATION * 1000.0, this, - tr( "LFO frequency" ) ), - m_lfoAmountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "LFO mod amount" ) ), + m_lfoPredelayModel(0.f, 0.f, 1.f, 0.001f, this, tr("LFO pre-delay")), + m_lfoAttackModel(0.f, 0.f, 1.f, 0.001f, this, tr("LFO attack")), + m_lfoSpeedModel(0.1f, 0.001f, 1.f, 0.0001f, + SECS_PER_LFO_OSCILLATION * 1000.f, this, + tr("LFO frequency")), + m_lfoAmountModel(0.f, -1.f, 1.f, 0.005f, this, tr("LFO mod amount")), m_lfoWaveModel( static_cast(LfoShape::SineWave), 0, NumLfoShapes, this, tr( "LFO wave shape" ) ), m_x100Model( false, this, tr( "LFO frequency x 100" ) ), m_controlEnvAmountModel( false, this, tr( "Modulate env amount" ) ), diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 9a2185da1..a7e344a7a 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -64,7 +64,7 @@ InstrumentSoundShaping::InstrumentSoundShaping( m_filterEnabledModel( false, this ), m_filterModel( this, tr( "Filter type" ) ), m_filterCutModel( 14000.0, 1.0, 14000.0, 1.0, this, tr( "Cutoff frequency" ) ), - m_filterResModel( 0.5, BasicFilters<>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance" ) ) + m_filterResModel(0.5f, BasicFilters<>::minQ(), 10.f, 0.01f, this, tr("Q/Resonance")) { for( int i = 0; i < NumTargets; ++i ) { diff --git a/src/core/LfoController.cpp b/src/core/LfoController.cpp index 0c6d3d1ae..96ea71f7b 100644 --- a/src/core/LfoController.cpp +++ b/src/core/LfoController.cpp @@ -39,9 +39,9 @@ namespace lmms LfoController::LfoController( Model * _parent ) : Controller( ControllerType::Lfo, _parent, tr( "LFO Controller" ) ), - m_baseModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Base value" ) ), - m_speedModel( 2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Oscillator speed" ) ), - m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Oscillator amount" ) ), + m_baseModel(0.5f, 0.f, 1.f, 0.001f, this, tr("Base value")), + m_speedModel(2.f, 0.01f, 20.f, 0.0001f, 20000.f, this, tr("Oscillator speed")), + m_amountModel(1.f, -1.f, 1.f, 0.005f, this, tr("Oscillator amount")), m_phaseModel( 0.0, 0.0, 360.0, 4.0, this, tr( "Oscillator phase" ) ), m_waveModel( static_cast(Oscillator::WaveShape::Sine), 0, Oscillator::NumWaveShapes, this, tr( "Oscillator waveform" ) ), diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 6dd2e3451..dd68b55d3 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -43,8 +43,8 @@ namespace lmms MixerRoute::MixerRoute( MixerChannel * from, MixerChannel * to, float amount ) : m_from( from ), m_to( to ), - m_amount( amount, 0, 1, 0.001, nullptr, - tr( "Amount to send from channel %1 to channel %2" ).arg( m_from->m_channelIndex ).arg( m_to->m_channelIndex ) ) + m_amount(amount, 0, 1, 0.001f, nullptr, + tr("Amount to send from channel %1 to channel %2").arg(m_from->m_channelIndex).arg(m_to->m_channelIndex)) { //qDebug( "created: %d to %d", m_from->m_channelIndex, m_to->m_channelIndex ); // create send amount model @@ -67,7 +67,7 @@ MixerChannel::MixerChannel( int idx, Model * _parent ) : m_buffer( new sampleFrame[Engine::audioEngine()->framesPerPeriod()] ), m_muteModel( false, _parent ), m_soloModel( false, _parent ), - m_volumeModel( 1.0, 0.0, 2.0, 0.001, _parent ), + m_volumeModel(1.f, 0.f, 2.f, 0.001f, _parent), m_name(), m_lock(), m_channelIndex( idx ), diff --git a/src/core/fft_helpers.cpp b/src/core/fft_helpers.cpp index 35906e8d3..c24310341 100644 --- a/src/core/fft_helpers.cpp +++ b/src/core/fft_helpers.cpp @@ -122,13 +122,13 @@ int precomputeWindow(float *window, unsigned int length, FFTWindow type, bool no gain = 1; return 0; case FFTWindow::BlackmanHarris: - a0 = 0.35875; - a1 = 0.48829; - a2 = 0.14128; - a3 = 0.01168; + a0 = 0.35875f; + a1 = 0.48829f; + a2 = 0.14128f; + a3 = 0.01168f; break; case FFTWindow::Hamming: - a0 = 0.54; + a0 = 0.54f; a1 = 1.0 - a0; a2 = 0; a3 = 0; @@ -204,11 +204,11 @@ int compressbands(const float *absspec_buffer, float *compressedband, int num_ol float j_min = (i * ratio) + bottom; - if (j_min < 0) {j_min = bottom;} + if (j_min < 0) { j_min = static_cast(bottom); } float j_max = j_min + ratio; - for (float j = (int)j_min; j <= j_max; j++) + for (float j = std::floor(j_min); j <= j_max; j++) { compressedband[i] += absspec_buffer[(int)j]; } diff --git a/src/core/lv2/Lv2UridMap.cpp b/src/core/lv2/Lv2UridMap.cpp index ecc28693f..4aa9d11b4 100644 --- a/src/core/lv2/Lv2UridMap.cpp +++ b/src/core/lv2/Lv2UridMap.cpp @@ -76,12 +76,12 @@ LV2_URID UridMap::map(const char *uri) if (itr == m_map.end()) { // 1 is the first free URID - std::size_t index = 1u + m_unMap.size(); + const auto index = static_cast(1u + m_unMap.size()); auto pr = m_map.emplace(std::move(uriStr), index); if (pr.second) { m_unMap.emplace_back(pr.first->first.c_str()); - result = static_cast(index); + result = index; } } else { result = itr->second; } diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 41042f524..a7ca07279 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -120,7 +120,7 @@ AutomationEditor::AutomationEditor() : //keeps the direction of the widget, undepended on the locale setLayoutDirection( Qt::LeftToRight ); - m_tensionModel = new FloatModel(1.0, 0.0, 1.0, 0.01); + m_tensionModel = new FloatModel(1.f, 0.f, 1.f, 0.01f); connect( m_tensionModel, SIGNAL(dataChanged()), this, SLOT(setTension())); @@ -2107,7 +2107,7 @@ AutomationEditorWindow::AutomationEditorWindow() : for( float const & zoomLevel : m_editor->m_zoomXLevels ) { - m_editor->m_zoomingXModel.addItem( QString( "%1\%" ).arg( zoomLevel * 100 ) ); + m_editor->m_zoomingXModel.addItem(QString("%1%").arg(zoomLevel * 100)); } m_editor->m_zoomingXModel.setValue( m_editor->m_zoomingXModel.findText( "100%" ) ); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 4723004e8..5811f956c 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -314,7 +314,7 @@ PianoRoll::PianoRoll() : // setup zooming-stuff for( float const & zoomLevel : m_zoomLevels ) { - m_zoomingModel.addItem( QString( "%1\%" ).arg( zoomLevel * 100 ) ); + m_zoomingModel.addItem(QString("%1%").arg(zoomLevel * 100)); } m_zoomingModel.setValue( m_zoomingModel.findText( "100%" ) ); connect( &m_zoomingModel, SIGNAL(dataChanged()), @@ -323,7 +323,7 @@ PianoRoll::PianoRoll() : // zoom y for (float const & zoomLevel : m_zoomYLevels) { - m_zoomingYModel.addItem(QString( "%1\%" ).arg(zoomLevel * 100)); + m_zoomingYModel.addItem(QString("%1%").arg(zoomLevel * 100)); } m_zoomingYModel.setValue(m_zoomingYModel.findText("100%")); connect(&m_zoomingYModel, SIGNAL(dataChanged()), diff --git a/src/gui/modals/ControllerConnectionDialog.cpp b/src/gui/modals/ControllerConnectionDialog.cpp index 12e26d03c..c7bdd28b4 100644 --- a/src/gui/modals/ControllerConnectionDialog.cpp +++ b/src/gui/modals/ControllerConnectionDialog.cpp @@ -295,7 +295,7 @@ ControllerConnectionDialog::~ControllerConnectionDialog() void ControllerConnectionDialog::selectController() { // Midi - if( m_midiGroupBox->model()->value() > 0 ) + if (m_midiGroupBox->model()->value()) { if( m_midiControllerSpinBox->model()->value() > 0 ) { @@ -321,8 +321,7 @@ void ControllerConnectionDialog::selectController() // User else { - if( m_userGroupBox->model()->value() > 0 && - Engine::getSong()->controllers().size() ) + if (m_userGroupBox->model()->value() && Engine::getSong()->controllers().size()) { m_controller = Engine::getSong()->controllers().at( m_userController->model()->value() ); diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 24b16bfe4..9a0da4db4 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -282,7 +282,7 @@ void Fader::paintEvent(QPaintEvent* ev) void Fader::paintLevels(QPaintEvent* ev, QPainter& painter, bool linear) { - std::function mapper = [this](float value) { return ampToDbfs(qMax(0.0001, value)); }; + std::function mapper = [this](float value) { return ampToDbfs(qMax(0.0001f, value)); }; if (linear) { @@ -376,7 +376,7 @@ void Fader::paintLevels(QPaintEvent* ev, QPainter& painter, bool linear) // is the minimum value and that all other values lie inbetween. Otherwise // there will be warnings when the gradient is defined. const float mappedClipStarts(mapper(dbfsToAmp(0.f))); - const float mappedWarnEnd(mapper(dbfsToAmp(-0.01))); + const float mappedWarnEnd(mapper(dbfsToAmp(-0.01f))); const float mappedWarnStart(mapper(dbfsToAmp(-6.f))); const float mappedOkEnd(mapper(dbfsToAmp(-12.f))); diff --git a/tests/src/core/ArrayVectorTest.cpp b/tests/src/core/ArrayVectorTest.cpp index 9e6ed40b8..40ce4d001 100644 --- a/tests/src/core/ArrayVectorTest.cpp +++ b/tests/src/core/ArrayVectorTest.cpp @@ -231,12 +231,14 @@ private slots: //// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159 auto v = ArrayVector{1, 2, 3}; const auto oldValue = v; -#pragma GCC diagnostic push #if __GNUC__ >= 13 -# pragma GCC diagnostic ignored "-Wself-move" +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wself-move" #endif v = std::move(v); -#pragma GCC diagnostic pop +#if __GNUC__ >= 13 +# pragma GCC diagnostic pop +#endif QCOMPARE(v, oldValue); } {