From 1d8a64e58a646c8b6e6407f5ebe76eea4fd1c6b3 Mon Sep 17 00:00:00 2001 From: Raffaello Bertini Date: Wed, 15 Nov 2023 10:52:05 +0000 Subject: [PATCH] sonarcloud code rev --- .../src/HyperSonicDrivers/audio/IRenderer.hpp | 4 ++-- .../src/HyperSonicDrivers/audio/sdl2/Renderer.cpp | 6 +++--- .../src/HyperSonicDrivers/audio/sdl2/Renderer.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IRenderer.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IRenderer.hpp index 5e16bf16..5a7068c1 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IRenderer.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/IRenderer.hpp @@ -39,8 +39,8 @@ namespace HyperSonicDrivers::audio * this is doing the render until the drv is play the track and call the render flush after all * it returns the renderFlush returned value **/ - virtual bool renderBufferFlush(IAudioStream* stream, drivers::IAudioDriver& drv, const int track) = 0; - inline bool renderBufferFlush(const std::shared_ptr& device, drivers::IAudioDriver& drv, const int track) { return renderBufferFlush(device->getHardware()->getAudioStream().get(), drv, track); }; + virtual bool renderBufferFlush(IAudioStream* stream, drivers::IAudioDriver& drv, const uint8_t track) = 0; + inline bool renderBufferFlush(const std::shared_ptr& device, drivers::IAudioDriver& drv, const uint8_t track) { return renderBufferFlush(device->getHardware()->getAudioStream().get(), drv, track); }; protected: std::shared_ptr m_mixer; std::unique_ptr m_out; diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.cpp index e8f67527..1b034958 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.cpp @@ -52,8 +52,8 @@ namespace HyperSonicDrivers::audio::sdl2 if (read == 0) return true; - const bool silenced = std::ranges::all_of(m_buf, [](const auto i) { return i == 0; }); - if (silenced) + // check if it is all silence... + if (std::ranges::all_of(m_buf, [](const auto i) { return i == 0; })) return true; m_out->save_streaming(m_buf.data(), read); @@ -62,7 +62,7 @@ namespace HyperSonicDrivers::audio::sdl2 return false; } - bool Renderer::renderBufferFlush(IAudioStream* stream, drivers::IAudioDriver& drv, const int track) + bool Renderer::renderBufferFlush(IAudioStream* stream, drivers::IAudioDriver& drv, const uint8_t track) { drv.play(track); while (drv.isPlaying()) diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.hpp index 0ff2886c..a8feb700 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/audio/sdl2/Renderer.hpp @@ -22,6 +22,6 @@ namespace HyperSonicDrivers::audio::sdl2 void renderBuffer(IAudioStream* stream) override; bool renderFlush(IAudioStream* stream) override; - bool renderBufferFlush(IAudioStream* stream, drivers::IAudioDriver& drv, const int track) override; + bool renderBufferFlush(IAudioStream* stream, drivers::IAudioDriver& drv, const uint8_t track) override; }; }