Suppose that there are multiple AudioSources and both AudioClip and output mixer group(my native reverb audio plugin attached) are assigned to each AudioSources.
When playing, each AudioClip’s audio chunk data will be passed to my native spatializer plugin first.
Then, all processed audio data will be synthesized and sent to the plugin within the mixer group.
What I want to do is
to store all original audio data chunks at each audio frame into a variable within my nativereverb audio plugin before my native spatializer plugin processes audio data
The idea is that you get your data from the buffer, do some processing with it and feed it back to the buffer. The example on the page shows how to change the overall volume (gain) of the incoming audiodata. All is happening in realtime by the way. You could use that same principle to change the data anyway you want. Lets say you have setup an audiosource and also the clip variable of it, and then you call audiosource.Play. From that moment on the data gets passed through the OnAudioFilterRead function and you can modify/store it.
Here’s an example of how your code might look:
void OnAudioFilterRead(float[] data, int channels)
{
for (int i = 0; i < data.Length; ++i)
{
data[i] = CreateReverb(data[i]); //pass data to your reverb function
}
}
float CreateReverb(float data)
{
//do something with the data
return data;
}
I guess you have to do some experimenting first to get a general idea of how it works, and then change your code so it satisfies the conditions you are after. If my example doesn’t make any sense let me know and we’ll figure out a different way to get the point across