On 5/6/20 8:22 AM, Volker Rümelin wrote:
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index 4cdf19ab67..bba6bafda4 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -454,7 +454,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size_t
*size)
return ret;
}
-static size_t dsound_put_buffer_out(HWVoiceOut *hw, void *buf, size_t len)
+static size_t dsound_put_buffer_out(HWVoiceOut *hw, const void *buf, size_t
len)
{
DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;
LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer;
You forgot to make the buffer const in dsound_put_buffer_in().
I had to cast buf to LPVOID in dsound_get_buffer_in() and
dsound_put_buffer_in() because otherwise I see:
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c: In function
'dsound_put_buffer_out':
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:466:38: error: passing
argument 2 of 'dsound_unlock_out' discards 'const' qualifier from pointer
target type [-Werror=discarded-qualifiers]
466 | int err = dsound_unlock_out(dsb, buf, NULL, len, 0);
| ^~~
In file included from
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:266:
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsound_template.h:48:12: note:
expected 'LPVOID' {aka 'void *'} but argument is of type 'const void *'
48 | LPVOID p1,
| ~~~~~~~^~
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c: In function
'dsound_put_buffer_in':
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:571:38: error: passing
argument 2 of 'dsound_unlock_in' discards 'const' qualifier from pointer target
type [-Werror=discarded-qualifiers]
571 | int err = dsound_unlock_in(dscb, buf, NULL, len, 0);
| ^~~
In file included from
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsoundaudio.c:268:
C:/usr/msys64/home/ruemelin/git/qemu/audio/dsound_template.h:48:12: note:
expected 'LPVOID' {aka 'void *'} but argument is of type 'const void *'
48 | LPVOID p1,
| ~~~~~~~^~
OK thanks for testing. This is unfortunate, because a single backend
invalidates the whole series.
I don't understand why the DirectSound API requires a writable buffer
for locking.
With best regards,
Volker