Hi!
I'm working on a project where I need as-near-to-real-time response to serial data, i.e. a sensor is triggered and the system responds by playing a sound.
I have two solutions which I've built:
- A queue based multithreaded using Ardity: Arduino + Unity over COM ports (dwilches.com)
- A C++ dll which runs it's own thread externally to Unity and attempts to communicate with the main thread (not working at the moment).
I've optimised Wwise to run at the lowest latency and have optimised scenes in unity, such that the game should run over 60fps.
My issue is that there's > 60ms of delay between a trigger and an audio response. Some of this has to do with the way that the sensor works and unimplemented optimisations from the microcontroller side of things.
However, I'm getting up to 40ms of delay from the moment data is printed to serial and the triggering of a sound in Unity.
I imagine this is something to do with the interaction with the main thread and synchronisation with the framerate.
Is it possible to communicate with Wwise externally to the main thread of unity? I.e. can I access Wwise's api from the multithreaded c++ dll?