From: Sergey Matveev Date: Thu, 11 Apr 2024 17:23:26 +0000 (+0300) Subject: Decoder.SetComplexity X-Git-Tag: v2.0.0 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=280abfc48b5023738c5da5cbde8354d0f788e85f;p=go-opus.git Decoder.SetComplexity --- diff --git a/decoder.go b/decoder.go index da6ac81..176d5be 100644 --- a/decoder.go +++ b/decoder.go @@ -18,6 +18,12 @@ bridge_decoder_get_last_packet_duration(OpusDecoder *st, opus_int32 *samples) { return opus_decoder_ctl(st, OPUS_GET_LAST_PACKET_DURATION(samples)); } + +int +bridge_decoder_set_complexity(OpusDecoder *st, opus_int32 complexity) +{ + return opus_decoder_ctl(st, OPUS_SET_COMPLEXITY(complexity)); +} */ import "C" @@ -260,3 +266,12 @@ func (dec *Decoder) LastPacketDuration() (int, error) { } return int(samples), nil } + +// SetComplexity sets the decoder's computational complexity +func (dec *Decoder) SetComplexity(complexity int) error { + res := C.bridge_decoder_set_complexity(dec.p, C.opus_int32(complexity)) + if res != C.OPUS_OK { + return Error(res) + } + return nil +}