chore(build): containers, toolchains and portability fixes
This commit is contained in:
1 parent
f8e183b7ab
commit
774df0fd1e
1 file changed
+7
-3
@@ -263,6 +263,7 @@ class AudioDevice
|
|||||||
HWAVEOUT wave{};
|
HWAVEOUT wave{};
|
||||||
WAVEHDR header{};
|
WAVEHDR header{};
|
||||||
WAVEFORMATEX format{};
|
WAVEFORMATEX format{};
|
||||||
|
std::vector<PcmSample> playback;
|
||||||
bool prepared{false};
|
bool prepared{false};
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -343,11 +344,14 @@ class AudioDevice
|
|||||||
"waveOutOpen failed"}};
|
"waveOutOpen failed"}};
|
||||||
}
|
}
|
||||||
voice.header = WAVEHDR{};
|
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 =
|
voice.header.lpData =
|
||||||
reinterpret_cast<LPSTR>(
|
reinterpret_cast<LPSTR>(voice.playback.data());
|
||||||
const_cast<PcmSample*>(voice.buffer->samples.data()));
|
|
||||||
voice.header.dwBufferLength = static_cast<DWORD>(
|
voice.header.dwBufferLength = static_cast<DWORD>(
|
||||||
voice.buffer->samples.size() * sizeof(PcmSample));
|
voice.playback.size() * sizeof(PcmSample));
|
||||||
if (::waveOutPrepareHeader(voice.wave, &voice.header,
|
if (::waveOutPrepareHeader(voice.wave, &voice.header,
|
||||||
sizeof(WAVEHDR)) !=
|
sizeof(WAVEHDR)) !=
|
||||||
MMSYSERR_NOERROR) {
|
MMSYSERR_NOERROR) {
|
||||||
|
|||||||
Reference in new issue
Block a user