| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include "../miniaudio.c" |
| 11 |
|
| 12 |
#include <stdio.h> |
| 13 |
|
| 14 |
int main(int argc, char** argv) |
| 15 |
{ |
| 16 |
ma_result result; |
| 17 |
ma_context context; |
| 18 |
ma_device_info* pPlaybackDeviceInfos; |
| 19 |
ma_uint32 playbackDeviceCount; |
| 20 |
ma_device_info* pCaptureDeviceInfos; |
| 21 |
ma_uint32 captureDeviceCount; |
| 22 |
ma_uint32 iDevice; |
| 23 |
|
| 24 |
if (ma_context_init(NULL, 0, NULL, &context) != MA_SUCCESS) { |
| 25 |
printf("Failed to initialize context.\n"); |
| 26 |
return -2; |
| 27 |
} |
| 28 |
|
| 29 |
result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); |
| 30 |
if (result != MA_SUCCESS) { |
| 31 |
printf("Failed to retrieve device information.\n"); |
| 32 |
return -3; |
| 33 |
} |
| 34 |
|
| 35 |
printf("Playback Devices\n"); |
| 36 |
for (iDevice = 0; iDevice < playbackDeviceCount; ++iDevice) { |
| 37 |
printf(" %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); |
| 38 |
} |
| 39 |
|
| 40 |
printf("\n"); |
| 41 |
|
| 42 |
printf("Capture Devices\n"); |
| 43 |
for (iDevice = 0; iDevice < captureDeviceCount; ++iDevice) { |
| 44 |
printf(" %u: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
ma_context_uninit(&context); |
| 49 |
|
| 50 |
(void)argc; |
| 51 |
(void)argv; |
| 52 |
return 0; |
| 53 |
} |