AudioManager.GenerateAudioSessionId Method

Definition

Return a new audio session identifier not associated with any player or effect.

[Android.Runtime.Register("generateAudioSessionId", "()I", "GetGenerateAudioSessionIdHandler")]
public virtual int GenerateAudioSessionId ();
[<Android.Runtime.Register("generateAudioSessionId", "()I", "GetGenerateAudioSessionIdHandler")>]
abstract member GenerateAudioSessionId : unit -> int
override this.GenerateAudioSessionId : unit -> int

Returns

a new unclaimed and unused audio session identifier, or #ERROR when the system failed to generate a new session, a condition in which audio playback or recording will subsequently fail as well.

Attributes

Remarks

Return a new audio session identifier not associated with any player or effect. An audio session identifier is a system wide unique identifier for a set of audio streams (one or more mixed together).

The primary use of the audio session ID is to associate audio effects to audio players, such as MediaPlayer or AudioTrack: all audio effects sharing the same audio session ID will be applied to the mixed audio content of the players that share the same audio session.

This method can for instance be used when creating one of the android.media.audiofx.AudioEffect objects to define the audio session of the effect, or to specify a session for a speech synthesis utterance in android.speech.tts.TextToSpeech.Engine.

Java documentation for android.media.AudioManager.generateAudioSessionId().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to