Class AudioStreamPolicy

    Definition

    Namespace:
    Tizen.Multimedia
    Assembly:
    Tizen.Multimedia.dll

    Provides the ability to control the sound stream.

    public class AudioStreamPolicy : IDisposable
    Inheritance
    object
    AudioStreamPolicy
    Implements
    System.IDisposable

    Constructors

    View Source

    AudioStreamPolicy(AudioStreamType)

    Initializes a new instance of the AudioStreamPolicy class with AudioStreamType.

    Declaration
    public AudioStreamPolicy(AudioStreamType streamType)
    Parameters
    Type Name Description
    AudioStreamType streamType

    The type of the sound stream for which the policy needs to be created.

    Remarks

    To apply the stream policy according to this stream information, the AudioStreamPolicy should be passed to other APIs related to playback or recording. (For example., Player, WavPlayer , etc.)

    Exceptions
    Type Condition
    System.ArgumentException

    streamType is invalid.

    Properties

    View Source

    FocusReacquisitionEnabled

    Gets or sets the auto focus reacquisition.

    Declaration
    public bool FocusReacquisitionEnabled { get; set; }
    Property Value
    Type Description
    bool

    true if the auto focus reacquisition is enabled; otherwise, false.
    The default is true.

    Remarks

    If you don't want to reacquire the focus you've lost automatically, disable the focus reacquisition.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    View Source

    PlaybackFocusState

    Gets the state of focus for the playback.

    Declaration
    public AudioStreamFocusState PlaybackFocusState { get; }
    Property Value
    Type Description
    AudioStreamFocusState

    The state of focus for playback.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    View Source

    RecordingFocusState

    Gets the state of focus for the recording.

    Declaration
    public AudioStreamFocusState RecordingFocusState { get; }
    Property Value
    Type Description
    AudioStreamFocusState

    The state of focus for recording.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    View Source

    VolumeType

    Gets the AudioVolumeType.

    Declaration
    public AudioVolumeType VolumeType { get; }
    Property Value
    Type Description
    AudioVolumeType

    The AudioVolumeType of the policy instance.

    Remarks

    If the AudioStreamType of the current AudioStreamPolicy is Emergency, it returns None.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    Methods

    View Source

    AcquireFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)

    Acquires the stream focus.

    Declaration
    public void AcquireFocus(AudioStreamFocusOptions options, AudioStreamBehaviors behaviors, string extraInfo)
    Parameters
    Type Name Description
    AudioStreamFocusOptions options

    The focuses that you want to acquire.

    AudioStreamBehaviors behaviors

    The requesting behaviors.

    string extraInfo

    The extra information for this request. This value can be null.

    Exceptions
    Type Condition
    System.ArgumentException

    options is zero.

    System.ArgumentOutOfRangeException

    options contain a invalid bit.
    -or-
    behaviors contain a invalid bit.

    System.InvalidOperationException

    The focus has already been acquired.

    AudioPolicyException

    Called in FocusStateChanged raised by releasing focus.

    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    View Source

    AddDeviceForStreamRouting(AudioDevice)

    Adds a device for the stream routing.

    Declaration
    public void AddDeviceForStreamRouting(AudioDevice device)
    Parameters
    Type Name Description
    AudioDevice device

    The device to add.

    Remarks

    The available AudioStreamType is Voip and MediaExternalOnly.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The device is not connected.
    -or-
    An internal error occurs.

    System.ArgumentNullException

    device is null.

    AudioPolicyException

    AudioStreamType of device is unavailable for this.

    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    See Also
    GetConnectedDevices()
    ApplyStreamRouting()
    View Source

    ApplyStreamRouting()

    Applies the stream routing.

    Declaration
    public void ApplyStreamRouting()
    Remarks

    If the stream has not been made yet, this will be applied when the stream starts to play.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    See Also
    AddDeviceForStreamRouting(AudioDevice)
    RemoveDeviceForStreamRouting(AudioDevice)
    View Source

    Dispose()

    Releases all resources used by the AudioStreamPolicy.

    Declaration
    public void Dispose()
    View Source

    Dispose(bool)

    Releases the unmanaged resources used by the AudioStreamPolicy.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    View Source

    ReleaseFocus(AudioStreamFocusOptions, AudioStreamBehaviors, string)

    Releases the acquired focus.

    Declaration
    public void ReleaseFocus(AudioStreamFocusOptions options, AudioStreamBehaviors behaviors, string extraInfo)
    Parameters
    Type Name Description
    AudioStreamFocusOptions options

    The focus mask that you want to release.

    AudioStreamBehaviors behaviors

    The requesting behaviors.

    string extraInfo

    The extra information for this request. This value can be null.

    Exceptions
    Type Condition
    System.ArgumentException

    options is zero.

    System.ArgumentOutOfRangeException

    options contain a invalid bit.
    -or-
    behaviors contain a invalid bit.

    System.InvalidOperationException

    The focus has not been acquired.

    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    View Source

    RemoveDeviceForStreamRouting(AudioDevice)

    Removes the device for the stream routing.

    Declaration
    public void RemoveDeviceForStreamRouting(AudioDevice device)
    Parameters
    Type Name Description
    AudioDevice device

    The device to remove.

    Remarks

    The available AudioStreamType is Voip and MediaExternalOnly.

    Exceptions
    Type Condition
    System.InvalidOperationException

    An internal error occurs.

    System.ArgumentNullException

    device is null.

    System.ObjectDisposedException

    The AudioStreamPolicy has already been disposed of.

    See Also
    GetConnectedDevices()

    Events

    View Source

    FocusStateChanged

    Occurs when the state of focus that belongs to the current AudioStreamPolicy is changed.

    Declaration
    public event EventHandler<AudioStreamPolicyFocusStateChangedEventArgs> FocusStateChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><AudioStreamPolicyFocusStateChangedEventArgs>
    Remarks

    The event is raised in the internal thread.

    View Source

    StreamFocusStateChanged

    Occurs when the focus state for stream types is changed regardless of the process.

    Declaration
    public static event EventHandler<StreamFocusStateChangedEventArgs> StreamFocusStateChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><StreamFocusStateChangedEventArgs>

    Implements

    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX