Commit dd49d79c authored by Art Pinch's avatar Art Pinch Committed by Simon Redman
Browse files

[SystemVolumePlugin][Windows] Send data about default audio device

parent 14dff16f
......@@ -260,6 +260,13 @@ bool SystemvolumePlugin::sendSinkList()
}
unsigned int deviceCount;
devices->GetCount(&deviceCount);
IMMDevice *defaultDevice = nullptr;
deviceEnumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &defaultDevice);
LPWSTR defaultId = NULL;
defaultDevice->GetId(&defaultId);
for (unsigned int i = 0; i < deviceCount; i++)
{
IMMDevice *device = nullptr;
......@@ -310,6 +317,7 @@ bool SystemvolumePlugin::sendSinkList()
sinkObject.insert(QStringLiteral("muted"), (bool)muted);
sinkObject.insert(QStringLiteral("volume"), (qint64)(volume * 100));
sinkObject.insert(QStringLiteral("maxVolume"), (qint64)100);
sinkObject.insert(QStringLiteral("enabled"), lstrcmpW(deviceId, defaultId) == 0);
// Register Callback
if (!sinkList.contains(name)) {
......@@ -325,6 +333,7 @@ bool SystemvolumePlugin::sendSinkList()
array.append(sinkObject);
}
devices->Release();
defaultDevice->Release();
document.setArray(array);
......
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