From 4845bbc98c5a9129914fc3c229e78ad6b2198cef Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 21:51:11 -0500 Subject: [PATCH 1/9] Use macOS 13 See: https://github.com/actions/runner-images/issues/10721 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c2e8dd73b4..ead791389ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,7 +72,7 @@ jobs: arch: [ x86_64, arm64 ] include: - arch: x86_64 - os: macos-12 + os: macos-13 xcode: "13.1" - arch: arm64 os: macos-14 From 557b9e22172990a04fe4d1d68e994831f8728100 Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 22:05:09 -0500 Subject: [PATCH 2/9] Upgrade to XCode 15.2 XCode 15.2 is the default on macOS 13 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ead791389ee..4d31b0b0e8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,7 +73,7 @@ jobs: include: - arch: x86_64 os: macos-13 - xcode: "13.1" + xcode: "15.2" - arch: arm64 os: macos-14 xcode: "14.3.1" From 35635a40b5f5e45c08006be33323c6f8a9996e99 Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 22:31:56 -0500 Subject: [PATCH 3/9] Fix unqualified call to std::move warning --- src/core/ComboBoxModel.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core/ComboBoxModel.cpp b/src/core/ComboBoxModel.cpp index f1b1c6b2e0f..80d1027deaf 100644 --- a/src/core/ComboBoxModel.cpp +++ b/src/core/ComboBoxModel.cpp @@ -29,20 +29,17 @@ namespace lmms { -using std::unique_ptr; -using std::move; - -void ComboBoxModel::addItem( QString item, unique_ptr loader ) +void ComboBoxModel::addItem(QString item, std::unique_ptr loader) { - m_items.emplace_back( move(item), move(loader) ); + m_items.emplace_back(std::move(item), std::move(loader)); setRange( 0, m_items.size() - 1 ); } -void ComboBoxModel::replaceItem(std::size_t index, QString item, unique_ptr loader) +void ComboBoxModel::replaceItem(std::size_t index, QString item, std::unique_ptr loader) { assert(index < m_items.size()); - m_items[index] = Item(move(item), move(loader)); + m_items[index] = Item(std::move(item), std::move(loader)); emit propertiesChanged(); } From 5af9c39bccc1128f1110e3c8c606a8dac5c8f3ac Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 22:35:30 -0500 Subject: [PATCH 4/9] Fix sprintf deprecated warnings --- include/RemotePluginBase.h | 4 ++-- include/RemotePluginClient.h | 2 +- plugins/Vestige/Vestige.cpp | 12 ++++++------ plugins/VstEffect/VstEffectControls.cpp | 10 +++++----- src/core/ProjectRenderer.cpp | 6 +++--- src/core/midi/MidiApple.cpp | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/RemotePluginBase.h b/include/RemotePluginBase.h index 5214b6f9244..bbf14207ac7 100644 --- a/include/RemotePluginBase.h +++ b/include/RemotePluginBase.h @@ -398,7 +398,7 @@ class LMMS_EXPORT RemotePluginBase message & addInt( int _i ) { char buf[32]; - sprintf( buf, "%d", _i ); + std::snprintf(buf, 32, "%d", _i); data.emplace_back( buf ); return *this; } @@ -406,7 +406,7 @@ class LMMS_EXPORT RemotePluginBase message & addFloat( float _f ) { char buf[32]; - sprintf( buf, "%f", _f ); + std::snprintf(buf, 32, "%f", _f); data.emplace_back( buf ); return *this; } diff --git a/include/RemotePluginClient.h b/include/RemotePluginClient.h index 22158f1b81b..24189650688 100644 --- a/include/RemotePluginClient.h +++ b/include/RemotePluginClient.h @@ -309,7 +309,7 @@ bool RemotePluginClient::processMessage( const message & _m ) default: { char buf[64]; - sprintf( buf, "undefined message: %d\n", (int) _m.id ); + std::snprintf(buf, 64, "undefined message: %d\n", _m.id); debugMessage( buf ); break; } diff --git a/plugins/Vestige/Vestige.cpp b/plugins/Vestige/Vestige.cpp index 5a7d4afa059..05716008ef1 100644 --- a/plugins/Vestige/Vestige.cpp +++ b/plugins/Vestige/Vestige.cpp @@ -226,7 +226,7 @@ void VestigeInstrument::loadSettings( const QDomElement & _this ) QStringList s_dumpValues; for( int i = 0; i < paramCount; i++ ) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); s_dumpValues = dump[paramStr.data()].split(":"); knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) ); @@ -290,7 +290,7 @@ void VestigeInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) for( int i = 0; i < paramCount; i++ ) { if (knobFModel[i]->isAutomated() || knobFModel[i]->controllerConnection()) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); knobFModel[i]->saveSettings(_doc, _this, paramStr.data()); } @@ -987,7 +987,7 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume for( int i = 0; i < m_vi->paramCount; i++ ) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); s_dumpValues = dump[paramStr.data()].split(":"); vstKnobs[ i ] = new CustomTextKnob( KnobType::Bright26, this, s_dumpValues.at( 1 ) ); @@ -996,7 +996,7 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume if( !hasKnobModel ) { - sprintf(paramStr.data(), "%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "%d", i); m_vi->knobFModel[i] = new FloatModel(LocaleHelper::toFloat(s_dumpValues.at(2)), 0.0f, 1.0f, 0.01f, castModel(), paramStr.data()); } @@ -1059,8 +1059,8 @@ void ManageVestigeInstrumentView::syncPlugin( void ) // those auto-setted values are not jurnaled, tracked for undo / redo if( !( m_vi->knobFModel[ i ]->isAutomated() || m_vi->knobFModel[ i ]->controllerConnection() ) ) { - sprintf(paramStr.data(), "param%d", i); - s_dumpValues = dump[paramStr.data()].split(":"); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); + s_dumpValues = dump[paramStr.data()].split(":"); float f_value = LocaleHelper::toFloat(s_dumpValues.at(2)); m_vi->knobFModel[ i ]->setAutomatedValue( f_value ); m_vi->knobFModel[ i ]->setInitValue( f_value ); diff --git a/plugins/VstEffect/VstEffectControls.cpp b/plugins/VstEffect/VstEffectControls.cpp index c9eb4923451..ef8bd38d077 100644 --- a/plugins/VstEffect/VstEffectControls.cpp +++ b/plugins/VstEffect/VstEffectControls.cpp @@ -87,7 +87,7 @@ void VstEffectControls::loadSettings( const QDomElement & _this ) QStringList s_dumpValues; for( int i = 0; i < paramCount; i++ ) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); s_dumpValues = dump[paramStr.data()].split(":"); knobFModel[i] = new FloatModel( 0.0f, 0.0f, 1.0f, 0.01f, this, QString::number(i) ); @@ -137,7 +137,7 @@ void VstEffectControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) for( int i = 0; i < paramCount; i++ ) { if (knobFModel[i]->isAutomated() || knobFModel[i]->controllerConnection()) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); knobFModel[i]->saveSettings(_doc, _this, paramStr.data()); } } @@ -386,7 +386,7 @@ ManageVSTEffectView::ManageVSTEffectView( VstEffect * _eff, VstEffectControls * for( int i = 0; i < m_vi->paramCount; i++ ) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); s_dumpValues = dump[paramStr.data()].split(":"); vstKnobs[ i ] = new CustomTextKnob( KnobType::Bright26, widget, s_dumpValues.at( 1 ) ); @@ -395,7 +395,7 @@ ManageVSTEffectView::ManageVSTEffectView( VstEffect * _eff, VstEffectControls * if( !hasKnobModel ) { - sprintf(paramStr.data(), "%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "%d", i); m_vi->knobFModel[i] = new FloatModel(LocaleHelper::toFloat(s_dumpValues.at(2)), 0.0f, 1.0f, 0.01f, _eff, paramStr.data()); } @@ -460,7 +460,7 @@ void ManageVSTEffectView::syncPlugin() if( !( m_vi2->knobFModel[ i ]->isAutomated() || m_vi2->knobFModel[ i ]->controllerConnection() ) ) { - sprintf(paramStr.data(), "param%d", i); + std::snprintf(paramStr.data(), paramStr.size(), "param%d", i); s_dumpValues = dump[paramStr.data()].split(":"); float f_value = LocaleHelper::toFloat(s_dumpValues.at(2)); m_vi2->knobFModel[ i ]->setAutomatedValue( f_value ); diff --git a/src/core/ProjectRenderer.cpp b/src/core/ProjectRenderer.cpp index e5410e6f272..c56c34068b4 100644 --- a/src/core/ProjectRenderer.cpp +++ b/src/core/ProjectRenderer.cpp @@ -210,7 +210,7 @@ void ProjectRenderer::abortProcessing() void ProjectRenderer::updateConsoleProgress() { - const int cols = 50; + constexpr int cols = 50; static int rot = 0; auto buf = std::array{}; auto prog = std::array{}; @@ -221,9 +221,9 @@ void ProjectRenderer::updateConsoleProgress() } prog[cols] = 0; - const auto activity = (const char*)"|/-\\"; + const auto activity = "|/-\\"; std::fill(buf.begin(), buf.end(), 0); - sprintf(buf.data(), "\r|%s| %3d%% %c ", prog.data(), m_progress, + std::snprintf(buf.data(), buf.size(), "\r|%s| %3d%% %c ", prog.data(), m_progress, activity[rot] ); rot = ( rot+1 ) % 4; diff --git a/src/core/midi/MidiApple.cpp b/src/core/midi/MidiApple.cpp index 444f093e533..a274ce96959 100644 --- a/src/core/midi/MidiApple.cpp +++ b/src/core/midi/MidiApple.cpp @@ -501,7 +501,7 @@ void MidiApple::openDevices() void MidiApple::openMidiReference( MIDIEndpointRef reference, QString refName, bool isIn ) { char * registeredName = (char*) malloc(refName.length()+1); - sprintf(registeredName, "%s",refName.toLatin1().constData()); + std::snprintf(registeredName, refName.length() + 1, "%s",refName.toLatin1().constData()); qDebug("openMidiReference refName '%s'",refName.toLatin1().constData()); MIDIClientRef mClient = getMidiClientRef(); @@ -623,7 +623,7 @@ char * MidiApple::getFullName(MIDIEndpointRef &endpoint_ref) size_t deviceNameLen = deviceName == nullptr ? 0 : strlen(deviceName); size_t endPointNameLen = endPointName == nullptr ? 0 : strlen(endPointName); char * fullName = (char *)malloc(deviceNameLen + endPointNameLen + 2); - sprintf(fullName, "%s:%s", deviceName,endPointName); + std::snprintf(fullName, deviceNameLen + endPointNameLen + 2, "%s:%s", deviceName,endPointName); if (deviceName != nullptr) { free(deviceName); } if (endPointName != nullptr) { free(endPointName); } return fullName; From 5b9f8c13c93d3fa953912043074b39b813daca2a Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 22:38:20 -0500 Subject: [PATCH 5/9] Upgrade macOS 14 ARM64 builds to XCode 15.4 See: https://github.com/actions/runner-images/issues/10703 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d31b0b0e8b..74134aabde5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,7 +76,7 @@ jobs: xcode: "15.2" - arch: arm64 os: macos-14 - xcode: "14.3.1" + xcode: "15.4" name: macos-${{ matrix.arch }} runs-on: ${{ matrix.os }} env: From 98e5bfde2036ae50b5de0382815121d333032819 Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 23:09:56 -0500 Subject: [PATCH 6/9] Fix unused lambda capture warnings in Fader.cpp --- src/gui/widgets/Fader.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 9a0da4db483..5e873c553b7 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -282,20 +282,17 @@ void Fader::paintEvent(QPaintEvent* ev) void Fader::paintLevels(QPaintEvent* ev, QPainter& painter, bool linear) { - std::function mapper = [this](float value) { return ampToDbfs(qMax(0.0001f, value)); }; - - if (linear) - { - mapper = [this](float value) { return value; }; - } - - const float mappedMinPeak(mapper(m_fMinPeak)); - const float mappedMaxPeak(mapper(m_fMaxPeak)); - const float mappedPeakL(mapper(m_fPeakValue_L)); - const float mappedPeakR(mapper(m_fPeakValue_R)); - const float mappedPersistentPeakL(mapper(m_persistentPeak_L)); - const float mappedPersistentPeakR(mapper(m_persistentPeak_R)); - const float mappedUnity(mapper(1.f)); + const auto mapper = linear + ? [](float value) -> float { return value; } + : [](float value) -> float { return ampToDbfs(qMax(0.0001f, value)); }; + + const float mappedMinPeak = mapper(m_fMinPeak); + const float mappedMaxPeak = mapper(m_fMaxPeak); + const float mappedPeakL = mapper(m_fPeakValue_L); + const float mappedPeakR = mapper(m_fPeakValue_R); + const float mappedPersistentPeakL = mapper(m_persistentPeak_L); + const float mappedPersistentPeakR = mapper(m_persistentPeak_R); + const float mappedUnity = mapper(1.f); painter.save(); @@ -375,10 +372,10 @@ void Fader::paintLevels(QPaintEvent* ev, QPainter& painter, bool linear) // Please ensure that "clip starts" is the maximum value and that "ok ends" // 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.01f))); - const float mappedWarnStart(mapper(dbfsToAmp(-6.f))); - const float mappedOkEnd(mapper(dbfsToAmp(-12.f))); + const float mappedClipStarts = mapper(dbfsToAmp(0.f)); + const float mappedWarnEnd = mapper(dbfsToAmp(-0.01f)); + const float mappedWarnStart = mapper(dbfsToAmp(-6.f)); + const float mappedOkEnd = mapper(dbfsToAmp(-12.f)); // Prepare the gradient for the meters // From 6a11106d9c3980ebf14801d71345b46ef93c8b70 Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 23:10:33 -0500 Subject: [PATCH 7/9] Fix unused variable warnings --- src/core/Keymap.cpp | 2 +- src/core/Scale.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Keymap.cpp b/src/core/Keymap.cpp index 6683919fe36..be422991a6b 100644 --- a/src/core/Keymap.cpp +++ b/src/core/Keymap.cpp @@ -147,7 +147,7 @@ void Keymap::loadSettings(const QDomElement &element) QDomNode node = element.firstChild(); m_map.clear(); - for (int i = 0; !node.isNull(); i++) + while (!node.isNull()) { m_map.push_back(node.toElement().attribute("value").toInt()); node = node.nextSibling(); diff --git a/src/core/Scale.cpp b/src/core/Scale.cpp index df0effe6bca..93279f2bcba 100644 --- a/src/core/Scale.cpp +++ b/src/core/Scale.cpp @@ -116,7 +116,7 @@ void Scale::loadSettings(const QDomElement &element) QDomNode node = element.firstChild(); m_intervals.clear(); - for (int i = 0; !node.isNull(); i++) + while (!node.isNull()) { Interval temp; temp.restoreState(node.toElement()); From c922eb391efc8cc3842879855967d71cc544d9ec Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 23:12:15 -0500 Subject: [PATCH 8/9] Fix formatting warning Cannot format `const void*` as a string --- src/core/midi/MidiApple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/midi/MidiApple.cpp b/src/core/midi/MidiApple.cpp index a274ce96959..14930ed8486 100644 --- a/src/core/midi/MidiApple.cpp +++ b/src/core/midi/MidiApple.cpp @@ -159,7 +159,7 @@ void MidiApple::removePort( MidiPort* port ) QString MidiApple::sourcePortName( const MidiEvent& event ) const { - qDebug("sourcePortName return '%s'?\n", event.sourcePort()); + qDebug("sourcePortName"); /* if( event.sourcePort() ) { From d810c38b13804abfc3d02a56458b6a4b545ec84a Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Mon, 4 Nov 2024 23:27:57 -0500 Subject: [PATCH 9/9] Force lambda conversion to function pointer --- src/gui/widgets/Fader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 5e873c553b7..a647df416cf 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -283,8 +283,8 @@ void Fader::paintEvent(QPaintEvent* ev) void Fader::paintLevels(QPaintEvent* ev, QPainter& painter, bool linear) { const auto mapper = linear - ? [](float value) -> float { return value; } - : [](float value) -> float { return ampToDbfs(qMax(0.0001f, value)); }; + ? +[](float value) -> float { return value; } + : +[](float value) -> float { return ampToDbfs(qMax(0.0001f, value)); }; const float mappedMinPeak = mapper(m_fMinPeak); const float mappedMaxPeak = mapper(m_fMaxPeak);