-
Notifications
You must be signed in to change notification settings - Fork 471
Open
Description
Hey
on windows 11, cscore v1.2.1.2 I am attempting to override the "listen to this device" checkbox property value of the recording device
private void button1_Click(object sender, EventArgs e)
{
// Create the MMDeviceEnumerator COM object to interact with audio devices
var deviceEnumerator = new MMDeviceEnumerator();
MMDeviceCollection devices = deviceEnumerator.EnumAudioEndpoints(DataFlow.Capture, DeviceState.Active);
var deviceID = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}";
foreach (var deviceI in devices)
{
deviceID = deviceI.DeviceID;
break;
}
// GetDevice using the device id
var device = deviceEnumerator.GetDevice(deviceID);
// Open the PropertyStore
var propertyStore = device.PropertyStore;
// Define required GUID and PID
var checkBoxGuid = new Guid("{24DBB0FC-9311-4B3D-9CF0-18FF155639D4}");
var checkBoxPid = 1;
// Go through properties
foreach (var pro in propertyStore)
{
var key = pro.Key;
if (key.PropertyID != checkBoxPid)
continue;
if (key.ID != checkBoxGuid)
continue;
var val = pro.Value;
val.BoolValue = !val.BoolValue;
/*var val2 = new PropertyVariant();
val2.DataType = VarEnum.VT_BOOL;
val2.BoolValue = true;
val2.BoolValue = !val.BoolValue;*/
// Update the value
propertyStore.SetValue(key, val);
break;
};
}I get the exception
CSCore.Win32.Win32ComException: 'IPropertyStore::SetValue caused an error: 0x80070005, "Access is denied.".'
in any mode (release, debug) and with Admin rights.
is there anything apparent missing?
Metadata
Metadata
Assignees
Labels
No labels