Add --only-enumerate option to deviceio test.

This commit is contained in:
David Reid
2026-01-15 09:09:55 +10:00
parent cbe640efbf
commit 6c0c35387d
+12 -1
View File
@@ -1,5 +1,5 @@
/*
USAGE: deviceio [input/output file] [mode] [backend] [waveform] [noise] [threading mode] [exclusive] [--playback-device [index]] [--capture-device [index]] [--channels [count]] [--rate [sample_rate]] [--periods [count]] [--period-size [frames]] [--detailed-info] [--auto]
USAGE: deviceio [input/output file] [mode] [backend] [waveform] [noise] [threading mode] [exclusive] [--playback-device [index]] [--capture-device [index]] [--channels [count]] [--rate [sample_rate]] [--periods [count]] [--period-size [frames]] [--detailed-info] [--only-enumerate] [--auto]
In playback mode the input file is optional, in which case a waveform or noise source will be used instead. For capture and loopback modes
it must specify an output parameter, and must be specified. In duplex mode it is optional, but if specified will be an output file that
@@ -496,6 +496,7 @@ int main(int argc, char** argv)
int captureDeviceIndex = -1;
const char* pFilePath = NULL; /* Input or output file path, depending on the mode. */
ma_bool32 enumerate = MA_TRUE;
ma_bool32 onlyEnumerate = MA_TRUE;
ma_bool32 interactive = MA_TRUE;
ma_device_backend_info backendInfo;
ma_bool32 printDetailedInfo = MA_FALSE;
@@ -570,6 +571,11 @@ int main(int argc, char** argv)
continue;
}
if (strcmp(argv[iarg], "--only-enumerate") == 0) {
onlyEnumerate = MA_TRUE;
continue;
}
if (strcmp(argv[iarg], "exclusive") == 0) {
shareMode = ma_share_mode_exclusive;
continue;
@@ -633,6 +639,11 @@ int main(int argc, char** argv)
enumerate_devices(printDetailedInfo);
}
if (onlyEnumerate) {
ma_context_uninit(&g_State.context);
return 0;
}
/*
Now that the context has been initialized we can do the device. In duplex mode we want to use the same format for both playback and capture so we don't need
to do any data conversion between the two.