-
-
Notifications
You must be signed in to change notification settings - Fork 620
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
WIP: Add basic audio mixer functionality #1380
Conversation
|
Thank you for the feedback! For the first point, I've replaced the manual rendering with |
|
|
I've added manual rendering and mixing works for macOS "Ingest Test" example. Mixing is triggered by the main channel. I used a mic and an audio file buffers from audio rendered. Didn't test it for iOS yet; buffering isn't implemented yet. Please take a look when having time. |
|
Just a small update, using
I will check if mixing can be done using Audio Toolbox before trying direct mixing. |
I've replaced AVAudioEngine with Audio Units. I tested iOS, macOS and it works now. The audio isn't perfect, probably still need to add buffering. ReplayKit iOS example exceeds 50MB memory limit so need to do optimizations. Using AudioUnitConnection instead of deprecated AUGraph. CPU load looks good. No need to increase minimum targets now. I've added |
444ad86
to
31a02f5
Compare
…mestamp Implement timestamp recalculation for audio buffers
Somehow GitHub showing commits from main as being added to this branch. I'm going to reopen the PR. |
Description & motivation
This is a work-in-progress PR to add audio mixing functionality. As
IOAudioUnit
is the main point to receive audio buffers, this PR adds an audio channel concept to the audio unit. Default channel is 0 and is handled by default audio resampler. When user wants to add an additional channel, they should use a different channel id. This will create a separate resampler. When the data is available from one of the resamplers, it's stored in aringBuffer
that is associated with every channel. Data from the default resampler triggers themix()
function that provides the mixed audio buffer back to the audio unit.I need some assistance with this PR. Currently, I don't hear any audio on the live stream even when I copy the resampler data directly into the mix buffer. There are also some optimizations I would add later. For example, to avoid mixing when there is only one available channel. All comments are welcome!
Type of change