From a12f4efa2f908e2c1b0b9343a6314dfce95e0926 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 25 Feb 2019 09:24:36 -0500 Subject: audio_core/codec: Resolve truncation warnings within DecodeADPCM The assignments here were performing an implicit truncation from int to s16. Make it explicit that this is desired behavior. --- src/audio_core/codec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/audio_core') diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp index 454de798b..c5a0d98ce 100644 --- a/src/audio_core/codec.cpp +++ b/src/audio_core/codec.cpp @@ -68,8 +68,8 @@ std::vector DecodeADPCM(const u8* const data, std::size_t size, const ADPCM } } - state.yn1 = yn1; - state.yn2 = yn2; + state.yn1 = static_cast(yn1); + state.yn2 = static_cast(yn2); return ret; } -- cgit v1.2.3 From 7cdeec20ec5542925e8a35943604857072796832 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 25 Feb 2019 09:28:48 -0500 Subject: audio_core/cubeb_sink: Resolve variable shadowing warnings in SamplesInQueue The name of the parameter was shadowing the member variable of the same name. Instead, alter the name of the parameter to prevent said shadowing. --- src/audio_core/cubeb_sink.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/audio_core') diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 097328901..3c2208b46 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -75,11 +75,11 @@ public: queue.Push(samples); } - std::size_t SamplesInQueue(u32 num_channels) const override { + std::size_t SamplesInQueue(u32 channel_count) const override { if (!ctx) return 0; - return queue.Size() / num_channels; + return queue.Size() / channel_count; } void Flush() override { -- cgit v1.2.3 From 8250f9bb1c7a95fb0c41c59d6ef46efc2b3e232c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 25 Feb 2019 09:38:24 -0500 Subject: audio_core/cubeb_sink: Add override specifier to destructor CubebSinkStream inherits from a base class with a virtual destructor, so override can be appended to CubebSinkStream's destructor. --- src/audio_core/cubeb_sink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio_core') diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 3c2208b46..404714b58 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -46,7 +46,7 @@ public: } } - ~CubebSinkStream() { + ~CubebSinkStream() override { if (!ctx) { return; } -- cgit v1.2.3 From 04d7b7e09d7ae6db878a4f9d768de82d2b906efa Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 25 Feb 2019 09:40:34 -0500 Subject: audio_core/cubeb_sink: Initialize CubebSinkStream's last_frame data member Ensures that all member variables are initialized in a deterministic manner across the board. --- src/audio_core/cubeb_sink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio_core') diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 404714b58..dc45dedd3 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp @@ -98,7 +98,7 @@ private: u32 num_channels{}; Common::RingBuffer queue; - std::array last_frame; + std::array last_frame{}; std::atomic should_flush{}; TimeStretcher time_stretch; -- cgit v1.2.3