mirror of
https://github.com/encounter/SDL.git
synced 2025-12-18 17:35:39 +00:00
Add SDL_GetAudioDeviceSpec.
This API is supported by pipewire, pulseaudio, coreaudio, wasapi, and disk.
This commit is contained in:
@@ -75,12 +75,19 @@ static void DetectWave##typ##Devs(void) { \
|
||||
const UINT iscapture = iscap ? 1 : 0; \
|
||||
const UINT devcount = wave##typ##GetNumDevs(); \
|
||||
capstyp##2W caps; \
|
||||
SDL_AudioSpec spec; \
|
||||
UINT i; \
|
||||
SDL_zero(spec); \
|
||||
for (i = 0; i < devcount; i++) { \
|
||||
if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \
|
||||
char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \
|
||||
if (name != NULL) { \
|
||||
SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \
|
||||
/* Note that freq/format are not filled in, as this information \
|
||||
* is not provided by the caps struct! At best, we get possible \
|
||||
* sample formats, but not an _active_ format. \
|
||||
*/ \
|
||||
spec.channels = caps.wChannels; \
|
||||
SDL_AddAudioDevice((int) iscapture, name, &spec, (void *) ((size_t) i+1)); \
|
||||
SDL_free(name); \
|
||||
} \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user