Skip to content

Commit

Permalink
sonarcloud code rev
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed Nov 15, 2023
1 parent 2563cab commit 1d8a64e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<devices::IDevice>& 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<devices::IDevice>& device, drivers::IAudioDriver& drv, const uint8_t track) { return renderBufferFlush(device->getHardware()->getAudioStream().get(), drv, track); };
protected:
std::shared_ptr<IMixer> m_mixer;
std::unique_ptr<files::WAVFile> m_out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}

0 comments on commit 1d8a64e

Please sign in to comment.