From 7a8e4cb019fb90df43025b3a328097a8076a6681 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 9 Aug 2016 19:35:46 -0400 Subject: [PATCH] directsound: recalculate audiospec size before creating secondary buffer. I think this was a bug before? Maybe I'm misunderstanding this, but it looks like it was working because we allocate room for 8 chunks... --- src/audio/directsound/SDL_directsound.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 0f17362b9..f48d3005e 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -361,9 +361,6 @@ CreateSecondary(_THIS, HWND focus) wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8); wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign; - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&this->spec); - /* Try to set primary mixing privileges */ if (focus) { result = IDirectSound_SetCooperativeLevel(sndObj, @@ -447,6 +444,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) case AUDIO_F32: tried_format = SDL_TRUE; this->spec.format = test_format; + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); this->hidden->num_buffers = CreateSecondary(this, NULL); if (this->hidden->num_buffers > 0) { valid_format = SDL_TRUE;