GlintOpusEncoder constructor

GlintOpusEncoder({
  1. int channels = 2,
  2. int bitrate = 96000,
  3. bool vbr = false,
})

Implementation

GlintOpusEncoder({int channels = 2, int bitrate = 96000, bool vbr = false})
    : channels = channels {
  _lib = _loadLibrary();
  final create = _lib.lookupFunction<_OpusEncCreateNative, _OpusEncCreate>(
      'glint_opus_enc_create');
  _encode = _lib
      .lookupFunction<_OpusEncodeNative, _OpusEncode>('glint_opus_encode');
  _finalRange = _lib.lookupFunction<_OpusRangeNative, _OpusRange>(
      'glint_opus_enc_final_range');
  _destroy = _lib.lookupFunction<_OpusDestroyNative, _OpusDestroy>(
      'glint_opus_enc_destroy');
  _handle = create(channels, bitrate, vbr ? 1 : 0);
  if (_handle == nullptr) {
    throw StateError('glint_opus_enc_create returned null');
  }
}