Edit

Share via


AudioSessionRouteChangeEventArgs Class

Definition

Provides data for the AudioRouteChanged event.

public class AudioSessionRouteChangeEventArgs : EventArgs
type AudioSessionRouteChangeEventArgs = class
    inherit EventArgs
Inheritance
AudioSessionRouteChangeEventArgs

Remarks

Instances encapsulate both the Reason for the AudioRouteChanged event to be raised as well as the information about the previous set of active input and output audio routes as well as the new ones.

void DisplayRoutes (string caption, AudioSessionInputRouteKind input, AudioSessionOutputRouteKind [] output)
{
	if (output == null)
		Console.WriteLine ("No outputs");
	else if (output.Length == 1)	
		Console.WriteLine ("Output {0}", output [0]);
	else
		for (int i = 0; i < output.Length; i++)
			Console.WriteLine ("Output {0}", output [i])

	Console.WriteLine (input.ToString ());
} 

void Setup ()
{
    AudioSession.AudioRouteChanged += (sender, args) =&gt; {
        DisplayRoutes ("Current Routes", args.CurrentInputRoute, args.CurrentOutputRoutes),
        DisplayRoutes ("Old Routes", args.PreviousInputRoute, args.PreviousOutputRoutes),
        Console.WriteLine (args.Reason);
    };
}

Constructors

AudioSessionRouteChangeEventArgs(IntPtr)

Initializes a new instance of the AudioSessionRouteChangeEventArgs class.

Properties

CurrentInputRoute

The current audio input route.

CurrentOutputRoutes

Current output audio routes, typically contains a single value, but can contain more than one.

Dictionary

Dictionary passed by the runtime with all of the information about the route change.

PreviousInputRoute

The previous audio input route.

PreviousOutputRoutes

Current output audio routes, typically contains a single value, but can contain more than one.

Reason

Developers should not use this deprecated property.

Applies to