GlintOpusDecoder constructor

GlintOpusDecoder({
  1. int channels = 2,
  2. int sampleRate = 48000,
})

Implementation

GlintOpusDecoder({int channels = 2, int sampleRate = 48000})
    : channels = channels {
  _lib = _loadLibrary();
  final create = _lib.lookupFunction<_OpusDecCreateNative, _OpusDecCreate>(
      'glint_opus_dec_create');
  _decode = _lib
      .lookupFunction<_OpusDecodeNative, _OpusDecode>('glint_opus_decode');
  _decodeFec = _lib.lookupFunction<_OpusDecodeNative, _OpusDecode>(
      'glint_opus_decode_fec');
  _finalRange = _lib.lookupFunction<_OpusRangeNative, _OpusRange>(
      'glint_opus_dec_final_range');
  _destroy = _lib.lookupFunction<_OpusDestroyNative, _OpusDestroy>(
      'glint_opus_dec_destroy');
  _handle = create(channels, sampleRate);
  if (_handle == nullptr) {
    throw StateError('glint_opus_dec_create returned null');
  }
}