BASSWASAPI loopback by target pid

Started by MB_SOFT,

MB_SOFT

hi Ian,
is there any plan to add the loopback by target pid to BASSWASAPI? it's available since windows 10 build 20348

Ian @ un4seen

I'll look into it and see if something can be arranged.

Ian @ un4seen

Here's something for you to try:

   www.un4seen.com/stuff/basswasapi.zip

It adds the following flag that can be used to specify a per-process loopback in BASSWASAPI function "device" parameters:

#define BASS_DEVICE_PROCESS 0x80000000

For example, you could use it in a BASS_WASAPI_Init call like this:

BASS_WASAPI_Init(BASS_DEVICE_PROCESS | pid, freq, chans, BASS_WASAPI_EVENT, 1, 0, WasapiProc, NULL);

Note a sample format must be provided, ie. you can't just use 0 for the "mix format" because that isn't available. Also, WASAPI seems to accept an invalid process ID and just delivers silence in that case.

This stuff hasn't been tested much yet, so please report how you get on with it.


AndyMK

#4
I just spent a 3 days implementing this. I wish i saw this earlier. I'll check out the BASS WASAPI version. Would it be too much to ask if we could have IAudioSessionNotification, IAudioSessionControl and IAudioSessionEnumerator to get notified about current and new process id's that use WASAPI audio?
I already have this done but would be nice to have it in the library to complement per process capture.

AndyMK

Quote from: Ian @ un4seenHere's something for you to try:

   www.un4seen.com/stuff/basswasapi.zip

It adds the following flag that can be used to specify a per-process loopback in BASSWASAPI function "device" parameters:

#define BASS_DEVICE_PROCESS 0x80000000

For example, you could use it in a BASS_WASAPI_Init call like this:

BASS_WASAPI_Init(BASS_DEVICE_PROCESS | pid, freq, chans, BASS_WASAPI_EVENT, 1, 0, WasapiProc, NULL);

Note a sample format must be provided, ie. you can't just use 0 for the "mix format" because that isn't available. Also, WASAPI seems to accept an invalid process ID and just delivers silence in that case.

This stuff hasn't been tested much yet, so please report how you get on with it.

Seems to work fine :)

Ian @ un4seen

Good to hear that the new BASS_DEVICE_PROCESS option is working well.

Quote from: AndyMKWould it be too much to ask if we could have IAudioSessionNotification, IAudioSessionControl and IAudioSessionEnumerator to get notified about current and new process id's that use WASAPI audio?
I already have this done but would be nice to have it in the library to complement per process capture.

BASSWASAPI doesn't currently use those interfaces. Looking at them now, it appears that each device would need separate session enumeration and notification registration? Do you know if there's a global option covering all devices?

AndyMK

I am pretty sure its per Interface only but you could have an option to specify the interface when initializing.