AudioTrack.WriteAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| WriteAsync(Int16[], Int32, Int32, WriteMode) |
Starts a task that calls the 16-bit sample-array write with the supplied write mode. |
| WriteAsync(Byte[], Int32, Int32, WriteMode) |
Starts a task that calls the byte-array write with the supplied write mode. |
| WriteAsync(ByteBuffer, Int32, WriteMode, Int64) |
Starts a task that calls the timestamped streaming byte-buffer write. |
| WriteAsync(Single[], Int32, Int32, WriteMode) |
Starts a task that calls the floating-point sample-array write. |
| WriteAsync(Byte[], Int32, Int32) |
Starts a task that calls the blocking byte-array write. |
| WriteAsync(ByteBuffer, Int32, WriteMode) |
Starts a task that calls the byte-buffer write. |
| WriteAsync(Int16[], Int32, Int32) |
Starts a task that calls the blocking 16-bit sample-array write. |
WriteAsync(Int16[], Int32, Int32, WriteMode)
Starts a task that calls the 16-bit sample-array write with the supplied write mode.
public System.Threading.Tasks.Task<int> WriteAsync(short[] audioData, int offsetInShorts, int sizeInShorts, Android.Media.WriteMode writeMode);
member this.WriteAsync : int16[] * int * int * Android.Media.WriteMode -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- Int16[]
The source array of 16-bit audio samples.
- offsetInShorts
- Int32
The starting source index, in 16-bit array elements.
- sizeInShorts
- Int32
The maximum number of 16-bit array elements to write.
- writeMode
- WriteMode
The synchronous write's blocking mode; it does not control task scheduling.
Returns
A task with the accepted 16-bit element count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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
WriteAsync(Byte[], Int32, Int32, WriteMode)
Starts a task that calls the byte-array write with the supplied write mode.
public System.Threading.Tasks.Task<int> WriteAsync(byte[] audioData, int offsetInBytes, int sizeInBytes, Android.Media.WriteMode writeMode);
member this.WriteAsync : byte[] * int * int * Android.Media.WriteMode -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- Byte[]
The source array of audio bytes.
- offsetInBytes
- Int32
The starting source index, in bytes.
- sizeInBytes
- Int32
The maximum byte count to write after that index.
- writeMode
- WriteMode
The synchronous write's blocking mode; it does not control task scheduling.
Returns
A task with the accepted byte count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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
WriteAsync(ByteBuffer, Int32, WriteMode, Int64)
Starts a task that calls the timestamped streaming byte-buffer write.
public System.Threading.Tasks.Task<int> WriteAsync(Java.Nio.ByteBuffer audioData, int sizeInBytes, Android.Media.WriteMode writeMode, long timestamp);
member this.WriteAsync : Java.Nio.ByteBuffer * int * Android.Media.WriteMode * int64 -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- ByteBuffer
The source byte buffer, read from its current position.
- sizeInBytes
- Int32
The maximum byte count to write, no larger than the buffer's remaining bytes.
- writeMode
- WriteMode
The synchronous write's blocking mode; it does not control task scheduling.
- timestamp
- Int64
The first decodable frame's presentation timestamp in nanoseconds for hardware A/V synchronization; ignored on a regular track.
Returns
A task with the accepted audio-byte count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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
WriteAsync(Single[], Int32, Int32, WriteMode)
Starts a task that calls the floating-point sample-array write.
public System.Threading.Tasks.Task<int> WriteAsync(float[] audioData, int offsetInFloats, int sizeInFloats, Android.Media.WriteMode writeMode);
member this.WriteAsync : single[] * int * int * Android.Media.WriteMode -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- Single[]
The source array of floating-point audio samples.
- offsetInFloats
- Int32
The starting source index, in single-precision array elements.
- sizeInFloats
- Int32
The maximum number of floating-point array elements to write.
- writeMode
- WriteMode
The synchronous write's blocking mode; it does not control task scheduling.
Returns
A task with the accepted floating-point element count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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
WriteAsync(Byte[], Int32, Int32)
Starts a task that calls the blocking byte-array write.
public System.Threading.Tasks.Task<int> WriteAsync(byte[] audioData, int offsetInBytes, int sizeInBytes);
member this.WriteAsync : byte[] * int * int -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- Byte[]
The source array of audio bytes.
- offsetInBytes
- Int32
The starting source index, in bytes.
- sizeInBytes
- Int32
The maximum byte count to write after that index.
Returns
A task with the accepted byte count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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
WriteAsync(ByteBuffer, Int32, WriteMode)
Starts a task that calls the byte-buffer write.
public System.Threading.Tasks.Task<int> WriteAsync(Java.Nio.ByteBuffer audioData, int sizeInBytes, Android.Media.WriteMode writeMode);
member this.WriteAsync : Java.Nio.ByteBuffer * int * Android.Media.WriteMode -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- ByteBuffer
The source byte buffer, read from its current position.
- sizeInBytes
- Int32
The maximum byte count to write, no larger than the buffer's remaining bytes.
- writeMode
- WriteMode
The synchronous write's blocking mode; it does not control task scheduling.
Returns
A task with the accepted byte count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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
WriteAsync(Int16[], Int32, Int32)
Starts a task that calls the blocking 16-bit sample-array write.
public System.Threading.Tasks.Task<int> WriteAsync(short[] audioData, int offsetInShorts, int sizeInShorts);
member this.WriteAsync : int16[] * int * int -> System.Threading.Tasks.Task<int>
Parameters
- audioData
- Int16[]
The source array of 16-bit audio samples.
- offsetInShorts
- Int32
The starting source index, in 16-bit array elements.
- sizeInShorts
- Int32
The maximum number of 16-bit array elements to write.
Returns
A task with the accepted 16-bit element count, possibly zero, or a negative write error code. Acceptance does not mean playback has completed.
Remarks
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.