internal OpusEncoder(IOpusApi api, int samplingRate, int channels, Application application) { _api = api; _channels = channels; _encoderState = api.opus_encoder_create(samplingRate, channels, application, out var error); if ((Error)error != Error.OK) { throw new Exception("Exception occured while creating encoder"); } }
internal OpusDecoder(IOpusApi api, int samplingRate, int channels) { _api = api; _channels = channels; _decoderState = api.opus_decoder_create(samplingRate, channels, out var error); if (error != Error.OK) { throw new Exception("Exception occured while creating encoder"); } }
private static IOpusApi GetApi() { if (_api == null) { lock (CreateLock) { if (_api == null) { string libraryPath; if (Environment.OSVersion.Platform == PlatformID.Unix) { libraryPath = "libopus.so.0"; } else { libraryPath = "opus"; } _api = NativeLibraryBuilder.Default.ActivateInterface <IOpusApi>(libraryPath); } } } return(_api); }
internal OpusPacketApi(IOpusApi api) { _api = api; }