Skip to content

Commit adf3993

Browse files
committed
acap,aplay/wasapi: prefer dev name with d=
1 parent ce14086 commit adf3993

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/audio/capture/wasapi.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ string wasapi_get_default_device_id(EDataFlow dataFlow, IMMDeviceEnumerator *enu
195195
}
196196

197197
static void show_help() {
198-
col() << "Usage:\n" <<
199-
SBOLD(SRED("\t-s wasapi") << "[:<index>|:<ID>|:<name>]") <<
200-
"\n\nAvailable devices:\n";
198+
col() << "Usage:\n"
199+
<< SBOLD(SRED("\t-s wasapi") << "[:d[evice]=<index>|<ID>|<name>]")
200+
<< "\n\nAvailable devices:\n";
201201

202202
IMMDeviceEnumerator *enumerator = nullptr;
203203
IMMDeviceCollection *pEndpoints = nullptr;
@@ -248,6 +248,10 @@ parse_fmt(const char *cfg, int *req_index, char *req_dev_name,
248248
return;
249249
}
250250

251+
if (IS_KEY_PREFIX(cfg, "device")) {
252+
cfg = strchr(cfg, '=') + 1;
253+
}
254+
251255
if (isdigit(cfg[0])) {
252256
*req_index = atoi(cfg);
253257
} else if (strcmp(cfg, "loopback") == 0) {

src/audio/playback/wasapi.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,11 @@ static void audio_play_wasapi_probe(struct device_info **available_devices, int
165165
}
166166

167167
static void audio_play_wasapi_help() {
168-
col()
169-
<< "Usage:\n"
170-
<< SBOLD(
171-
SRED("\t-r wasapi")
172-
<< "[:<index>|:<ID>|:<name>] --param audio-buffer-len=<ms>")
173-
<< "\n"
174-
<< "\nAvailable devices:\n";
168+
col() << "Usage:\n"
169+
<< SBOLD(SRED("\t-r wasapi") << "[:d[evice]=<index>|<ID>|<name>] "
170+
"--param audio-buffer-len=<ms>")
171+
<< "\n"
172+
<< "\nAvailable devices:\n";
175173

176174
bool com_initialized = false;
177175
if (!com_initialize(&com_initialized, MOD_NAME)) {
@@ -218,6 +216,10 @@ parse_fmt(const char *cfg, int *req_index, char *req_dev_name,
218216
return;
219217
}
220218

219+
if (IS_KEY_PREFIX(cfg, "device")) {
220+
cfg = strchr(cfg, '=') + 1;
221+
}
222+
221223
if (isdigit(cfg[0])) {
222224
*req_index = atoi(cfg);
223225
} else if (cfg[0] == '{') { // ID

0 commit comments

Comments
 (0)