Added SetComplexity to decoder
In order to support deep PLC, libopus added OPUS_SET_COMPLEXITY() to the decoder API.
This PR adds SetComplexity method to the decoder.
Note that if libopus < 1.5 this function will return ErrUnimplemented so users could easily ignore it like this:
dec, err := opus.NewDecoder(48000, 1)
if err != nil {
// ... handle error
}
err = dec.SetComplexity(10)
if err != nil && err != opus.ErrUnimplemented {
// ... handle error
}
This should help #54
@hraban curious if this can be merged?
Yes looks great sorry I forgot but it's on my radar will restore my go dev env in a bit
this would be a great addition!
Thank you for the PR! I added some tests in CI and rebased your change on top of it and it seems to be failing. See e.g. https://github.com/hraban/opus/actions/runs/19424167437 . Do you know what could be going wrong?
Hey @hraban ,
I just checked the build logs and it seems the workflows are using libopus from Ubuntu 24.04, which is version 1.4.
This PR depends on a feature that was first implemented in libopus 1.5.
Ubuntu 25.04 ships with libopus 1.5.2, which would work: https://answers.launchpad.net/ubuntu/plucky/amd64/libopus-dev
Would you like me to include an updated test.yml in this PR that runs the jobs in an ubuntu:25.04 container? That would allow us to test the new functionality.
ah thanks that explains it. I'll have another look on my end tonight, see if I can get it merged.
All right let me know if you need something