sbooth / SFBAudioEngine

A powerhouse of audio functionality for macOS and iOS
https://sbooth.github.io/SFBAudioEngine/
MIT License
552 stars 87 forks source link

Does the pre-render callback still exist? #289

Closed bsneed closed 6 months ago

bsneed commented 6 months ago

Hi Stephen,

Hope you're doing well. I saw in the commit history it's been almost 10 years since we last talked :D I see the library is very different, in all positive ways. I've been searching for a bit in case I missed it, but there used to be a SetAudioPreRenderCallback method on the player. You could set it and it'd hit your callback with the left and right buffer arrays, along with the number of frames.

I'm guessing it's gone, but thought I'd see if there was something equivalent that maybe I was overlooking. I had been using this way back when to feed samples into quartz composer visualizations.

Thanks!

sbooth commented 6 months ago

I'm glad you're trying out the "new" version!

The pre-render callback method is gone but you should be able to accomplish something similar by installing a tap on the audio engine's output node, or depending on your needs, installing a render observer on one of the AUAudioUnits in the graph.