summaryrefslogtreecommitdiff
path: root/src/audio_core/device
diff options
context:
space:
mode:
authorGravatar Billy Laws2023-03-18 20:52:02 +0000
committerGravatar Billy Laws2023-03-26 22:48:57 +0100
commitd8fc3f403b62e2b3d67ec08791fdc66847ddb4ac (patch)
tree7a5e37809980a7c4988df5845e6daf161d7e859f /src/audio_core/device
parentMerge pull request #9994 from liamwhite/integer-constant (diff)
downloadyuzu-d8fc3f403b62e2b3d67ec08791fdc66847ddb4ac.tar.gz
yuzu-d8fc3f403b62e2b3d67ec08791fdc66847ddb4ac.tar.xz
yuzu-d8fc3f403b62e2b3d67ec08791fdc66847ddb4ac.zip
audio: Interpolate system manager sample count using host sink sample info
This avoids the need to stall if the host sink sporadically misses the deadline, in such a case the previous implementation would report them samples as being played on-time, causing the guest to send more samples and leading to a gradual buildup.
Diffstat (limited to 'src/audio_core/device')
-rw-r--r--src/audio_core/device/device_session.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp
index 5a327a606..ad0f40e28 100644
--- a/src/audio_core/device/device_session.cpp
+++ b/src/audio_core/device/device_session.cpp
@@ -121,8 +121,7 @@ u64 DeviceSession::GetPlayedSampleCount() const {
121} 121}
122 122
123std::optional<std::chrono::nanoseconds> DeviceSession::ThreadFunc() { 123std::optional<std::chrono::nanoseconds> DeviceSession::ThreadFunc() {
124 // Add 5ms of samples at a 48K sample rate. 124 played_sample_count = stream->GetExpectedPlayedSampleCount();
125 played_sample_count += 48'000 * INCREMENT_TIME / 1s;
126 if (type == Sink::StreamType::Out) { 125 if (type == Sink::StreamType::Out) {
127 system.AudioCore().GetAudioManager().SetEvent(Event::Type::AudioOutManager, true); 126 system.AudioCore().GetAudioManager().SetEvent(Event::Type::AudioOutManager, true);
128 } else { 127 } else {