From 5d7dd423a17ba1c680288b6587e687405516aeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sun, 27 Oct 2024 13:25:29 -0400 Subject: [PATCH] [examples] Minor warning fixes --- examples/Advanced/AudioParticles/AudioParticles.cpp | 9 +++++++-- examples/Advanced/MidiScaler/MidiScroller.hpp | 4 ++-- examples/Advanced/MidiScaler/StrStream.hpp | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/Advanced/AudioParticles/AudioParticles.cpp b/examples/Advanced/AudioParticles/AudioParticles.cpp index dc67031b..37835451 100644 --- a/examples/Advanced/AudioParticles/AudioParticles.cpp +++ b/examples/Advanced/AudioParticles/AudioParticles.cpp @@ -96,9 +96,14 @@ void AudioParticles::operator()(const halp::tick_musical& t) } ossia::remove_erase_if(m_playheads, [this](const auto& playhead) { + if(outputs.audio.channels <= playhead.channel) + return true; + if(std::ssize(m_sounds) <= playhead.index) + return true; + auto& sound = m_sounds[playhead.index]; - return playhead.frame >= sound[0].size() || (m_sounds.size() <= playhead.index) - || (outputs.audio.channels <= playhead.channel); + SCORE_ASSERT(!sound.empty()); + return playhead.frame >= std::ssize(sound[0]); }); } } diff --git a/examples/Advanced/MidiScaler/MidiScroller.hpp b/examples/Advanced/MidiScaler/MidiScroller.hpp index 4ad29fd9..f1c825cd 100644 --- a/examples/Advanced/MidiScaler/MidiScroller.hpp +++ b/examples/Advanced/MidiScaler/MidiScroller.hpp @@ -68,8 +68,8 @@ struct MidiScroller if(track < 0) track = 0; - if(track >= inputs.midi.midifile.tracks.size()) - track = inputs.midi.midifile.tracks.size() - 1; + if(track >= tracks) + track = tracks - 1; for(const auto& ev : inputs.midi.midifile.tracks[track]) { diff --git a/examples/Advanced/MidiScaler/StrStream.hpp b/examples/Advanced/MidiScaler/StrStream.hpp index 3a33be73..2d6b6d1f 100644 --- a/examples/Advanced/MidiScaler/StrStream.hpp +++ b/examples/Advanced/MidiScaler/StrStream.hpp @@ -481,6 +481,8 @@ inline strstreambuf::pos_type strstreambuf::seekoff( if(pos_in == pos_out) return pos_type(off_type(-1)); break; + default: + break; } if(pos_in && gptr() == nullptr)