Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion SOURCE/AudioDeviceCmdlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public bool IsDefaultCommunication(string ID)
public class GetAudioDevice : Cmdlet
{
// Parameter called to list all devices
[Parameter(Mandatory = true, Position = 0, ParameterSetName = "List")]
[Parameter(Mandatory = true, Position = 0, ParameterSetName = "ShowDisabled")]
public SwitchParameter List
{
get { return list; }
Expand Down Expand Up @@ -360,6 +360,25 @@ protected override void ProcessRecord()
WriteObject(new AudioDevice(i + 1, DeviceCollection[i], Toolkit.IsDefault(DeviceCollection[i].ID), Toolkit.IsDefaultCommunication(DeviceCollection[i].ID)));
}

// If the ShowDisabled parameter was called
if (showdisabled)
{
// The ShowDisabled parameter was called

// Get enabled DeviceCollection count
int enabledCount = DeviceCollection.Count;

// Get MMDeviceCollection of every disabled devices
DeviceCollection = DevEnum.EnumerateAudioEndPoints(EDataFlow.eAll, EDeviceState.DEVICE_STATE_UNPLUGGED);

// For every MMDevice in DeviceCollection
for (int i = 0; i < DeviceCollection.Count; i++)
{
// Output the result of the creation of a new AudioDevice while assining it an index, and the MMDevice itself
WriteObject(new AudioDevice(i + 1 + enabledCount, DeviceCollection[i]));
}
}

// Stop checking for other parameters
return;
}
Expand Down