Is it possible to extract microphone ID's separately from speakers?

Hello,

I’m making audio settings for a game where I need to select a microphone. Using the RuntimeManager.CoreSystem.getRecordNumDrivers() function I can get the ID of the audio devices, then using the RuntimeManager.CoreSystem.getRecordDriverInfo() function I can get the device characteristics, but is it possible to get the ID of the microphones only? Or are there any special characteristics of microphones so that one can determine that this device is a microphone, apart from the name of the device.

Thanks.

Can you elaborate on what drivers are being listed that aren’t microphones? Are you referring to loopback devices?

Yes, loopback drivers

I found another similar topic on the forum, and apparently the answer is still relevant. I didn’t know that the loopback suffix adds fmod automatically

FMOD doesn’t filter loopback devices from the device list, but yes, it does add the suffix " [loopback]". For the moment, manually filtering any devices with the suffix is your best option, as the intended workflow of retrieving recording devices doesn’t really allow for exclusion. However, a clearer means of signalling that a device is loopback devices seems useful, so I’ve added it to our internal feature/improvement tracker

1 Like

It would also be convenient to return data not through parameters with the out keyword, but as an object, for example, as I did. Often you don’t need to get all the data, but you still have to specify parameter names or “_” in parameters.

Example code
[Serializable]
public struct RecordDriverInfo
{
    [SerializeField] private int _id;
    public readonly int ID => _id;

    [SerializeField] private string _name;
    public readonly string Name => _name;

    [SerializeField] private Guid _guid;
    public readonly Guid GUID => _guid;

    [SerializeField] private int _sampleRate;
    public readonly int SampleRate => _sampleRate;

    [SerializeField] private SPEAKERMODE _speakerMode;
    public readonly SPEAKERMODE SpeakerMode => _speakerMode;

    [SerializeField] private int _speakerModeChannels;
    public readonly int SpeakermodeChannels => _speakerModeChannels;

    [SerializeField] private DRIVER_STATE _state;
    public readonly DRIVER_STATE State => _state;

    public RecordDriverInfo(int id, string name, Guid guid, int systemRate, SPEAKERMODE speakerMode, int speakermodeChannels, DRIVER_STATE state)
    {
        _id = id;
        _name = name;
        _guid = guid;
        _sampleRate = systemRate;
        _speakerMode = speakerMode;
        _speakerModeChannels = speakermodeChannels;
        _state = state;
    }

    public RecordDriverInfo(int id)
    {
        RuntimeManager.CoreSystem.getRecordDriverInfo(
            id,
            out string name,
            200,
            out Guid guid,
            out int systemRate,
            out SPEAKERMODE speakerMode,
            out int speakerModeChannels,
            out DRIVER_STATE state);
        _id = id;
        _name = name;
        _guid = guid;
        _sampleRate = systemRate;
        _speakerMode = speakerMode;
        _speakerModeChannels = speakerModeChannels;
        _state = state;
    }
}

Thanks for the suggestion, I’ve added it to the tracker - returning a struct of info via pass-by-reference/out is something that is done in other places in the API, so there is a precedent for something like this.

1 Like