I think it looks mostly okay.Here is the patch
GUIGraphicsContext.DeviceAudioConnected = GUIGraphicsContext.DeviceAudioConnected + 1;
public static int DeviceAudioConnected
{
get { return _deviceAudioConnected; }
set
{
if (value > _deviceAudioConnected)
{
_deviceAudioConnected = value;
Log.Debug("GraphicContext: device audio connected - Count {0}", _deviceAudioConnected);
}
else if (value < _deviceAudioConnected)
{
_deviceAudioConnected = value < 0 ? 0 : value;
Log.Debug("GraphicContext: device audio removed - Count {0}", _deviceAudioConnected);
}
}
}
Yes, I understand.Not sure if you follow me lol
_deviceAudioConnected = 0;
DsDevice[] devices = DsDevice.GetDevicesOfCat(FilterCategory.AMKSAudio); // KSCATEGORY_AUDIO
if (devices != null)
{
_deviceAudioConnected += devices.Length;
foreach (DsDevice d in devices)
{
d.Dispose();
}
}
devices = DsDevice.GetDevicesOfCat(FilterCategory.AMKSRender); // KSCATEGORY_RENDER
if (devices != null)
{
_deviceAudioConnected += devices.Length;
foreach (DsDevice d in devices)
{
d.Dispose();
}
}
devices = DsDevice.GetDevicesOfCat(RDP_REMOTE_AUDIO);
if (devices != null)
{
_deviceAudioConnected += devices.Length;
foreach (DsDevice d in devices)
{
d.Dispose();
}
}
Log.Debug("Main: audio renderer count at startup = {0}", _deviceAudioConnected);
Yes, I understand.Not sure if you follow me lol
Based on this code:
https://github.com/MediaPortal/Medi.../MediaPortal.Application/MediaPortal.cs#L2071
...in DirectShow I would do it like this:
Code:_deviceAudioConnected = 0; DsDevice[] devices = DsDevice.GetDevicesOfCat(FilterCategory.AMKSAudio); // KSCATEGORY_AUDIO if (devices != null) { _deviceAudioConnected += devices.Length; foreach (DsDevice d in devices) { d.Dispose(); } } devices = DsDevice.GetDevicesOfCat(FilterCategory.AMKSRender); // KSCATEGORY_RENDER if (devices != null) { _deviceAudioConnected += devices.Length; foreach (DsDevice d in devices) { d.Dispose(); } } devices = DsDevice.GetDevicesOfCat(RDP_REMOTE_AUDIO); if (devices != null) { _deviceAudioConnected += devices.Length; foreach (DsDevice d in devices) { d.Dispose(); } } Log.Debug("Main: audio renderer count at startup = {0}", _deviceAudioConnected);
Surely there are other ways to do it with WMI/WQL etc.