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

[WIP] Add audio effect stream #35402

Closed
wants to merge 1 commit into from

Conversation

fire
Copy link
Member

@fire fire commented Jan 21, 2020

This is a work in progress api for review.

The goal is to get specific sized chunks from a ring buffer saving the current effect.

Use case:

Effect streams the current bus so that we get either zero or equally sized vector of floats in left / right format. This allows something like opus to have same sized buffers to use as input for voip.

godotengine/godot-proposals#399

@Chaosus Chaosus added this to the 4.0 milestone Jan 21, 2020
@fire fire force-pushed the audio_effect_stream_buffer branch from fe9ed80 to 11287b1 Compare January 21, 2020 13:20
@fire fire changed the title Add audio effect stream buffer. [WIP] Add audio effect stream buffer. Jan 21, 2020
@fire fire force-pushed the audio_effect_stream_buffer branch from 11287b1 to 43c19a8 Compare January 21, 2020 14:31
@fire fire changed the title [WIP] Add audio effect stream buffer. [WIP] Add audio effect stream Jan 21, 2020
@fire fire force-pushed the audio_effect_stream_buffer branch from 43c19a8 to aaf80e8 Compare January 21, 2020 14:33
@fire
Copy link
Member Author

fire commented Jan 21, 2020

Closing for a better implementation.

Godot has a RingBuffer class you can check as reference, you need two of those

Your AudioEffect is fed audio and expects you to feed audio back in a single callback

The audio you are fed is pushed to the ringbuffer, and you pull from the second ringbuffer for audio to push

https://github.com/godotengine/godot/blob/a7f49ac9a107820a62677ee3fb49d38982a25165/core/ring_buffer.h

In another thread, which is updated periodically, you fill packets by reading from the first ringbuffer and send them, and you decompress packets you get and feed them to the second ringbuffer

[reduz] that said, I feel that is not a great approach for voip, since you need to account for many different situations like delays and running out of packets. I am sure there are better implementations out there

[reduz] also you need to account for packets arriving out of order and that kind of stuff

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

Successfully merging this pull request may close these issues.

3 participants