Using a JUCE static library in a native iOS project

Hello, I am integrating a static JUCE lib into a native iOS project. I have the lib hooked up and have used some of the methods, but I am struggling to figure out how to use a method that passes in a buffer, adds an effect to the audio in realtime, and then plays the processed audio back as the user is singing into their phone.

I am currently using Swift with AVAudioEngine, and then I have an Obj C++ wrapper that communicates with the JUCE lib.

Below is a bit of code to help explain the problem more. I am tapping the mic and I am able to gain access to the buffer and send that buffer to my Obj C++ wrapper. The issue is, I am not sure how to reattach the buffer to the audio output of the device so that the user will here the audio processed in realtime.

Any help would be appreciated!


func startRecording() throws {
    mixer.installTap(onBus: 0, bufferSize: 1024, format: format, block:
            { (buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in
               // call audio wrapper


C++ code to connect to JUCE lib:

- (NSString *)passBuffer:(NSData *)inBuffer {
    // Call Process method from JUCE lib
    void AudioLib::process (inBuffer, outputBuffer, frames);

Ultimately, I need to call that process method in realtime, so that the user can sing into their phone and hear the processed audio back.

you need to get the raw data pointer from the NSData to pass into C++ code.