45 #include "../test_common/ma_test_common.c"
90 if (strcmp(arg,
"playback") == 0) {
94 if (strcmp(arg,
"capture") == 0) {
98 if (strcmp(arg,
"duplex") == 0) {
102 if (strcmp(arg,
"loopback") == 0) {
118 backendCount = *pBackendCount;
119 if (backendCount == backendCap) {
123 if (strcmp(arg,
"wasapi") == 0) {
127 if (strcmp(arg,
"dsound") == 0) {
131 if (strcmp(arg,
"winmm") == 0) {
135 if (strcmp(arg,
"coreaudio") == 0) {
139 if (strcmp(arg,
"sndio") == 0) {
143 if (strcmp(arg,
"audio4") == 0) {
147 if (strcmp(arg,
"oss") == 0) {
151 if (strcmp(arg,
"pulseaudio") == 0) {
155 if (strcmp(arg,
"alsa") == 0) {
159 if (strcmp(arg,
"jack") == 0) {
163 if (strcmp(arg,
"aaudio") == 0) {
167 if (strcmp(arg,
"opensl") == 0) {
171 if (strcmp(arg,
"webaudio") == 0) {
175 if (strcmp(arg,
"null") == 0) {
181 if (*pBackendCount < backendCount) {
182 *pBackendCount = backendCount;
194 if (strcmp(arg,
"sine") == 0) {
198 if (strcmp(arg,
"square") == 0) {
202 if (strcmp(arg,
"triangle") == 0) {
206 if (strcmp(arg,
"sawtooth") == 0) {
219 if (strcmp(arg,
"white") == 0) {
223 if (strcmp(arg,
"pink") == 0) {
227 if (strcmp(arg,
"brownian") == 0 || strcmp(arg,
"brown") == 0) {
249 detailedDeviceInfo = *pDeviceInfo;
252 printf(
"%s\n", pDeviceInfo->
name);
253 printf(
" Default: %s\n", (detailedDeviceInfo.
isDefault) ?
"Yes" :
"No");
254 printf(
" Min Channels: %d\n", detailedDeviceInfo.
minChannels);
255 printf(
" Max Channels: %d\n", detailedDeviceInfo.
maxChannels);
256 printf(
" Min Sample Rate: %d\n", detailedDeviceInfo.
minSampleRate);
257 printf(
" Max Sample Rate: %d\n", detailedDeviceInfo.
maxSampleRate);
258 printf(
" Format Count: %d\n", detailedDeviceInfo.
formatCount);
259 for (iFormat = 0; iFormat < detailedDeviceInfo.
formatCount; ++iFormat) {
278 result =
ma_context_get_devices(pContext, &pPlaybackDevices, &playbackDeviceCount, &pCaptureDevices, &captureDeviceCount);
283 printf(
"Playback Devices\n");
284 printf(
"----------------\n");
285 for (iDevice = 0; iDevice < playbackDeviceCount; iDevice += 1) {
286 printf(
"%d: ", iDevice);
291 printf(
"Capture Devices\n");
292 printf(
"---------------\n");
293 for (iDevice = 0; iDevice < captureDeviceCount; iDevice += 1) {
294 printf(
"%d: ", iDevice);
318 switch (pDevice->
type)
365 size_t enabledBackendCount;
366 size_t iEnabledBackend;
377 const char* pFilePath =
NULL;
385 for (iarg = 1; iarg < argc; iarg += 1) {
409 pFilePath =
argv[iarg];
414 printf(
"Enabled Backends:\n");
417 printf(
"Failed to retrieve available backends.\n");
421 for (iEnabledBackend = 0; iEnabledBackend < enabledBackendCount; iEnabledBackend += 1) {
432 printf(
"Failed to initialize context.\n");
454 if (deviceChannels == 0) {
457 if (deviceSampleRate == 0) {
458 deviceSampleRate = 48000;
472 printf(
"Failed to initialize device.\n");
484 printf(
"Failed to open file for decoding \"%s\".\n", pFilePath);
496 printf(
"Failed to initialize waveform.\n");
508 printf(
"Failed to initialize noise.\n");
521 printf(
"Failed to initialize output file for capture \"%s\".\n", pFilePath);
533 printf(
"Playback Device: %s\n",
g_State.device.playback.name);
536 printf(
"Capture Device: %s\n",
g_State.device.capture.name);
543 printf(
"Failed to start device.\n");
552 printf(
"Press Q to quit, P to pause.\n");
554 printf(
"Press Q to quit, P to resume.\n");
564 if (c ==
'q' || c ==
'Q') {
567 if (c ==
'p' || c ==
'P') {