I'm looking for an ability in managed code to monitor which processes are accessing microphone devices on my computer.
I was able to find C++ examples of viewing audio output (AudioSessionManager), but is there an API for input devices also?
Extended: How can one protect himself against microphone spying on Windows oeprating system?
Related
I have a USB microscope camera and I would like to open the Windows 10 camera app automatically if the camera gets connected to a USB port. After checking that this isn't possible with Windows 10 at the settings level, I have decided to write a short C# program that monitors the USB ports for a camera device connection (and runs the camera display app).
As to the monitoring I haven't got a slightest clue where to begin. Needless to say that the monitoring program should be lean with respect to blocking ressources, because it would be running all the time. Can I simply obtain an event notification of USB connection? Do I have to expect problems with permissions?
And of course, suggestions for alternative approaches are welcome, if any. Note that I do not want to capture and display video from the camera myself, unless it is easier to do it that way instead of opening the existing camera app.
assuming the microscope is using the web-camera interface I would look for guides about how to enumerate and connect to web-cameras. I have found a few alternatives:
Media capture API
Aforge
Versatile WebCam
I had most success with versatile webcam, but if you just want to enumerate devices any of them should do. Aforge is probably the easiest to use.
You can then use a timer to check for devices, and do something if the microscope is connected.
If the microscope is not a webcamera you will need to refer to the camera documentation on how to enumerate devices.
I have a Bluetooth Low Energy (BLE) device that streams audio through a custom service, and need to be able to use it in any Windows application (e.g. stream the audio to Skype or Google Chrome for example). I believe the only way is to make this audio source appear as a standard Windows audio input, but how to do this ?
I think the most reliable way to interract with a BLE device is through UWP (using Windows.Devices.Bluetooth.BluetoothLEDevice), so I used it to get the audio data. Then, I used the Windows.Media.Audio.AudioGraph to interract with the audio system. I'm able to generate the Windows audio stream from the BLE audio data with the AudioFrameInputNode and output it to my application default output with AudioDeviceOutputNode.
I can't override the default system audio input and audio output (e.g the laptop microphone and speakers) so in order to be able to use the output from my application as an input in other application, I used VB-Audio (https://www.vb-audio.com/) combined with the "App volume and device preferences" Windows feature. This way, I can use the VB-Audio Cable to connect the output of my application to the input of another, without having to set them as default system devices.
In theory, this should do what I need to do, but in fact, this setup isn't reliable.
I don't understand why, but the behavior isn't consistent at all. Most of the time, changing the audio settings (from "App volume and device preferences" and the "Audio devices panel") have no effect. With the same settings, sometimes it works but sometimes it doesn't (audio from my application is played on speaker instead of VB-Cable input, etc.)...
I don't know where the problem comes from, VB-Audio or Windows itself ? Is there a more reliable alternative to this setup ?
Otherwise, is there another way to use a custom audio source from an application like a standard Windows audio input ?
Please let me know if anything is unclear or you need any more information.
EDIT:
I think this post is actually about the same issue that I'm facing.
I'm wondering how difficult it is to read positioning data from an USB GPS Receiver (also known as "USB Mouse"). Is there some kind of ready-to-use API in .NET (like it is in mobile platforms like Android/WP7 etc.) which works because the GPS device's driver integrates much into Windows or is this some annyoing pinvoke stuff that depends on the GPS device?
Any experience?
Typically a GPS device shows up as a virtual com port. You should see it listed in com ports in the device manager. Nearly every GPS sends data to the computer using standard NMEA 0183 messages, you just need a library to read them. One really nice full featured one is DotSpatial, the DotSpatial.Positioning library should automatically find your gps and report data from it.
You may have to and your equipment supplier contact, and obtain recognition equipment driver, and call the API for communication equipment. If you can get from a GPS device on bytes, closer to success is just around the corner, and the rest is packaging and analytical data packets. PS: if is serial communication, realizing in DONET is more easily.
I am capturing the desktop using VLC and DirectShow an I need to find the main speakers audio device in order to capture all the sound from the desktop, can this be done programmaticly ?
I am using C# in windows XP and 7
You actually cannot capture data from speakers. The real options are:
audio capture from real audio input device, such as microphone
audio capture from loop back device (provided that it is enabled)
Note that loopback capture is different in Vista+ and older systems, also previously discussed here:
Is it possible to record sound played on the sound card?
Get sample of sound from stereo mix in Windows
https://stackoverflow.com/questions/6993186/windows-7-any-audio-libraries-supporting-loopback-audio-capturing-in-c
Do we have a way to simulate a webcam driver, that will provide realtime captured screen (30 frames per sec) as it's output?
This is one of several features of ManyCam (free). It is a virtual webcam driver through which you can stream your real webcam video (with optional real-time video effects), video or image files, or your full/partial desktop.
Yes, just google video2webcam. It works quite well and will loop a video or picture as output.
The driver's job is to provide a level of abstraction between the software and hardware. The driver is supposed to issue commands to the hardware. It's not responsible for taking pictures and turning it into an animated GIF for instance. It's going to do low level stuff like, turn the device on and off, send raw data to a socket.
That being said, if you need to create a virtual device driver. Here's an overview of VDD's. Windows Programming/Device Driver Introduction
Generally these are not written in higher-level languages such as C#. Rather, they are written in languages such as C/C++. You will need the KMDF, or Kernel-Mode Driver Framework.
If you just need to access a webcam from a .NET application on a system with a webcam, you just need an API.
Open your browser.. go to google.com and type ".NET webcam API"
You will see something like this:
Webcam in your own application
It appears that this is a wrapper for the DirectShow class.