Commit 67213fe4 authored by Julien Wadel's avatar Julien Wadel
Browse files

Add default device only if it exists (UWP)

parent 75d4cff7
......@@ -401,6 +401,7 @@ public:
size_t inputlen;
size_t returnlen;
uint8_t capabilities = 0;
int err;
inputlen = wcslen(DeviceName->Data())+1;
returnlen = inputlen * 2;
......@@ -416,6 +417,9 @@ public:
case DeviceClass::AudioCapture:
capabilities = MS_SND_CARD_CAP_CAPTURE;
break;
default:
capabilities = MS_SND_CARD_CAP_PLAYBACK | MS_SND_CARD_CAP_CAPTURE;
break;
}
for (; elem != NULL; elem = elem->next) {
......@@ -447,7 +451,8 @@ public:
} else {
DefaultId = MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Communications);
}
AddOrUpdateCard(DefaultId, DefaultName, _dc);
if(DefaultId != "")
AddOrUpdateCard(DefaultId, DefaultName, _dc);
Windows::Foundation::IAsyncOperation<DeviceInformationCollection^>^ op = DeviceInformation::FindAllAsync(_dc);
op->Completed = ref new Windows::Foundation::AsyncOperationCompletedHandler<DeviceInformationCollection^>(
[this](Windows::Foundation::IAsyncOperation<DeviceInformationCollection^>^ asyncOp, Windows::Foundation::AsyncStatus asyncStatus) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment