SDL 2.0 win32 Relative Mouse Movement, Where We Left Off (Plus Audio Bug)

Patrick’s patch should be good to go to put relative mouse movement into
win32. I haven’t found any additional errors in it, and what I
thought was an error was actually something else, which I’ll discuss
in a moment.

So, Sam, if you could, Patrick’s patch (Patrick, point it out again)
should be put into the main, so relative mouse movement in win32 can be
ticked off the list.

Now, the problem. I thought the new relative mouse movement had
continuous clicking, but it was actually SDL2 playing the same sound
over and over.

The – possible – bug is that when I get the audio callback, the buffer
is NOT cleared to silence (I exit early if there is no sounds to play,
as that call is really costly on iOS). Now, I rechecked the docs, and
it isn’t mentioned what the format of the buffer is coming in, but SDL
1.2 worked this way on all platforms, and SDL2 works that way in iOS and
OS X, just not win32, so I suspect this is a change in behavior for
win32 only.

Anybody who knows the audio sub-system well enough to comment? Is there
a new flag I’m missing? This is win32 only.

[>] Brian

Yes, SDL 2 doesn’t clear the audio buffer as an optimization, since it
assumes you’ll fill it entirely each time you get a callback.

CC’ing Ryan to confirm.On Tue, Jul 3, 2012 at 10:59 AM, Brian Barnes wrote:

Patrick’s patch should be good to go to put relative mouse movement into
win32. I haven’t found any additional errors in it, and what I thought
was an error was actually something else, which I’ll discuss in a moment.

So, Sam, if you could, Patrick’s patch (Patrick, point it out again)
should be put into the main, so relative mouse movement in win32 can be
ticked off the list.

Now, the problem. I thought the new relative mouse movement had
continuous clicking, but it was actually SDL2 playing the same sound over
and over.

The – possible – bug is that when I get the audio callback, the buffer
is NOT cleared to silence (I exit early if there is no sounds to play, as
that call is really costly on iOS). Now, I rechecked the docs, and it
isn’t mentioned what the format of the buffer is coming in, but SDL 1.2
worked this way on all platforms, and SDL2 works that way in iOS and OS X,
just not win32, so I suspect this is a change in behavior for win32 only.

Anybody who knows the audio sub-system well enough to comment? Is there a
new flag I’m missing? This is win32 only.

[>] Brian
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Correct; if you have no audio to play, just memset() the buffer to
silence it.

There wasn’t much sense in us doing this if you’re just going to
initialize the whole thing yourself with legitimate audio.

(This is a change from 1.2, which always cleared the buffer before
calling your callback.)

–ryan.On 7/3/12 11:54 PM, Sam Lantinga wrote:

Yes, SDL 2 doesn’t clear the audio buffer as an optimization, since it
assumes you’ll fill it entirely each time you get a callback.

CC’ing Ryan to confirm.