Mic input for Asio devices

I’m working on Unity/Windows, and would like to use the mic from an Asio device.

So far, I’m doing something similar to what’s on this question:

With the difference that just before the init, I set up the Asio device.

system.setDSPBufferSize(dspBufferSize, dspBuffersCount);

If I leave out the first line and select a “normal” (non-Asio) mic, it works fine.
If I add the first line, I’m always getting 0 from getRecordPosition. There doesn’t seem to be any errors thrown, and isRecording is returning true.

Is there anything else that needs to be set up to use the mic from an Asio Device? Or any suggestion on how to troubleshoot this?
(I’ll try to clean up and upload a bigger part of the code, if it’s helpful)

By the way, I tested the device in OBS (using this plugin: GitHub - Andersama/obs-asio: ASIO plugin for OBS-Studio) and it seems to be working fine there, so I’m guessing there are no issues with the drivers or hardware.


Turned out that the value that I was using for the dspBufferSize was not correct.
It didn’t throw an error or anything, but the data was not being captured.
(Setting clearly wrong values do send an error on init, though.)

After testing for a while, a value of 512 turned to work fine for the device I’m using.
Since no other value seems to be working, is there a way to programmatically find this value, or has it has to be found by trial and error?

FMOD should be setting using the optimal buffer size by default, so you shouldn’t need to set it manually. If you do need to set it manually then you will need the sample rate from System::getDriverInfo to help determine the best buffer size to use.

See System::setDSPBufferSize for more info.