early-access version 3158

This commit is contained in:
pineappleEA
2022-11-27 02:38:07 +01:00
parent b2cb15f351
commit 8715f21bc6
8 changed files with 31 additions and 14 deletions

View File

@@ -266,19 +266,18 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
}
void SinkStream::Stall() {
if (stalled) {
if (IsStalled()) {
return;
}
stalled = true;
system.StallProcesses();
stalled_lock = system.StallProcesses();
}
void SinkStream::Unstall() {
if (!stalled) {
if (!IsStalled()) {
return;
}
system.UnstallProcesses();
stalled = false;
stalled_lock.unlock();
}
} // namespace AudioCore::Sink

View File

@@ -6,6 +6,7 @@
#include <array>
#include <atomic>
#include <memory>
#include <mutex>
#include <span>
#include <vector>
@@ -209,6 +210,11 @@ public:
*/
void Unstall();
private:
[[nodiscard]] bool IsStalled() const {
return stalled_lock.owns_lock();
}
protected:
/// Core system
Core::System& system;
@@ -241,7 +247,7 @@ private:
/// Set via IAudioDevice service calls
f32 device_volume{1.0f};
/// True if coretiming has been stalled
bool stalled{false};
std::unique_lock<std::mutex> stalled_lock;
};
using SinkStreamPtr = std::unique_ptr<SinkStream>;