Skip to content

Can I get the device info from ASIO controlpanel by C#? #1185

Open
@hlz2516

Description

In the process of researching simultaneous recording and playback, I found that in my C # code, the input and output sampling rates are manually written(like this):

            var drivers = AsioOut.GetDriverNames();
            var asioOut = new AsioOut(drivers[0]);
            var bufferedWaveProvider = new BufferedWaveProvider(new WaveFormat(48000, 4));
            asioOut.InitRecordAndPlayback(bufferedWaveProvider, 2, 48000);
            asioOut.AudioAvailable += AsioOut_AudioAvailable;

I think they should be the same as the sample rate of the input and output device currently being used instead of being manually written, but I don't know how to do it.
After calling ShowControlPanel(), moving the mouse over an audio device in the control panel will display the corresponding sample rate, as shown in the figure:
Snipaste_2024-09-21_02-10-21
I want to get the sample rate of the currently used device in this control panel, but I found that NAudio doesn't seem to have a corresponding API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions