# HG changeset patch # User Ryan C. Gordon # Date 1470785746 14400 # Node ID 757db914bde044b8ba04faeeea1ba666d685a159 # Parent cc6461b9c5bc944f907ea073d066155f650f612b 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... diff -r cc6461b9c5bc -r 757db914bde0 src/audio/directsound/SDL_directsound.c --- a/src/audio/directsound/SDL_directsound.c Tue Aug 09 16:58:32 2016 -0400 +++ b/src/audio/directsound/SDL_directsound.c Tue Aug 09 19:35:46 2016 -0400 @@ -361,9 +361,6 @@ 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 @@ 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;