summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2020-10-13 15:30:30 -0700
committerGravatar GitHub2020-10-13 15:30:30 -0700
commitca416a0fb87ced0e471729fe344b9f34a090e7b5 (patch)
treed1a143eb839744bc1515700c861ec7e5d04d130e
parentMerge pull request #4786 from lioncash/flags (diff)
parentaudio_core/CMakeLists: Make warnings consistent with core (diff)
downloadyuzu-ca416a0fb87ced0e471729fe344b9f34a090e7b5.tar.gz
yuzu-ca416a0fb87ced0e471729fe344b9f34a090e7b5.tar.xz
yuzu-ca416a0fb87ced0e471729fe344b9f34a090e7b5.zip
Merge pull request #4787 from lioncash/conversion
audio_core/CMakeLists: Make warnings consistent with core
-rw-r--r--src/audio_core/CMakeLists.txt3
-rw-r--r--src/audio_core/algorithm/filter.cpp3
-rw-r--r--src/audio_core/algorithm/interpolate.cpp5
-rw-r--r--src/audio_core/command_generator.cpp3
-rw-r--r--src/audio_core/cubeb_sink.cpp6
-rw-r--r--src/audio_core/voice_context.cpp5
6 files changed, 17 insertions, 8 deletions
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index 6a7075f73..54940a034 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -46,10 +46,13 @@ create_target_directory_groups(audio_core)
46 46
47if (NOT MSVC) 47if (NOT MSVC)
48 target_compile_options(audio_core PRIVATE 48 target_compile_options(audio_core PRIVATE
49 -Werror=conversion
49 -Werror=ignored-qualifiers 50 -Werror=ignored-qualifiers
50 -Werror=implicit-fallthrough 51 -Werror=implicit-fallthrough
51 -Werror=reorder 52 -Werror=reorder
52 -Werror=sign-compare 53 -Werror=sign-compare
54 -Werror=unused-but-set-parameter
55 -Werror=unused-but-set-variable
53 -Werror=unused-variable 56 -Werror=unused-variable
54 ) 57 )
55endif() 58endif()
diff --git a/src/audio_core/algorithm/filter.cpp b/src/audio_core/algorithm/filter.cpp
index f65bf64f7..f34a5b9f3 100644
--- a/src/audio_core/algorithm/filter.cpp
+++ b/src/audio_core/algorithm/filter.cpp
@@ -55,7 +55,8 @@ void Filter::Process(std::vector<s16>& signal) {
55/// @param total_count The total number of biquads to be cascaded. 55/// @param total_count The total number of biquads to be cascaded.
56/// @param index 0-index of the biquad to calculate the Q value for. 56/// @param index 0-index of the biquad to calculate the Q value for.
57static double CascadingBiquadQ(std::size_t total_count, std::size_t index) { 57static double CascadingBiquadQ(std::size_t total_count, std::size_t index) {
58 const double pole = M_PI * (2 * index + 1) / (4.0 * total_count); 58 const auto pole =
59 M_PI * static_cast<double>(2 * index + 1) / (4.0 * static_cast<double>(total_count));
59 return 1.0 / (2.0 * std::cos(pole)); 60 return 1.0 / (2.0 * std::cos(pole));
60} 61}
61 62
diff --git a/src/audio_core/algorithm/interpolate.cpp b/src/audio_core/algorithm/interpolate.cpp
index 689a54508..699fcb84c 100644
--- a/src/audio_core/algorithm/interpolate.cpp
+++ b/src/audio_core/algorithm/interpolate.cpp
@@ -146,7 +146,7 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
146 return {}; 146 return {};
147 147
148 if (ratio <= 0) { 148 if (ratio <= 0) {
149 LOG_CRITICAL(Audio, "Nonsensical interpolation ratio {}", ratio); 149 LOG_ERROR(Audio, "Nonsensical interpolation ratio {}", ratio);
150 return input; 150 return input;
151 } 151 }
152 152
@@ -164,7 +164,8 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
164 const std::size_t num_frames{input.size() / 2}; 164 const std::size_t num_frames{input.size() / 2};
165 165
166 std::vector<s16> output; 166 std::vector<s16> output;
167 output.reserve(static_cast<std::size_t>(input.size() / ratio + InterpolationState::taps)); 167 output.reserve(static_cast<std::size_t>(static_cast<double>(input.size()) / ratio +
168 InterpolationState::taps));
168 169
169 for (std::size_t frame{}; frame < num_frames; ++frame) { 170 for (std::size_t frame{}; frame < num_frames; ++frame) {
170 const std::size_t lut_index{(state.fraction >> 8) * InterpolationState::taps}; 171 const std::size_t lut_index{(state.fraction >> 8) * InterpolationState::taps};
diff --git a/src/audio_core/command_generator.cpp b/src/audio_core/command_generator.cpp
index bba40d13d..fb8700ccf 100644
--- a/src/audio_core/command_generator.cpp
+++ b/src/audio_core/command_generator.cpp
@@ -793,7 +793,6 @@ s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_s
793 // Decode entire frame 793 // Decode entire frame
794 if (remaining_samples >= static_cast<int>(SAMPLES_PER_FRAME)) { 794 if (remaining_samples >= static_cast<int>(SAMPLES_PER_FRAME)) {
795 for (std::size_t i = 0; i < SAMPLES_PER_FRAME / 2; i++) { 795 for (std::size_t i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
796
797 // Sample 1 796 // Sample 1
798 const s32 s0 = SIGNED_NIBBLES[buffer[buffer_offset] >> 4]; 797 const s32 s0 = SIGNED_NIBBLES[buffer[buffer_offset] >> 4];
799 const s32 s1 = SIGNED_NIBBLES[buffer[buffer_offset++] & 0xf]; 798 const s32 s1 = SIGNED_NIBBLES[buffer[buffer_offset++] & 0xf];
@@ -802,7 +801,7 @@ s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_s
802 sample_buffer[cur_mix_offset++] = sample_1; 801 sample_buffer[cur_mix_offset++] = sample_1;
803 sample_buffer[cur_mix_offset++] = sample_2; 802 sample_buffer[cur_mix_offset++] = sample_2;
804 } 803 }
805 remaining_samples -= SAMPLES_PER_FRAME; 804 remaining_samples -= static_cast<int>(SAMPLES_PER_FRAME);
806 position_in_frame += SAMPLES_PER_FRAME; 805 position_in_frame += SAMPLES_PER_FRAME;
807 continue; 806 continue;
808 } 807 }
diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp
index eb82791f6..6eaa60815 100644
--- a/src/audio_core/cubeb_sink.cpp
+++ b/src/audio_core/cubeb_sink.cpp
@@ -93,8 +93,10 @@ public:
93 constexpr s32 clev{707}; // center mixing level coefficient 93 constexpr s32 clev{707}; // center mixing level coefficient
94 constexpr s32 slev{707}; // surround mixing level coefficient 94 constexpr s32 slev{707}; // surround mixing level coefficient
95 95
96 buf.push_back(left + (clev * center / 1000) + (slev * surround_left / 1000)); 96 buf.push_back(static_cast<s16>(left + (clev * center / 1000) +
97 buf.push_back(right + (clev * center / 1000) + (slev * surround_right / 1000)); 97 (slev * surround_left / 1000)));
98 buf.push_back(static_cast<s16>(right + (clev * center / 1000) +
99 (slev * surround_right / 1000)));
98 } 100 }
99 queue.Push(buf); 101 queue.Push(buf);
100 return; 102 return;
diff --git a/src/audio_core/voice_context.cpp b/src/audio_core/voice_context.cpp
index 863ac9267..c46ee55f1 100644
--- a/src/audio_core/voice_context.cpp
+++ b/src/audio_core/voice_context.cpp
@@ -128,7 +128,10 @@ void ServerVoiceInfo::UpdateParameters(const VoiceInfo::InParams& voice_in,
128 in_params.wave_buffer_count = voice_in.wave_buffer_count; 128 in_params.wave_buffer_count = voice_in.wave_buffer_count;
129 in_params.wave_bufffer_head = voice_in.wave_buffer_head; 129 in_params.wave_bufffer_head = voice_in.wave_buffer_head;
130 if (behavior_info.IsFlushVoiceWaveBuffersSupported()) { 130 if (behavior_info.IsFlushVoiceWaveBuffersSupported()) {
131 in_params.wave_buffer_flush_request_count += voice_in.wave_buffer_flush_request_count; 131 const auto in_request_count = in_params.wave_buffer_flush_request_count;
132 const auto voice_request_count = voice_in.wave_buffer_flush_request_count;
133 in_params.wave_buffer_flush_request_count =
134 static_cast<u8>(in_request_count + voice_request_count);
132 } 135 }
133 in_params.mix_id = voice_in.mix_id; 136 in_params.mix_id = voice_in.mix_id;
134 if (behavior_info.IsSplitterSupported()) { 137 if (behavior_info.IsSplitterSupported()) {