From 774df0fd1ed8b66c984b0da3805a16f4bad4f2ec Mon Sep 17 00:00:00 2001 From: Aleksey Selihov <1+faumaray@noreply@void.com> Date: Thu, 3 Dec 2026 08:09:58 +0000 Subject: [PATCH] chore(build): containers, toolchains and portability fixes --- include/Void/System/Audio.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/Void/System/Audio.hpp b/include/Void/System/Audio.hpp index ae50c80..a57bbef 100644 --- a/include/Void/System/Audio.hpp +++ b/include/Void/System/Audio.hpp @@ -263,6 +263,7 @@ class AudioDevice HWAVEOUT wave{}; WAVEHDR header{}; WAVEFORMATEX format{}; + std::vector playback; bool prepared{false}; #endif }; @@ -343,11 +344,14 @@ class AudioDevice "waveOutOpen failed"}}; } voice.header = WAVEHDR{}; + // waveOut only reads the samples, but WAVEHDR exposes a mutable + // buffer; keep an owned mutable copy instead of casting away + // constness of the shared buffer. + voice.playback = voice.buffer->samples; voice.header.lpData = - reinterpret_cast( - const_cast(voice.buffer->samples.data())); + reinterpret_cast(voice.playback.data()); voice.header.dwBufferLength = static_cast( - voice.buffer->samples.size() * sizeof(PcmSample)); + voice.playback.size() * sizeof(PcmSample)); if (::waveOutPrepareHeader(voice.wave, &voice.header, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) {