mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(DSound) Create dsound_set_wavefmt
This commit is contained in:
parent
bdc866d6d5
commit
fa2a748631
@ -328,6 +328,19 @@ static BOOL CALLBACK enumerate_cb(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOI
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dsound_set_wavefmt(WAVEFORMATEX *wfx,
|
||||||
|
unsigned channels, unsigned samplerate)
|
||||||
|
{
|
||||||
|
wfx->wFormatTag = WAVE_FORMAT_PCM;
|
||||||
|
wfx->nBlockAlign = channels * sizeof(int16_t);
|
||||||
|
wfx->wBitsPerSample = 16;
|
||||||
|
|
||||||
|
wfx->nChannels = channels;
|
||||||
|
wfx->nSamplesPerSec = samplerate;
|
||||||
|
wfx->nAvgBytesPerSec = wfx->nSamplesPerSec * wfx->nBlockAlign;
|
||||||
|
wfx->cbSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void *dsound_init(const char *dev, unsigned rate, unsigned latency,
|
static void *dsound_init(const char *dev, unsigned rate, unsigned latency,
|
||||||
unsigned block_frames,
|
unsigned block_frames,
|
||||||
unsigned *new_rate)
|
unsigned *new_rate)
|
||||||
@ -390,12 +403,7 @@ static void *dsound_init(const char *dev, unsigned rate, unsigned latency,
|
|||||||
goto error;
|
goto error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
dsound_set_wavefmt(&wfx, 2, rate);
|
||||||
wfx.nChannels = 2;
|
|
||||||
wfx.nSamplesPerSec = rate;
|
|
||||||
wfx.wBitsPerSample = 16;
|
|
||||||
wfx.nBlockAlign = 2 * sizeof(int16_t);
|
|
||||||
wfx.nAvgBytesPerSec = rate * 2 * sizeof(int16_t);
|
|
||||||
|
|
||||||
ds->buffer_size = (latency * wfx.nAvgBytesPerSec) / 1000;
|
ds->buffer_size = (latency * wfx.nAvgBytesPerSec) / 1000;
|
||||||
ds->buffer_size /= CHUNK_SIZE;
|
ds->buffer_size /= CHUNK_SIZE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user