Fix some compiler warnings when building JUCE

This commit is contained in:
Armin 2026-07-17 15:03:03 +02:00
commit 0beebaa46d
3 changed files with 17 additions and 14 deletions

View file

@ -4,6 +4,10 @@ project(ChromaFlock VERSION 1.0.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-nontrivial-memcall>
)
include(FetchContent) include(FetchContent)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/JUCE/CMakeLists.txt") 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_VST3_CAN_REPLACE_VST2=0
JUCE_WEB_BROWSER=0 JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0 JUCE_USE_CURL=0
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_PLUGIN_WANTS_MIDI=1 JUCE_PLUGIN_WANTS_MIDI=1
JUCE_MODAL_LOOPS_PERMITTED=0 JUCE_MODAL_LOOPS_PERMITTED=0
) )

View file

@ -76,7 +76,7 @@ void KnobLookAndFeel::drawRotarySlider(juce::Graphics& g, int x, int y, int widt
auto name = slider.getName(); auto name = slider.getName();
if (name.isNotEmpty()) { if (name.isNotEmpty()) {
g.setColour(juce::Colour(0xff999999)); 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, g.drawText(name, bounds.getX(), bounds.getY(), bounds.getWidth(), labelH,
juce::Justification::centredBottom); juce::Justification::centredBottom);
} }
@ -158,7 +158,7 @@ void ComboBoxLookAndFeel::drawPopupMenuItem(juce::Graphics& g, const juce::Recta
g.setColour(isHighlighted ? juce::Colour(0xff1a1a1a) g.setColour(isHighlighted ? juce::Colour(0xff1a1a1a)
: (isTicked ? juce::Colour(0xffccaa44) : juce::Colour(0xffcccccc))); : (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); 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.drawRoundedRectangle(bounds, 9.0f, 1.0f);
g.setColour(juce::Colour(0xffccaa44)); 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); 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.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); 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.strokePath(strokePath, juce::PathStrokeType(1.5f));
g.setColour(juce::Colour(0xffccaa44)); 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); 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.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.setColour(juce::Label::textColourId, juce::Colour(0xff888888));
scaleLabel.setJustificationType(juce::Justification::centredRight); scaleLabel.setJustificationType(juce::Justification::centredRight);
addAndMakeVisible(scaleLabel); addAndMakeVisible(scaleLabel);
midiLabel.setText("MIDI IN", juce::dontSendNotification); 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.setColour(juce::Label::textColourId, juce::Colour(0xff888888));
midiLabel.setJustificationType(juce::Justification::centredLeft); midiLabel.setJustificationType(juce::Justification::centredLeft);
addAndMakeVisible(midiLabel); addAndMakeVisible(midiLabel);
auto setupTransposeLabel = [&](juce::Label& label, const juce::String& text) { auto setupTransposeLabel = [&](juce::Label& label, const juce::String& text) {
label.setText(text, juce::dontSendNotification); 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.setColour(juce::Label::textColourId, juce::Colour(0xff888888));
label.setJustificationType(juce::Justification::centredLeft); label.setJustificationType(juce::Justification::centredLeft);
addAndMakeVisible(label); addAndMakeVisible(label);
@ -686,7 +686,7 @@ MainContentComponent::MainContentComponent(ChromaFlockProcessor& p)
void MainContentComponent::setupLabel(juce::Label& label, const juce::String& text) { void MainContentComponent::setupLabel(juce::Label& label, const juce::String& text) {
label.setText(text, juce::dontSendNotification); 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.setColour(juce::Label::textColourId, juce::Colour(0xffccaa44));
label.setJustificationType(juce::Justification::centred); label.setJustificationType(juce::Justification::centred);
addAndMakeVisible(label); addAndMakeVisible(label);
@ -1020,7 +1020,7 @@ void MainContentComponent::paint(juce::Graphics& g) {
g.setColour(juce::Colour(0xff333333)); g.setColour(juce::Colour(0xff333333));
g.drawRoundedRectangle(rect, 9.0f, 1.0f); g.drawRoundedRectangle(rect, 9.0f, 1.0f);
g.setColour(juce::Colour(0xffccaa44)); 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); g.drawText(title, x + 6, y + titlePadY, w - 12, 14, juce::Justification::centred);
}; };

View file

@ -370,9 +370,9 @@ void ChromaFlockProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::
juce::ScopedNoDenormals noDenormals; juce::ScopedNoDenormals noDenormals;
if (auto* playHead = getPlayHead()) { if (auto* playHead = getPlayHead()) {
juce::AudioPlayHead::CurrentPositionInfo pos; if (auto position = playHead->getPosition())
if (playHead->getCurrentPosition(pos) && pos.bpm > 0.0) if (auto bpm = position->getBpm())
currentBpm = pos.bpm; currentBpm = *bpm;
} }
buffer.clear(); buffer.clear();