summaryrefslogtreecommitdiff
path: root/src/audio_core/sink
diff options
context:
space:
mode:
authorGravatar arades792023-02-11 13:28:03 -0500
committerGravatar arades792023-02-14 12:33:11 -0500
commit45e13b03f372230dbf780f3fa87dd88f388af605 (patch)
tree555593e7e5016b6ba2a777d7417ada244abce458 /src/audio_core/sink
parentMerge pull request #9795 from Kelebek1/biquad_fix (diff)
downloadyuzu-45e13b03f372230dbf780f3fa87dd88f388af605.tar.gz
yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.tar.xz
yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.zip
add static lifetime to constexpr values to force compile time evaluation where possible
Signed-off-by: arades79 <scravers@protonmail.com>
Diffstat (limited to 'src/audio_core/sink')
-rw-r--r--src/audio_core/sink/sink_stream.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 06c2a876e..fa3cee3ea 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -24,8 +24,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
24 return; 24 return;
25 } 25 }
26 26
27 constexpr s32 min{std::numeric_limits<s16>::min()}; 27 constexpr static s32 min{std::numeric_limits<s16>::min()};
28 constexpr s32 max{std::numeric_limits<s16>::max()}; 28 constexpr static s32 max{std::numeric_limits<s16>::max()};
29 29
30 auto yuzu_volume{Settings::Volume()}; 30 auto yuzu_volume{Settings::Volume()};
31 if (yuzu_volume > 1.0f) { 31 if (yuzu_volume > 1.0f) {
@@ -35,7 +35,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
35 35
36 if (system_channels == 6 && device_channels == 2) { 36 if (system_channels == 6 && device_channels == 2) {
37 // We're given 6 channels, but our device only outputs 2, so downmix. 37 // We're given 6 channels, but our device only outputs 2, so downmix.
38 constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f}; 38 constexpr static std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
39 39
40 for (u32 read_index = 0, write_index = 0; read_index < samples.size(); 40 for (u32 read_index = 0, write_index = 0; read_index < samples.size();
41 read_index += system_channels, write_index += device_channels) { 41 read_index += system_channels, write_index += device_channels) {
@@ -106,8 +106,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
106} 106}
107 107
108std::vector<s16> SinkStream::ReleaseBuffer(u64 num_samples) { 108std::vector<s16> SinkStream::ReleaseBuffer(u64 num_samples) {
109 constexpr s32 min = std::numeric_limits<s16>::min(); 109 constexpr static s32 min = std::numeric_limits<s16>::min();
110 constexpr s32 max = std::numeric_limits<s16>::max(); 110 constexpr static s32 max = std::numeric_limits<s16>::max();
111 111
112 auto samples{samples_buffer.Pop(num_samples)}; 112 auto samples{samples_buffer.Pop(num_samples)};
113 113
@@ -202,7 +202,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
202 // If we're paused or going to shut down, we don't want to consume buffers as coretiming is 202 // If we're paused or going to shut down, we don't want to consume buffers as coretiming is
203 // paused and we'll desync, so just play silence. 203 // paused and we'll desync, so just play silence.
204 if (system.IsPaused() || system.IsShuttingDown()) { 204 if (system.IsPaused() || system.IsShuttingDown()) {
205 constexpr std::array<s16, 6> silence{}; 205 constexpr static std::array<s16, 6> silence{};
206 for (size_t i = frames_written; i < num_frames; i++) { 206 for (size_t i = frames_written; i < num_frames; i++) {
207 std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes); 207 std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
208 } 208 }