Plug/Unplug virtual device

I’m having a virtual audio driver and a virtual mic. Then I have a winform application to control the virtual device. Are there anyway that when my app is closed the virual device will be hidden from user, and when my app is opened again the virtual device wil appear.? Thank you.

What bigger problem are you trying to solve?

@Doron_Holan My app will cancel noise from the real mic and then send audio to virtual driver. User will use my virtual mic instead the real mic in other application(like skype). So I want my virtual mic to be hidden from user when my app is closed.

Yes, actually, there is a way.

You need to support the KSPROPERTY_JACK_DESCRIPTION property. I’m guessing you already support that, because starting with Windows 8, the Audio Engine won’t recognize your driver without it. The JACK_DESCRIPTION structure includes a member called IsConnected, which you are probably setting to TRUE. So, just set that to FALSE to start with. Then, when you want to change your availability state, you change that element, then fire off a KSEVENT_PINCAPS_JACKINFO_CHANGE event using IPortEvents::GenerateEventList. That will cause the Audio Engine to fetch your jack description again. It’s exactly the same as plugging or unplugging headphones into a physical headphone jack.

1 Like

Of course, the PROPER way to do what you have done is to write a GFX APO that sits inline with the audio endpoint.

1 Like