Author Topic: Bass.BASS_GetDeviceInfos() Returning Removed Devices  (Read 282 times)

findjammer

  • Posts: 15
Hi,

I'm just writing some code into my application that detects devices being added or removed.  This is all working great but I've hit a stumbling block with Bass.

On application initialisation I call Bass.BASS_GetDeviceInfos() to list the available devices.  This also all works great.  The problems start when my application detects that a device has been removed and re-executes a call to Bass.BASS_GetDeviceInfos().

For some reason this returns a list that still contains the removed device.

In this instances I'm testing with a USB audio device.  I can start the app with the device connected and the device appears in the list.  I can also start the app with the device disconnected and the device isn't in the list.  All good.  It seems that Bass.BASS_GetDeviceInfos() is using cached device data.  How can I tell it to refresh this before listing?

Thanks,

J

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: Bass.BASS_GetDeviceInfos() Returning Removed Devices
« Reply #1 on: 26 Sep '17 - 16:10 »
Devices are never removed from the device list because that would affect the device numbers. When a device becomes unavailable, the BASS_DEVICE_ENABLED flag is removed from it, so you can check for that. With BASS.Net, you can use the IsEnabled method of the BASS_DEVICEINFO class.

findjammer

  • Posts: 15
Re: Bass.BASS_GetDeviceInfos() Returning Removed Devices
« Reply #2 on: 26 Sep '17 - 22:17 »
Ahhhhhh OK.  Many thanks Ian.