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 FAudioFX_Collector #371

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

Add FAudioFX_Collector #371

wants to merge 1 commit into from

Conversation

kg
Copy link
Contributor

@kg kg commented Feb 7, 2025

This is a simple FAPO that takes a user-provided sample ring buffer and sample counter and will write incoming samples into it. It averages all incoming channels so the user doesn't need to know the channel count. The sample counter increases once per input block from the mixer, which allows the user to detect whether a new block of samples has been processed since the last time they checked.
The sample counter is written using atomics so the user won't observe a torn write, and since the ring buffer is updated one float at a time it's safe for us to race against the consumer without a lock (the odds of them reading from the buffer while we're writing to it are quite low, and for most use cases it would be unobservable).

This is designed to work great as a way to feed a spectrum analyzer or realtime waveform display, where you just want a buffer with N recent samples into it independent of the mixer resolution - for an FFT you probably want a buffer size that's a power of two, for example.

Haven't been able to test this yet so this draft is mostly to solicit API design feedback etc. and give people time to think about it.

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.

1 participant