Table of Contents

Class SessionCollection

Namespace
AudioDeviceLib.CoreAudioApi
Assembly
AudioDeviceLib.dll

A collection of the AudioSessionControl sessions on an audio endpoint.

public sealed class SessionCollection : IDisposable, IReadOnlyList<AudioSessionControl>, IReadOnlyCollection<AudioSessionControl>, IEnumerable<AudioSessionControl>, IEnumerable
Inheritance
SessionCollection
Implements
Inherited Members

Remarks

The underlying IAudioSessionEnumerator is a point-in-time snapshot with a fixed count, so its count is read once when this collection is created and never changes. The sessions themselves are built on first access and memoized one per index: repeated access to the same index returns the same instance (important for registering and later unregistering session notifications on the same object).

Properties

Count

Gets the number of sessions in the collection, fixed when it was created.

public int Count { get; }

Property Value

int

Exceptions

ObjectDisposedException

Thrown when this collection has been disposed.

this[int]

Gets the session at the specified zero-based index (cached per index).

public AudioSessionControl this[int index] { get; }

Parameters

index int

The zero-based index of the session (0 to Count - 1).

Property Value

AudioSessionControl

The AudioSessionControl at the requested position.

Exceptions

COMException

Thrown when the underlying Core Audio call fails.

Methods

Dispose()

Disposes every AudioSessionControl this collection created.

public void Dispose()

GetEnumerator()

Enumerates the controls in this snapshot.

public IEnumerator<AudioSessionControl> GetEnumerator()

Returns

IEnumerator<AudioSessionControl>

An enumerator over the snapshot.