output/wasapi: EnumerateDevices() logs, no std::vector
This commit is contained in:
parent
a4257e51d5
commit
fc20a1f10a
@ -239,7 +239,6 @@ private:
|
|||||||
bool is_exclusive;
|
bool is_exclusive;
|
||||||
bool enumerate_devices;
|
bool enumerate_devices;
|
||||||
std::string device_config;
|
std::string device_config;
|
||||||
std::vector<std::pair<unsigned int, AllocatedString>> device_desc;
|
|
||||||
ComPtr<IMMDeviceEnumerator> enumerator;
|
ComPtr<IMMDeviceEnumerator> enumerator;
|
||||||
ComPtr<IMMDevice> device;
|
ComPtr<IMMDevice> device;
|
||||||
ComPtr<IAudioClient> client;
|
ComPtr<IAudioClient> client;
|
||||||
@ -604,12 +603,11 @@ void WasapiOutput::OpenDevice() {
|
|||||||
enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr,
|
enumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr,
|
||||||
CLSCTX_INPROC_SERVER);
|
CLSCTX_INPROC_SERVER);
|
||||||
|
|
||||||
if (enumerate_devices && SafeTry([this]() { EnumerateDevices(); })) {
|
if (enumerate_devices) {
|
||||||
for (const auto &[device, desc] : device_desc) {
|
try {
|
||||||
FormatNotice(wasapi_output_domain,
|
EnumerateDevices();
|
||||||
"Device \"%u\" \"%s\"",
|
} catch (...) {
|
||||||
device,
|
LogError(std::current_exception());
|
||||||
desc.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,8 +623,6 @@ void WasapiOutput::OpenDevice() {
|
|||||||
} else {
|
} else {
|
||||||
device = GetDefaultAudioEndpoint(*enumerator);
|
device = GetDefaultAudioEndpoint(*enumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
device_desc.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// run inside COMWorkerThread
|
/// run inside COMWorkerThread
|
||||||
@ -800,15 +796,9 @@ void WasapiOutput::FindSharedFormatSupported(AudioFormat &audio_format) {
|
|||||||
|
|
||||||
/// run inside COMWorkerThread
|
/// run inside COMWorkerThread
|
||||||
void WasapiOutput::EnumerateDevices() {
|
void WasapiOutput::EnumerateDevices() {
|
||||||
if (!device_desc.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto device_collection = EnumAudioEndpoints(*enumerator);
|
const auto device_collection = EnumAudioEndpoints(*enumerator);
|
||||||
|
|
||||||
const UINT count = GetCount(*device_collection);
|
const UINT count = GetCount(*device_collection);
|
||||||
|
|
||||||
device_desc.reserve(count);
|
|
||||||
for (UINT i = 0; i < count; ++i) {
|
for (UINT i = 0; i < count; ++i) {
|
||||||
const auto enumerated_device = Item(*device_collection, i);
|
const auto enumerated_device = Item(*device_collection, i);
|
||||||
|
|
||||||
@ -820,7 +810,8 @@ void WasapiOutput::EnumerateDevices() {
|
|||||||
if (name == nullptr)
|
if (name == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
device_desc.emplace_back(i, std::move(name));
|
FormatNotice(wasapi_output_domain,
|
||||||
|
"Device \"%u\" \"%s\"", i, name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user