Show / Hide Table of Contents

# Class OpusEncodeStream

Converts PCM to Opus

##### Inheritance

System.Object
System.MarshalByRefObject
System.IO.Stream
AudioStream
AudioOutStream
OpusEncodeStream

##### Implements

System.IDisposable

##### Inherited Members

AudioOutStream.CanWrite
AudioOutStream.Read(Byte[], Int32, Int32)
AudioOutStream.SetLength(Int64)
AudioOutStream.Seek(Int64, SeekOrigin)
AudioStream.CanRead
AudioStream.CanSeek
AudioStream.WriteHeader(UInt16, UInt32, Boolean)
AudioStream.Write(Byte[], Int32, Int32)
AudioStream.Flush()
AudioStream.Clear()
AudioStream.Length
AudioStream.Position
System.IO.Stream.Null
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.Close()
System.IO.Stream.Dispose()
System.IO.Stream.FlushAsync()
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadByte()
System.IO.Stream.WriteByte(System.Byte)
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.CreateObjRef(System.Type)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Discord.Audio.Streams

###### Assembly: Discord.Net.WebSocket.dll

##### Syntax

    public class OpusEncodeStream : AudioOutStream, IDisposable

### Constructors

| Improve this Doc View Source

#### OpusEncodeStream(AudioStream, Int32, AudioApplication, Int32)

##### Declaration

    public OpusEncodeStream(AudioStream next, int bitrate, AudioApplication application, int packetLoss)

##### Parameters

Type | Name | Description
--- | --- | ---
AudioStream | next |
System.Int32 | bitrate |
AudioApplication | application |
System.Int32 | packetLoss |

### Fields

| Improve this Doc View Source

#### SampleRate

##### Declaration

    public const int SampleRate = 48000

##### Field Value

Type | Description
--- | ---
System.Int32 |

### Methods

| Improve this Doc View Source

#### ClearAsync(CancellationToken)

##### Declaration

    public override Task ClearAsync(CancellationToken cancelToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Threading.CancellationToken | cancelToken |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

AudioStream.ClearAsync(CancellationToken)
| Improve this Doc View Source

#### Dispose(Boolean)

##### Declaration

    protected override void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Boolean | disposing |

##### Overrides

System.IO.Stream.Dispose(System.Boolean)
| Improve this Doc View Source

#### FlushAsync(CancellationToken)

##### Declaration

    public override Task FlushAsync(CancellationToken cancelToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Threading.CancellationToken | cancelToken |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
| Improve this Doc View Source

#### WriteAsync(Byte[], Int32, Int32, CancellationToken)

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | buffer |
System.Int32 | offset |
System.Int32 | count |
System.Threading.CancellationToken | cancelToken |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)

### Implements

System.IDisposable