Show / Hide Table of Contents

    Class AudioPlayback

    Definition

    Namespace:
    Tizen.Multimedia
    Assembly:
    Tizen.Multimedia.AudioIO.dll
    API Level:
    3

    Provides the ability to directly manage the system audio output devices and play the PCM (pulse-code modulation) data.

    public class AudioPlayback : IDisposable
    Inheritance
    Object
    AudioPlayback
    Implements
    IDisposable

    Constructors

    View Source

    AudioPlayback(Int32, AudioChannel, AudioSampleType)

    Initializes a new instance of the AudioPlayback class with the specified sample rate, channel, and sample type.

    Declaration
    public AudioPlayback(int sampleRate, AudioChannel channel, AudioSampleType sampleType)
    Parameters
    Type Name Description
    Int32 sampleRate

    The audio sample rate (8000 ~ 192000Hz).

    AudioChannel channel

    The audio channel type.

    AudioSampleType sampleType

    The audio sample type.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    sampleRate is less than MinSampleRate.
    -or-
    sampleRate is greater than MaxSampleRate.

    ArgumentException

    channel is invalid.
    -or-
    sampleType is invalid.

    API Level: 3

    Fields

    View Source

    MaxSampleRate

    Specifies the maximum value allowed for the audio capture, in Hertz (Hz).

    Declaration
    public static readonly int MaxSampleRate
    Field Value
    Type Description
    Int32
    See Also
    SampleRate
    API Level: 3
    View Source

    MinSampleRate

    Specifies the minimum value allowed for the audio capture, in Hertz (Hz).

    Declaration
    public static readonly int MinSampleRate
    Field Value
    Type Description
    Int32
    See Also
    SampleRate
    API Level: 3

    Properties

    View Source

    Channel

    Gets the channel type of the audio output data stream.

    Declaration
    public AudioChannel Channel { get; }
    Property Value
    Type Description
    AudioChannel
    API Level: 3
    View Source

    SampleRate

    Gets the sample rate of the audio output data stream, in Hertz (Hz).

    Declaration
    public int SampleRate { get; }
    Property Value
    Type Description
    Int32
    API Level: 3
    View Source

    SampleType

    Gets the sample type of the audio output data stream.

    Declaration
    public AudioSampleType SampleType { get; }
    Property Value
    Type Description
    AudioSampleType
    API Level: 3
    View Source

    StreamType

    Gets the sound type supported by the audio output device.

    Declaration
    public AudioStreamType StreamType { get; }
    Property Value
    Type Description
    AudioStreamType
    Exceptions
    Type Condition
    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    API Level: 3

    Methods

    View Source

    ApplyStreamPolicy(AudioStreamPolicy)

    Applies the sound stream information to the AudioPlayback.

    Declaration
    public void ApplyStreamPolicy(AudioStreamPolicy streamPolicy)
    Parameters
    Type Name Description
    AudioStreamPolicy streamPolicy

    The AudioStreamPolicy to apply for the AudioPlayback.

    Exceptions
    Type Condition
    ArgumentNullException

    streamPolicy is null.

    ObjectDisposedException

    streamPolicy has already been disposed of.
    -or-
    The AudioPlayback has already been disposed of.

    NotSupportedException

    streamPolicy is not supported.

    ArgumentException

    Not able to retrieve information from streamPolicy.

    API Level: 3
    View Source

    Dispose()

    Releases all resources used by the AudioPlayback object.

    Declaration
    public void Dispose()
    API Level: 3
    View Source

    Dispose(Boolean)

    Releases the resources used by the AudioPlayback object.

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

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

    API Level: 3
    View Source

    Drain()

    Drains the buffered audio data from the output stream. It blocks the calling thread until the drain of the stream buffer is complete, for example, at the end of playback.

    Declaration
    public void Drain()
    Exceptions
    Type Condition
    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    InvalidOperationException

    The current state is Idle.

    API Level: 3
    View Source

    Finalize()

    Finalizes an instance of the AudioPlayback class.

    Declaration
    protected void Finalize()
    View Source

    Flush()

    Flushes and discards the buffered audio data from the output stream.

    Declaration
    public void Flush()
    Exceptions
    Type Condition
    InvalidOperationException

    The current state is Idle.

    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    API Level: 3
    View Source

    GetBufferSize()

    Gets the size allocated for the audio output buffer.

    Declaration
    public int GetBufferSize()
    Returns
    Type Description
    Int32
    Exceptions
    Type Condition
    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    API Level: 3
    View Source

    Pause()

    Pauses feeding of the audio data to the device.

    Declaration
    public void Pause()
    Remarks

    It has no effect if the current state is Paused.

    Exceptions
    Type Condition
    InvalidOperationException

    The current state is Idle.
    -or-
    The method is called in the BufferAvailable event handler.

    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    See Also
    Resume()
    API Level: 3
    View Source

    Prepare()

    Prepares the AudioPlayback.

    Declaration
    public void Prepare()
    Remarks

    This must be called before Write(Byte[]).

    Exceptions
    Type Condition
    InvalidOperationException

    Operation failed due to an internal error.
    -or-
    The current state is not Idle.

    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    See Also
    Unprepare()
    API Level: 3
    View Source

    Resume()

    Resumes feeding of the audio data to the device.

    Declaration
    public void Resume()
    Remarks

    It has no effect if the current state is Running.

    Exceptions
    Type Condition
    InvalidOperationException

    The current state is Idle.
    -or-
    The method is called in an event handler.

    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    See Also
    Pause()
    API Level: 3
    View Source

    Unprepare()

    Unprepares the AudioPlayback.

    Declaration
    public void Unprepare()
    Exceptions
    Type Condition
    InvalidOperationException

    Operation failed due to an internal error.
    -or-
    The current state is Idle.

    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    See Also
    Prepare()
    API Level: 3
    View Source

    Write(Byte[])

    Starts writing the audio data to the device.

    Declaration
    public int Write(byte[] buffer)
    Parameters
    Type Name Description
    Byte[] buffer

    The buffer to write.

    Returns
    Type Description
    Int32

    The written size.

    Exceptions
    Type Condition
    ArgumentNullException

    buffer is null.

    ArgumentException

    The length of buffer is zero.

    InvalidOperationException

    The current state is not Running.

    ObjectDisposedException

    The AudioPlayback has already been disposed of.

    API Level: 3

    Events

    View Source

    BufferAvailable

    Occurs when the audio playback data can be written.

    Declaration
    public event EventHandler<AudioPlaybackBufferAvailableEventArgs> BufferAvailable
    Event Type
    Type Description
    EventHandler<AudioPlaybackBufferAvailableEventArgs>
    See Also
    Write(Byte[])
    API Level: 3
    View Source

    StateChanged

    Occurs when the state of the AudioPlayback is changed.

    Declaration
    public event EventHandler<AudioIOStateChangedEventArgs> StateChanged
    Event Type
    Type Description
    EventHandler<AudioIOStateChangedEventArgs>
    API Level: 3

    Implements

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