Click or drag to resize
Accord.NET (logo)

AudioDeviceCollection Class

Audio Device Collection
Inheritance Hierarchy

Namespace:  Accord.DirectSound
Assembly:  Accord.Audio.DirectSound (in Accord.Audio.DirectSound.dll) Version: 3.7.0
public class AudioDeviceCollection : IEnumerable
Request Example View Source

The AudioDeviceCollection type exposes the following members.

Public methodAudioDeviceCollection
Creates a AudioDeviceCollection class containing devices of the given category.
Public propertyCategory
Gets the category of the audio devices listed by this collection.
Public propertyDefault
Gets the default audio device of the chosen category.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumerator that iterates through the device collection.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Extension Methods
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodSetEqualsAudioDeviceInfo
Compares two enumerables for set equality. Two enumerables are set equal if they contain the same elements, but not necessarily in the same order.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Objects of this class may be used to iterate through available audio devices present in the system. For example, by creating a AudioDeviceCollection specifying AudioDeviceCategory.Output to its constructor, it will be possible to iterate through all available output devices detected by DirectSound. To list capture devices, use AudioDeviceCategory.Capture instead.

The source code below shows a typical usage of AudioDeviceCollection.

// Create a new AudioDeviceCollection to list output devices:
var collection = new AudioDeviceCollection(AudioDeviceCategory.Output);

// Print all devices available in the system
foreach (var device in collection)

// Get the default audio device in the system
var defaultDevice = collection.Default;
See Also