From e7caeb4d49186af867c1d4693c9f3bf9e9ef99e0 Mon Sep 17 00:00:00 2001 From: deadmasterog <66454702+deadmasterog@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:32:09 -0700 Subject: [PATCH] use static mutex member in RtAudioOutput class to serialize RtAudio calls across instances (#32) --- include/openauto/Projection/RtAudioOutput.hpp | 2 +- openauto/Projection/RtAudioOutput.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/openauto/Projection/RtAudioOutput.hpp b/include/openauto/Projection/RtAudioOutput.hpp index 2cca63d..27bffde 100644 --- a/include/openauto/Projection/RtAudioOutput.hpp +++ b/include/openauto/Projection/RtAudioOutput.hpp @@ -50,7 +50,7 @@ private: uint32_t sampleRate_; SequentialBuffer audioBuffer_; std::unique_ptr dac_; - std::mutex mutex_; + static std::mutex mutex_; }; } diff --git a/openauto/Projection/RtAudioOutput.cpp b/openauto/Projection/RtAudioOutput.cpp index 962fad2..68ae27e 100644 --- a/openauto/Projection/RtAudioOutput.cpp +++ b/openauto/Projection/RtAudioOutput.cpp @@ -24,6 +24,8 @@ namespace openauto namespace projection { +std::mutex RtAudioOutput::mutex_; + RtAudioOutput::RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_t sampleRate) : channelCount_(channelCount) , sampleSize_(sampleSize)