From 0beebaa46d9f611cae740087e89ca90b159f04f5 Mon Sep 17 00:00:00 2001 From: Armin Date: Fri, 17 Jul 2026 15:03:03 +0200 Subject: [PATCH] Fix some compiler warnings when building JUCE --- CMakeLists.txt | 5 ++++- Source/PluginEditor.cpp | 20 ++++++++++---------- Source/PluginProcessor.cpp | 6 +++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a75bb67..7b1e2a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,10 @@ project(ChromaFlock VERSION 1.0.0 LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +add_compile_options( + $<$:-Wno-nontrivial-memcall> +) + include(FetchContent) if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/JUCE/CMakeLists.txt") @@ -66,7 +70,6 @@ target_compile_definitions(ChromaFlock PUBLIC JUCE_VST3_CAN_REPLACE_VST2=0 JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0 - JUCE_DISPLAY_SPLASH_SCREEN=0 JUCE_PLUGIN_WANTS_MIDI=1 JUCE_MODAL_LOOPS_PERMITTED=0 ) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 7032e18..15f23cf 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -76,7 +76,7 @@ void KnobLookAndFeel::drawRotarySlider(juce::Graphics& g, int x, int y, int widt auto name = slider.getName(); if (name.isNotEmpty()) { g.setColour(juce::Colour(0xff999999)); - g.setFont(juce::Font(13.0f).boldened()); + g.setFont(juce::Font(juce::FontOptions(13.0f).withStyle("Bold"))); g.drawText(name, bounds.getX(), bounds.getY(), bounds.getWidth(), labelH, juce::Justification::centredBottom); } @@ -158,7 +158,7 @@ void ComboBoxLookAndFeel::drawPopupMenuItem(juce::Graphics& g, const juce::Recta g.setColour(isHighlighted ? juce::Colour(0xff1a1a1a) : (isTicked ? juce::Colour(0xffccaa44) : juce::Colour(0xffcccccc))); - g.setFont(juce::Font(13.0f)); + g.setFont(juce::Font(juce::FontOptions(13.0f))); g.drawText(text, area.reduced(8, 0), juce::Justification::centredLeft, true); } @@ -193,7 +193,7 @@ void VuMeter::paint(juce::Graphics& g) { g.drawRoundedRectangle(bounds, 9.0f, 1.0f); g.setColour(juce::Colour(0xffccaa44)); - g.setFont(juce::Font(13.0f).boldened()); + g.setFont(juce::Font(juce::FontOptions(13.0f).withStyle("Bold"))); g.drawText("VU", bounds.withBottom(bounds.getY() + 22.0f).translated(0, 6), juce::Justification::centred); } @@ -255,7 +255,7 @@ void WaveformDisplay::paint(juce::Graphics& g) { } g.setColour(juce::Colour(0xffccaa44)); - g.setFont(juce::Font(13.0f).boldened()); + g.setFont(juce::Font(juce::FontOptions(13.0f).withStyle("Bold"))); g.drawText("WAVE", bounds.withBottom(bounds.getY() + 22.0f).translated(0, 6), juce::Justification::centred); } @@ -351,7 +351,7 @@ void SpectrumAnalyzer::paint(juce::Graphics& g) { g.strokePath(strokePath, juce::PathStrokeType(1.5f)); g.setColour(juce::Colour(0xffccaa44)); - g.setFont(juce::Font(13.0f).boldened()); + g.setFont(juce::Font(juce::FontOptions(13.0f).withStyle("Bold"))); g.drawText("SPECTRUM", bounds.withBottom(bounds.getY() + 22.0f).translated(0, 6), juce::Justification::centred); } @@ -633,20 +633,20 @@ MainContentComponent::MainContentComponent(ChromaFlockProcessor& p) } scaleLabel.setText("SCALE", juce::dontSendNotification); - scaleLabel.setFont(juce::Font(9.0f)); + scaleLabel.setFont(juce::Font(juce::FontOptions(9.0f))); scaleLabel.setColour(juce::Label::textColourId, juce::Colour(0xff888888)); scaleLabel.setJustificationType(juce::Justification::centredRight); addAndMakeVisible(scaleLabel); midiLabel.setText("MIDI IN", juce::dontSendNotification); - midiLabel.setFont(juce::Font(9.0f)); + midiLabel.setFont(juce::Font(juce::FontOptions(9.0f))); midiLabel.setColour(juce::Label::textColourId, juce::Colour(0xff888888)); midiLabel.setJustificationType(juce::Justification::centredLeft); addAndMakeVisible(midiLabel); auto setupTransposeLabel = [&](juce::Label& label, const juce::String& text) { label.setText(text, juce::dontSendNotification); - label.setFont(juce::Font(9.0f)); + label.setFont(juce::Font(juce::FontOptions(9.0f))); label.setColour(juce::Label::textColourId, juce::Colour(0xff888888)); label.setJustificationType(juce::Justification::centredLeft); addAndMakeVisible(label); @@ -686,7 +686,7 @@ MainContentComponent::MainContentComponent(ChromaFlockProcessor& p) void MainContentComponent::setupLabel(juce::Label& label, const juce::String& text) { label.setText(text, juce::dontSendNotification); - label.setFont(juce::Font(13.0f).boldened()); + label.setFont(juce::Font(juce::FontOptions(13.0f).withStyle("Bold"))); label.setColour(juce::Label::textColourId, juce::Colour(0xffccaa44)); label.setJustificationType(juce::Justification::centred); addAndMakeVisible(label); @@ -1020,7 +1020,7 @@ void MainContentComponent::paint(juce::Graphics& g) { g.setColour(juce::Colour(0xff333333)); g.drawRoundedRectangle(rect, 9.0f, 1.0f); g.setColour(juce::Colour(0xffccaa44)); - g.setFont(juce::Font(11.0f).boldened()); + g.setFont(juce::Font(juce::FontOptions(11.0f).withStyle("Bold"))); g.drawText(title, x + 6, y + titlePadY, w - 12, 14, juce::Justification::centred); }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 2368d7f..b807d28 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -370,9 +370,9 @@ void ChromaFlockProcessor::processBlock(juce::AudioBuffer& buffer, juce:: juce::ScopedNoDenormals noDenormals; if (auto* playHead = getPlayHead()) { - juce::AudioPlayHead::CurrentPositionInfo pos; - if (playHead->getCurrentPosition(pos) && pos.bpm > 0.0) - currentBpm = pos.bpm; + if (auto position = playHead->getPosition()) + if (auto bpm = position->getBpm()) + currentBpm = *bpm; } buffer.clear();