Table of Contents

Class OutputStream

Namespace
Discord.Audio.Streams
Assembly
Discord.Net.WebSocket.dll

Wraps an IAudioClient, sending voice data on write.

public class OutputStream : AudioOutStream, IAsyncDisposable, IDisposable
Inheritance
OutputStream
Implements
Inherited Members

Constructors

OutputStream(IAudioClient)

public OutputStream(IAudioClient client)

Parameters

client IAudioClient

Methods

WriteAsync(byte[], int, int, CancellationToken)

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancelToken)

Parameters

buffer byte[]

The buffer to write data from.

offset int

The zero-based byte offset in buffer from which to begin copying bytes to the stream.

count int

The maximum number of bytes to write.

cancelToken CancellationToken

Returns

Task

A task that represents the asynchronous write operation.

Exceptions

ArgumentNullException

buffer is null.

ArgumentOutOfRangeException

offset or count is negative.

ArgumentException

The sum of offset and count is larger than the buffer length.

NotSupportedException

The stream does not support writing.

ObjectDisposedException

The stream has been disposed.

InvalidOperationException

The stream is currently in use by a previous write operation.

OperationCanceledException

The cancellation token was canceled. This exception is stored into the returned task.

WriteHeader(ushort, uint, bool)

public override void WriteHeader(ushort seq, uint timestamp, bool missed)

Parameters

seq ushort
timestamp uint
missed bool

Exceptions

InvalidOperationException

This stream does not accept headers.