Author Topic: Use Bass.BASS_SetDevice to swap channel 0 = no sound, 1 = first real output devi  (Read 118 times)

Willto

  • Posts: 1
Greetings I have an Audio player written in C # with BASS.net the situation is that I use BASSWASAPI BASS_WASAPI_GetData (IntPtr, Int32) to obtain FFT sampling and display it as a spectrum analyzer, this requires initializing by BASS_Init (0 without sound) and to reproduce A file is also necessary to initialize but with BASS_Init (1 first real output device) but I cannot manage to operate both at the same time if there is an example I would appreciate it.

This question generates some questions and thanks for your attention.
1-How many devices does a PC have by default, with only one sound card?

2-If it is possible to use device 0 = "no sound" and -1 = default output device at the same time?

« Last Edit: 10 Aug '19 - 15:42 by Willto »

Ian @ un4seen

  • Administrator
  • Posts: 21973
Yes, it is possible to use multiple devices at a time. You need to use BASS_SetDevice to set the thread's device context before calling BASS functions that deal with a device (see the BASS_SetDevice documentation for a list). In your case, you can actually avoid that with the latest (not yet released) BASSWASAPI build, as it no longer requires the "No Sound" BASS device to be initialized (any device can be). You can get that from here:

   www.un4seen.com/stuff/basswasapi.zip

Regarding the number of devices, you can enumerate all devices with BASS_GetDeviceInfo. 0 is always the "No Sound" device, and 1 is always the "Default" device if the BASS_CONFIG_DEV_DEFAULT option is enabled.