Hello.
I’m using Programmer Instrument to apply effects to player voices. Is there a callback that gets called after the effect is applied to get the processed samples? I need this so that I can reuse the data for playback elsewhere.
In my case, it’s a radio. The player speaks into local chat, and I want the audio from local chat to go straight to the radio with all the effects applied to local chat.
The final samples should not be mixed together, that is, I need the ability to get samples of each programmer sound separately.
[AOT.MonoPInvokeCallback(typeof(EVENT_CALLBACK))]
private static RESULT ProgrammerSoundEventCallback(EVENT_CALLBACK_TYPE type, IntPtr instancePtr, IntPtr parameterPtr)
{
EventInstance instance = new EventInstance(instancePtr);
instance.getUserData(out IntPtr stringPtr);
GCHandle stringHandle = GCHandle.FromIntPtr(stringPtr);
SoundWrapper soundWrapper = stringHandle.Target as SoundWrapper;
switch (type)
{
case EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND:
{
PROGRAMMER_SOUND_PROPERTIES parameter = (PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(PROGRAMMER_SOUND_PROPERTIES));
parameter.sound = soundWrapper.Sound.handle;
Marshal.StructureToPtr(parameter, parameterPtr, false);
break;
}
case EVENT_CALLBACK_TYPE.DESTROYED:
{
stringHandle.Free();
break;
}
}
return RESULT.OK;
}