Class AudioPlayback
Definition
- Namespace:
- Tizen.Multimedia
- Assembly:
- Tizen.Multimedia.AudioIO.dll
Provides the ability to directly manage the system audio output devices and play the PCM (pulse-code modulation) data.
C#Copypublic class AudioPlayback : IDisposable
- Inheritance
-
objectAudioPlayback
- Implements
-
System.IDisposable
Constructors
AudioPlayback(int, AudioChannel, AudioSampleType)
Initializes a new instance of the AudioPlayback class with the specified sample rate, channel, and sample type.
Declaration
C#Copypublic AudioPlayback(int sampleRate, AudioChannel channel, AudioSampleType sampleType)
Parameters
Type | Name | Description |
---|---|---|
int | sampleRate | The audio sample rate (8000 ~ 192000Hz). |
AudioChannel | channel | The audio channel type. |
AudioSampleType | sampleType | The audio sample type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.ArgumentException |
|
Fields
Declaration
C#Copypublic static readonly int MaxSampleRate
Field Value
Type | Description |
---|---|
int |
See Also
Declaration
C#Copypublic static readonly int MinSampleRate
Field Value
Type | Description |
---|---|
int |
See Also
Properties
Declaration
C#Copypublic AudioChannel Channel { get; }
Property Value
Type | Description |
---|---|
AudioChannel |
Declaration
C#Copypublic int SampleRate { get; }
Property Value
Type | Description |
---|---|
int |
Declaration
C#Copypublic AudioSampleType SampleType { get; }
Property Value
Type | Description |
---|---|
AudioSampleType |
Declaration
C#Copypublic AudioStreamType StreamType { get; }
Property Value
Type | Description |
---|---|
AudioStreamType |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
Methods
ApplyStreamPolicy(AudioStreamPolicy)
Applies the sound stream information to the AudioPlayback.
Declaration
C#Copypublic void ApplyStreamPolicy(AudioStreamPolicy streamPolicy)
Parameters
Type | Name | Description |
---|---|---|
AudioStreamPolicy | streamPolicy | The AudioStreamPolicy to apply for the AudioPlayback. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ObjectDisposedException |
|
System.NotSupportedException |
|
System.ArgumentException | Not able to retrieve information from |
Declaration
C#Copypublic void Dispose()
Declaration
C#Copyprotected 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. |
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
C#Copypublic void Drain()
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
System.InvalidOperationException | The current state is Idle. |
Declaration
C#Copyprotected ~AudioPlayback()
Declaration
C#Copypublic void Flush()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The current state is Idle. |
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
Declaration
C#Copypublic int GetBufferSize()
Returns
Type | Description |
---|---|
int |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
Declaration
C#Copypublic void Pause()
Remarks
It has no effect if the current state is Paused.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The current state is Idle. |
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
See Also
Declaration
C#Copypublic void Prepare()
Remarks
This must be called before Write(byte[]).
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Operation failed due to an internal error. |
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
See Also
Declaration
C#Copypublic void Resume()
Remarks
It has no effect if the current state is Running.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The current state is Idle. |
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
See Also
Declaration
C#Copypublic void Unprepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Operation failed due to an internal error. |
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
See Also
Declaration
C#Copypublic int Write(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The buffer to write. |
Returns
Type | Description |
---|---|
int | The written size. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException | The length of |
System.InvalidOperationException | The current state is not Running. |
System.ObjectDisposedException | The AudioPlayback has already been disposed of. |
Events
Declaration
C#Copypublic event EventHandler<AudioPlaybackBufferAvailableEventArgs> BufferAvailable
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><AudioPlaybackBufferAvailableEventArgs> |
See Also
Declaration
C#Copypublic event EventHandler<AudioIOStateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><AudioIOStateChangedEventArgs> |