Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to CoreAudio for changing sample rates on a stream #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cesaref
Copy link

@cesaref cesaref commented May 8, 2024

We've started using rtAudio in the runtime for our programming language (Cmajor), and we came across issues where the sample rate could be updated on the audio device after our application using rtaudio was up and running. This is a specific problem with MacOS, so using the CoreAudio implementation, and i've put together a fix which works for us, and so have created this pull request to see if you want to integrate this solution.

I've added an additional callback to the RtAudio class, alongside the error callback, which is called when stream properties are updated. I've kept this vague on the basis that there are multiple properties which the client may care about, so this could be extended in future.

Within the RtApiCore implementation, i've generalised an existing property change listener, which was previously used to handle device disconnect events, so that it can also handle sample rate changes. Sample rate changes are bubbled up to the class instance, and the callback is called if the sample rate has been updated.

I did consider using the error callback, either a specific error case, or a warning level, but that felt ugly and likely error prone for existing applications. This implementation will I believe have no changes of behaviour unless a callback is added to the class.

I have tried to stick to your coding standards, apologies if this is not quite right, my editor kept being helpful and doing the wrong thing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant