Author Topic: Possible to get Asio/WDM device ID by driver name?  (Read 353 times)

Mike de Groot

  • Guest
I need to get both (asio and wdm) device id's for bass and bassasio initializations.
I want to do so by using the driver's name.

Is it possible?
If so, how?
If not, why? (Seems to me its a usefull feature to automaticly select the right device without having the use of an GUI)

Ian @ un4seen

  • Administrator
  • Posts: 21674
Re: Possible to get Asio/WDM device ID by driver name?
« Reply #1 on: 9 Nov '18 - 13:33 »
A device's "Device Instance Id" or "Device Instance Path" string (depending on Windows version) is available from BASS_GetDeviceInfo, at the end of the "driver" string. You can access it like this:

Code: [Select]
BASS_GetDeviceInfo(device, &di);
const char *interface = di.driver + strlen(di.driver) + 1;

It isn't possible to be sure what device an ASIO driver will use, so you will probably just have to go by the BASS_ASIO_DEVICEINFO "name" and "driver" strings there.


  • Posts: 198
Re: Possible to get Asio/WDM device ID by driver name?
« Reply #2 on: 10 Nov '18 - 07:22 »
Here's how I get the device ID for an ASIO output, in my MIDI driver:
Code: [Select]
// Initialize BASSASIO info

// It's not a (const char *) because I suppose you want to set
// the info later through the registry or something like that
char OutputName[MAX_PATH] = "TheDeviceYouWant\0";

// Iterate through the available audio devices
for (ULONG CurrentDevice = 0; BASS_ASIO_GetDeviceInfo(CurrentDevice, &info); CurrentDevice++)
// Return the correct ID when found
if (strcmp(OutputName, == 0)
OutputDebugString("It's a match! Return ASIO device...");
return CurrentDevice;

// Otherwise, return the first ASIO device (check if it's present too!)
OutputDebugString("No matches found, return 0...");
return 0;

You could adapt it to work with DirectSound/WASAPI devices too.
« Last Edit: 10 Nov '18 - 07:29 by KaleidonKep99 »