mirror of https://github.com/encounter/SDL.git
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...
This commit is contained in:
parent
358a168c9d
commit
7a8e4cb019
|
@ -361,9 +361,6 @@ CreateSecondary(_THIS, HWND focus)
|
||||||
wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8);
|
wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8);
|
||||||
wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign;
|
wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign;
|
||||||
|
|
||||||
/* Update the fragment size as size in bytes */
|
|
||||||
SDL_CalculateAudioSpec(&this->spec);
|
|
||||||
|
|
||||||
/* Try to set primary mixing privileges */
|
/* Try to set primary mixing privileges */
|
||||||
if (focus) {
|
if (focus) {
|
||||||
result = IDirectSound_SetCooperativeLevel(sndObj,
|
result = IDirectSound_SetCooperativeLevel(sndObj,
|
||||||
|
@ -447,6 +444,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
||||||
case AUDIO_F32:
|
case AUDIO_F32:
|
||||||
tried_format = SDL_TRUE;
|
tried_format = SDL_TRUE;
|
||||||
this->spec.format = test_format;
|
this->spec.format = test_format;
|
||||||
|
/* Update the fragment size as size in bytes */
|
||||||
|
SDL_CalculateAudioSpec(&this->spec);
|
||||||
this->hidden->num_buffers = CreateSecondary(this, NULL);
|
this->hidden->num_buffers = CreateSecondary(this, NULL);
|
||||||
if (this->hidden->num_buffers > 0) {
|
if (this->hidden->num_buffers > 0) {
|
||||||
valid_format = SDL_TRUE;
|
valid_format = SDL_TRUE;
|
||||||
|
|
Loading…
Reference in New Issue