Where do I load my own impulse response (IR) into the demo convolution reverb plugin from the Native Audio Plugin SDK, please?
The C# code of the ConvolutionReverbUploadIR is:
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class ConvolutionReverbUploadIR : MonoBehaviour
{
[DllImport("AudioPluginDemo")]
private static extern bool ConvolutionReverb_UploadSample(int index, float[] data, int numsamples, int numchannels, int samplerate, [MarshalAs(UnmanagedType.LPStr)] string name);
public AudioClip[] impulse = new AudioClip[0];
public int index;
private bool[] uploaded = new bool [64];
private AudioClip[] currImpulse = new AudioClip [64];
void Start()
{
UploadChangedClips();
}
void Update()
{
UploadChangedClips();
}
void UploadChangedClips()
{
int currindex = index;
foreach (var s in impulse)
{
if (currImpulse[currindex] != s)
uploaded[currindex] = false;
// if s is not null and is loaded and uploaded/ uploading
if (s != null && s.loadState == AudioDataLoadState.Loaded && !uploaded[currindex])
{
// debug log state uploading impulse name
Debug.Log ("Uploading impulse response " + s.name + " to slot " + currindex);
float[] data = new float[s.samples];
s.GetData(data, 0);
ConvolutionReverb_UploadSample(currindex, data, data.Length / s.channels, s.channels, s.frequency, s.name);
uploaded[currindex] = true;
currImpulse[currindex] = s;
}
currindex++;
}
}
}
Any help would be appreciated, please.