summaryrefslogtreecommitdiff
path: root/src/audio_core/sink
diff options
context:
space:
mode:
authorGravatar Billy Laws2023-03-26 20:07:03 +0100
committerGravatar Billy Laws2023-03-27 22:01:41 +0100
commit237934b73690a56ff756d6e682fa336dee8c95a4 (patch)
treed2f584df73859445f60d1ee8bb03e0a81e281e46 /src/audio_core/sink
parentaudio: Wait for samples on the emulated DSP side to avoid desyncs (diff)
downloadyuzu-237934b73690a56ff756d6e682fa336dee8c95a4.tar.gz
yuzu-237934b73690a56ff756d6e682fa336dee8c95a4.tar.xz
yuzu-237934b73690a56ff756d6e682fa336dee8c95a4.zip
Run clang-format
Diffstat (limited to 'src/audio_core/sink')
-rw-r--r--src/audio_core/sink/sink_stream.cpp10
-rw-r--r--src/audio_core/sink/sink_stream.h1
2 files changed, 5 insertions, 6 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index a54c61845..084ac5edf 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -245,9 +245,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
245 // Successfully dequeued a new buffer. 245 // Successfully dequeued a new buffer.
246 queued_buffers--; 246 queued_buffers--;
247 247
248 { 248 { std::unique_lock lk{release_mutex}; }
249 std::unique_lock lk{release_mutex};
250 }
251 249
252 release_cv.notify_one(); 250 release_cv.notify_one();
253 } 251 }
@@ -276,7 +274,8 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
276 274
277 { 275 {
278 std::scoped_lock lk{sample_count_lock}; 276 std::scoped_lock lk{sample_count_lock};
279 last_sample_count_update_time = Core::Timing::CyclesToUs(system.CoreTiming().GetClockTicks()); 277 last_sample_count_update_time =
278 Core::Timing::CyclesToUs(system.CoreTiming().GetClockTicks());
280 min_played_sample_count = max_played_sample_count; 279 min_played_sample_count = max_played_sample_count;
281 max_played_sample_count += actual_frames_written; 280 max_played_sample_count += actual_frames_written;
282 } 281 }
@@ -315,7 +314,8 @@ u64 SinkStream::GetExpectedPlayedSampleCount() {
315 314
316void SinkStream::WaitFreeSpace() { 315void SinkStream::WaitFreeSpace() {
317 std::unique_lock lk{release_mutex}; 316 std::unique_lock lk{release_mutex};
318 release_cv.wait(lk, [this]() { return queued_buffers < max_queue_size || system.IsShuttingDown(); }); 317 release_cv.wait(
318 lk, [this]() { return queued_buffers < max_queue_size || system.IsShuttingDown(); });
319} 319}
320 320
321} // namespace AudioCore::Sink 321} // namespace AudioCore::Sink
diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h
index 709f3b0ec..9806e6d98 100644
--- a/src/audio_core/sink/sink_stream.h
+++ b/src/audio_core/sink/sink_stream.h
@@ -16,7 +16,6 @@
16#include "common/reader_writer_queue.h" 16#include "common/reader_writer_queue.h"
17#include "common/ring_buffer.h" 17#include "common/ring_buffer.h"
18#include "common/thread.h" 18#include "common/thread.h"
19#include "common/polyfill_thread.h"
20 19
21namespace Core { 20namespace Core {
22class System; 21class System;