Skip to content

Commit

Permalink
Merge pull request #52 from jsakamoto/fix/incorrect-isdefaultdev
Browse files Browse the repository at this point in the history
Fix: "IsDefaultDevice" property may be incorrect.
  • Loading branch information
Sean Chapman authored Apr 22, 2020
2 parents 2eb66e7 + f4e1e31 commit 9f94a72
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions AudioSwitcher.AudioApi.CoreAudio/CoreAudioDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,14 @@ private void LoadProperties()
Marshal.ThrowExceptionForHR(Device.GetState(out _state));
Marshal.ThrowExceptionForHR(Device.GetId(out _globalId));

//load the initial default state. Have to query using device id because this device is not cached until after creation
_isDefaultCommDevice = _controller.GetDefaultDeviceId(DeviceType, Role.Communications) == RealId;
_isDefaultDevice = _controller.GetDefaultDeviceId(DeviceType, Role.Multimedia | Role.Console) == RealId;

// ReSharper disable once SuspiciousTypeConversion.Global
var ep = Device as IMultimediaEndpoint;
ep?.GetDataFlow(out _dataFlow);

//load the initial default state. Have to query using device id because this device is not cached until after creation
_isDefaultCommDevice = _controller.GetDefaultDeviceId(DeviceType, Role.Communications) == RealId;
_isDefaultDevice = _controller.GetDefaultDeviceId(DeviceType, Role.Multimedia | Role.Console) == RealId;

GetPropertyInformation(Device);
}

Expand Down

0 comments on commit 9f94a72

Please sign in to comment.