OpusSharp OpusSharp
OpusSharp OpusSharp
DocFX + Singulink = ♥

Search Results for

    Edit this page

    Class OpusEncoder

    An opus encoder.

    Inheritance
    object
    OpusEncoder
    Implements
    IOpusEncoder
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: OpusSharp.Core
    Assembly: OpusSharp.Core.dll
    Syntax
    public class OpusEncoder : IOpusEncoder, IDisposable

    Constructors

    | Edit this page View Source

    OpusEncoder(int, int, OpusPredefinedValues, bool?)

    Creates a new opus encoder.

    Declaration
    public OpusEncoder(int sample_rate, int channels, OpusPredefinedValues application, bool? use_static = null)
    Parameters
    Type Name Description
    int sample_rate

    The sample rate, this must be one of 8000, 12000, 16000, 24000, or 48000.

    int channels

    Number of channels, this must be 1 or 2.

    OpusPredefinedValues application

    Coding mode (one of OPUS_APPLICATION_VOIP, OPUS_APPLICATION_AUDIO or OPUS_APPLICATION_RESTRICTED_LOWDELAY

    bool? use_static

    Set to true to force static imports, false to force dynamic imports, or null to auto-select based on platform.

    Exceptions
    Type Condition
    OpusException

    Fields

    | Edit this page View Source

    _encoder

    Direct opus encoder for the OpusEncoder. You can close this directly.

    Declaration
    protected IOpusEncoder _encoder
    Field Value
    Type Description
    IOpusEncoder

    Methods

    | Edit this page View Source

    Ctl(EncoderCTL)

    Performs a ctl request.

    Declaration
    public int Ctl(EncoderCTL request)
    Parameters
    Type Name Description
    EncoderCTL request

    The request you want to specify.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl(EncoderCTL, int)

    Performs a ctl request.

    Declaration
    public int Ctl(EncoderCTL request, int value)
    Parameters
    Type Name Description
    EncoderCTL request

    The request you want to specify.

    int value

    The input value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl(GenericCTL)

    Performs a ctl request.

    Declaration
    public int Ctl(GenericCTL request)
    Parameters
    Type Name Description
    GenericCTL request

    The request you want to specify.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl(GenericCTL, int)

    Performs a ctl set request.

    Declaration
    public int Ctl(GenericCTL request, int value)
    Parameters
    Type Name Description
    GenericCTL request

    The request you want to specify.

    int value

    The input value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl<T>(EncoderCTL, int, ref T)

    Performs a ctl request.

    Declaration
    public int Ctl<T>(EncoderCTL request, int value, ref T value2) where T : unmanaged
    Parameters
    Type Name Description
    EncoderCTL request

    The request you want to specify.

    int value

    The input value.

    T value2

    The second input/output value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Type Parameters
    Name Description
    T

    The type you want to input/output.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl<T>(EncoderCTL, ref T)

    Performs a ctl request.

    Declaration
    public int Ctl<T>(EncoderCTL request, ref T value) where T : unmanaged
    Parameters
    Type Name Description
    EncoderCTL request

    The request you want to specify.

    T value

    The input/output value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Type Parameters
    Name Description
    T

    The type you want to input/output.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl<T>(EncoderCTL, ref T, int)

    Performs a ctl request.

    Declaration
    public int Ctl<T>(EncoderCTL request, ref T value, int value2) where T : unmanaged
    Parameters
    Type Name Description
    EncoderCTL request

    The request you want to specify.

    T value

    The input/output value.

    int value2

    The second input value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Type Parameters
    Name Description
    T

    The type you want to input/output.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl<T>(GenericCTL, ref T)

    Performs a ctl request.

    Declaration
    public int Ctl<T>(GenericCTL request, ref T value) where T : unmanaged
    Parameters
    Type Name Description
    GenericCTL request

    The request you want to specify.

    T value

    The input/output value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Type Parameters
    Name Description
    T

    The type you want to input/output.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Ctl<T, T2>(EncoderCTL, ref T, ref T2)

    Performs a ctl request.

    Declaration
    public int Ctl<T, T2>(EncoderCTL request, ref T value, ref T2 value2) where T : unmanaged where T2 : unmanaged
    Parameters
    Type Name Description
    EncoderCTL request

    The request you want to specify.

    T value

    The input/output value.

    T2 value2

    The second input/output value.

    Returns
    Type Description
    int

    The result code of the request. See OpusErrorCodes.

    Type Parameters
    Name Description
    T

    The type you want to input/output.

    T2

    The second type you want to input/output.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Dispose()

    Declaration
    public void Dispose()
    | Edit this page View Source

    Encode(byte[], int, byte[], int)

    Encodes a pcm frame.

    Declaration
    public int Encode(byte[] input, int frame_size, byte[] output, int max_data_bytes)
    Parameters
    Type Name Description
    byte[] input

    Input signal (interleaved if 2 channels). length is frame_size*channels.

    int frame_size

    The frame size of the pcm data. This must be an Opus frame size for the encoder's sampling rate. For example, at 48 kHz the permitted values are 120, 240, 480, 960, 1920, and 2880. Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.

    byte[] output

    Output payload. This must contain storage for at least max_data_bytes.

    int max_data_bytes

    Size of the allocated memory for the output payload. This may be used to impose an upper limit on the instant bitrate, but should not be used as the only bitrate control. Use OPUS_SET_BITRATE to control the bitrate.

    Returns
    Type Description
    int

    The length of the encoded packet (in bytes).

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Encode(short[], int, byte[], int)

    Encodes a pcm frame.

    Declaration
    public int Encode(short[] input, int frame_size, byte[] output, int max_data_bytes)
    Parameters
    Type Name Description
    short[] input

    Input signal (interleaved if 2 channels). length is frame_sizechannelssizeof(short).

    int frame_size

    The frame size of the pcm data. This must be an Opus frame size for the encoder's sampling rate. For example, at 48 kHz the permitted values are 120, 240, 480, 960, 1920, and 2880. Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.

    byte[] output

    Output payload. This must contain storage for at least max_data_bytes.

    int max_data_bytes

    Size of the allocated memory for the output payload. This may be used to impose an upper limit on the instant bitrate, but should not be used as the only bitrate control. Use OPUS_SET_BITRATE to control the bitrate.

    Returns
    Type Description
    int

    The length of the encoded packet (in bytes).

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Encode(int[], int, byte[], int)

    Encodes a pcm frame.

    Declaration
    public int Encode(int[] input, int frame_size, byte[] output, int max_data_bytes)
    Parameters
    Type Name Description
    int[] input

    Input signal (interleaved if 2 channels). length is frame_sizechannelssizeof(int).

    int frame_size

    The frame size of the pcm data. This must be an Opus frame size for the encoder's sampling rate. For example, at 48 kHz the permitted values are 120, 240, 480, 960, 1920, and 2880. Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.

    byte[] output

    Output payload. This must contain storage for at least max_data_bytes.

    int max_data_bytes

    Size of the allocated memory for the output payload. This may be used to impose an upper limit on the instant bitrate, but should not be used as the only bitrate control. Use OPUS_SET_BITRATE to control the bitrate.

    Returns
    Type Description
    int

    The length of the encoded packet (in bytes).

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Encode(float[], int, byte[], int)

    Encodes a floating point pcm frame.

    Declaration
    public int Encode(float[] input, int frame_size, byte[] output, int max_data_bytes)
    Parameters
    Type Name Description
    float[] input

    Input signal (interleaved if 2 channels). length is frame_sizechannelssizeof(float).

    int frame_size

    The frame size of the pcm data. This must be an Opus frame size for the encoder's sampling rate. For example, at 48 kHz the permitted values are 120, 240, 480, 960, 1920, and 2880. Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.

    byte[] output

    Output payload. This must contain storage for at least max_data_bytes.

    int max_data_bytes

    Size of the allocated memory for the output payload. This may be used to impose an upper limit on the instant bitrate, but should not be used as the only bitrate control. Use OPUS_SET_BITRATE to control the bitrate.

    Returns
    Type Description
    int

    The length of the encoded packet (in bytes).

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException

    Implements

    IOpusEncoder
    IDisposable

    Extension Methods

    OpusEncoderExtensions.GetApplication(IOpusEncoder)
    OpusEncoderExtensions.GetBandwidth(IOpusEncoder)
    OpusEncoderExtensions.GetBitRate(IOpusEncoder)
    OpusEncoderExtensions.GetComplexity(IOpusEncoder)
    OpusEncoderExtensions.GetDtx(IOpusEncoder)
    OpusEncoderExtensions.GetExpertFrameDuration(IOpusEncoder)
    OpusEncoderExtensions.GetFinalRange(IOpusEncoder)
    OpusEncoderExtensions.GetForceChannels(IOpusEncoder)
    OpusEncoderExtensions.GetInDtx(IOpusEncoder)
    OpusEncoderExtensions.GetInbandFec(IOpusEncoder)
    OpusEncoderExtensions.GetLookahead(IOpusEncoder)
    OpusEncoderExtensions.GetLsbDepth(IOpusEncoder)
    OpusEncoderExtensions.GetMaxBandwidth(IOpusEncoder)
    OpusEncoderExtensions.GetPacketLostPercent(IOpusEncoder)
    OpusEncoderExtensions.GetPhaseInversionDisabled(IOpusEncoder)
    OpusEncoderExtensions.GetPredictionDisabled(IOpusEncoder)
    OpusEncoderExtensions.GetQext(IOpusEncoder)
    OpusEncoderExtensions.GetSampleRate(IOpusEncoder)
    OpusEncoderExtensions.GetSignal(IOpusEncoder)
    OpusEncoderExtensions.GetVbr(IOpusEncoder)
    OpusEncoderExtensions.GetVbrConstraint(IOpusEncoder)
    OpusEncoderExtensions.Reset(IOpusEncoder)
    OpusEncoderExtensions.SetApplication(IOpusEncoder, OpusPredefinedValues)
    OpusEncoderExtensions.SetBandwidth(IOpusEncoder, OpusPredefinedValues)
    OpusEncoderExtensions.SetBitRate(IOpusEncoder, int)
    OpusEncoderExtensions.SetComplexity(IOpusEncoder, int)
    OpusEncoderExtensions.SetDtx(IOpusEncoder, bool)
    OpusEncoderExtensions.SetExpertFrameDuration(IOpusEncoder, OpusPredefinedValues)
    OpusEncoderExtensions.SetForceChannels(IOpusEncoder, int)
    OpusEncoderExtensions.SetInbandFec(IOpusEncoder, int)
    OpusEncoderExtensions.SetLsbDepth(IOpusEncoder, int)
    OpusEncoderExtensions.SetMaxBandwidth(IOpusEncoder, int)
    OpusEncoderExtensions.SetPacketLostPercent(IOpusEncoder, int)
    OpusEncoderExtensions.SetPhaseInversionDisabled(IOpusEncoder, bool)
    OpusEncoderExtensions.SetPredictionDisabled(IOpusEncoder, bool)
    OpusEncoderExtensions.SetQext(IOpusEncoder, bool)
    OpusEncoderExtensions.SetSignal(IOpusEncoder, OpusPredefinedValues)
    OpusEncoderExtensions.SetVbr(IOpusEncoder, bool)
    OpusEncoderExtensions.SetVbrConstraint(IOpusEncoder, bool)