Skip to content

Commit

Permalink
directsound: recalculate audiospec size before creating secondary buf…
Browse files Browse the repository at this point in the history
…fer.

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...
  • Loading branch information
icculus committed Aug 9, 2016
1 parent 358a168 commit 7a8e4cb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/audio/directsound/SDL_directsound.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7a8e4cb

Please sign in to comment.