Class Encoder
Represents an Opus encoder for encoding PCM data.
Inheritance
Implements
Inherited Members
Namespace: Adrenak.UnityOpus
Assembly: cs.temp.dll.dll
Syntax
public class Encoder : IDisposable
Constructors
Encoder(SamplingFrequency, NumChannels, OpusApplication)
Initializes a new instance of the Encoder class.
Declaration
public Encoder(SamplingFrequency samplingFrequency, NumChannels channels, OpusApplication application)
Parameters
Type | Name | Description |
---|---|---|
SamplingFrequency | samplingFrequency | The sampling frequency of the input data. |
NumChannels | channels | The number of audio channels. |
OpusApplication | application | The Opus application type (e.g., VoIP, Audio). |
Properties
Bitrate
Gets or sets the bitrate of the encoder. NOTE: get only returns the value that's been set by you before.
Declaration
public int Bitrate { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Complexity
Gets or sets the complexity level of the encoder. NOTE: get only returns the value that's been set by you before.
Declaration
public int Complexity { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Signal
Gets or sets the signal type (e.g., voice, music) for the encoder. NOTE: get only returns the value that's been set by you before.
Declaration
public OpusSignal Signal { get; set; }
Property Value
Type | Description |
---|---|
OpusSignal |
Methods
Dispose()
Disposes of the encoder and suppresses finalization.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the encoder.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | True if disposing managed resources. |
Encode(Single[], Byte[])
Encodes the provided PCM float data to Opus format.
Declaration
public int Encode(float[] pcm, byte[] output)
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | pcm | Input PCM float array. |
System.Byte[] | output | Output byte array for encoded data. |
Returns
Type | Description |
---|---|
System.Int32 | The size of the encoded data in bytes. |
Finalize()
Finalizer for Encoder.
Declaration
protected void Finalize()