OpusSharp OpusSharp
OpusSharp OpusSharp
DocFX + Singulink = ♥

Search Results for

    Edit this page

    Class OpusDecoder

    An opus decoder.

    Inheritance
    object
    OpusDecoder
    Implements
    IOpusDecoder
    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 OpusDecoder : IOpusDecoder, IDisposable

    Constructors

    | Edit this page View Source

    OpusDecoder(int, int, bool?)

    Creates a new opus decoder.

    Declaration
    public OpusDecoder(int sample_rate, int channels, 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.

    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

    _decoder

    Direct opus decoder for the OpusDecoder. You can close this directly.

    Declaration
    protected IOpusDecoder _decoder
    Field Value
    Type Description
    IOpusDecoder

    Methods

    | Edit this page View Source

    Ctl(DecoderCTL)

    Performs a ctl request.

    Declaration
    public int Ctl(DecoderCTL request)
    Parameters
    Type Name Description
    DecoderCTL 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(DecoderCTL, int)

    Performs a ctl set request.

    Declaration
    public int Ctl(DecoderCTL request, int value)
    Parameters
    Type Name Description
    DecoderCTL 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>(DecoderCTL, ref T)

    Performs a ctl get/set request.

    Declaration
    public int Ctl<T>(DecoderCTL request, ref T value) where T : unmanaged
    Parameters
    Type Name Description
    DecoderCTL 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>(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

    Decode(byte[]?, int, byte[], int, bool)

    Decodes an opus encoded frame.

    Declaration
    public int Decode(byte[]? input, int length, byte[] output, int frame_size, bool decode_fec)
    Parameters
    Type Name Description
    byte[] input

    Input payload. Use null to indicate packet loss

    int length

    Number of bytes in payload.

    byte[] output

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

    int frame_size

    Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet. For the PLC and FEC cases, frame_size must be a multiple of 2.5 ms.

    bool decode_fec

    Request that any in-band forward error correction data be decoded. If no such data is available, the frame is decoded as if it were lost.

    Returns
    Type Description
    int

    Number of decoded samples or OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Decode(byte[]?, int, short[], int, bool)

    Decodes an opus encoded frame.

    Declaration
    public int Decode(byte[]? input, int length, short[] output, int frame_size, bool decode_fec)
    Parameters
    Type Name Description
    byte[] input

    Input payload. Use null to indicate packet loss

    int length

    Number of bytes in payload.

    short[] output

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

    int frame_size

    Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet. For the PLC and FEC cases, frame_size must be a multiple of 2.5 ms.

    bool decode_fec

    Request that any in-band forward error correction data be decoded. If no such data is available, the frame is decoded as if it were lost.

    Returns
    Type Description
    int

    Number of decoded samples or OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Decode(byte[]?, int, int[], int, bool)

    Decodes an opus encoded frame.

    Declaration
    public int Decode(byte[]? input, int length, int[] output, int frame_size, bool decode_fec)
    Parameters
    Type Name Description
    byte[] input

    Input payload. Use null to indicate packet loss

    int length

    Number of bytes in payload.

    int[] output

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

    int frame_size

    Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet. For the PLC and FEC cases, frame_size must be a multiple of 2.5 ms.

    bool decode_fec

    Request that any in-band forward error correction data be decoded. If no such data is available, the frame is decoded as if it were lost.

    Returns
    Type Description
    int

    Number of decoded samples or OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Decode(byte[]?, int, float[], int, bool)

    Decodes an opus encoded frame.

    Declaration
    public int Decode(byte[]? input, int length, float[] output, int frame_size, bool decode_fec)
    Parameters
    Type Name Description
    byte[] input

    Input payload. Use null to indicate packet loss

    int length

    Number of bytes in payload.

    float[] output

    Output signal (interleaved if 2 channels). length is (frame_size*channels)/2. Note: I don't know if this is correct.

    int frame_size

    Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet. For the PLC and FEC cases, frame_size must be a multiple of 2.5 ms.

    bool decode_fec

    Request that any in-band forward error correction data be decoded. If no such data is available, the frame is decoded as if it were lost.

    Returns
    Type Description
    int

    Number of decoded samples or OpusErrorCodes.

    Exceptions
    Type Condition
    OpusException
    ObjectDisposedException
    | Edit this page View Source

    Dispose()

    Declaration
    public void Dispose()

    Implements

    IOpusDecoder
    IDisposable

    Extension Methods

    OpusDecoderExtensions.GetBandwidth(IOpusDecoder)
    OpusDecoderExtensions.GetFinalRange(IOpusDecoder)
    OpusDecoderExtensions.GetGain(IOpusDecoder)
    OpusDecoderExtensions.GetIgnoreExtensions(IOpusDecoder)
    OpusDecoderExtensions.GetLastPacketDuration(IOpusDecoder)
    OpusDecoderExtensions.GetOsceBwe(IOpusDecoder)
    OpusDecoderExtensions.GetPhaseInversionDisabled(IOpusDecoder)
    OpusDecoderExtensions.GetPitch(IOpusDecoder)
    OpusDecoderExtensions.GetSampleRate(IOpusDecoder)
    OpusDecoderExtensions.Reset(IOpusDecoder)
    OpusDecoderExtensions.SetGain(IOpusDecoder, short)
    OpusDecoderExtensions.SetIgnoreExtensions(IOpusDecoder, bool)
    OpusDecoderExtensions.SetOsceBwe(IOpusDecoder, bool)
    OpusDecoderExtensions.SetPhaseInversionDisabled(IOpusDecoder, bool)