From 91b8d422c11e96549e6f3b256bb4ebefa75e8216 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Mon, 6 Nov 2023 10:46:27 -0600 Subject: [PATCH] Fix for raw audio output on Windows --- src/cpp/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 962ca47..045db78 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -18,6 +18,11 @@ #include #endif +#ifdef _WIN32 + #include + #include +#endif + #ifdef __APPLE__ #include #endif @@ -307,6 +312,12 @@ int main(int argc, char *argv[]) { vector audioBuffer; vector sharedAudioBuffer; +#ifdef _WIN32 + // Needed on Windows to avoid terminal conversions + setmode(fileno(stdout),O_BINARY); + setmode(fileno(stdin),O_BINARY); +#endif + thread rawOutputThread(rawOutputProc, ref(sharedAudioBuffer), ref(mutAudio), ref(cvAudio), ref(audioReady), ref(audioFinished));