Is there any way to monitor microphone changes (plug in and plug out events)? Shouldn't matter if the mic is bluetooth / usb / or plugged directly to sound card.
Application is built with C# but if there isn't any good way to get the events using C# then C++/CLI might be also option.
I found also IMMNotificationClient from WASAPI which should work.
Seems NAudio is not exposing this, but after customization I'm able to use it and get plugin / plugout events. Although it doesn't seem really stable - duplicated events / missing events and etc. Is there any proper implementation example in managed level?
Interface description :: IMMNotificationClient interface
This link may help:
http://blogs.msdn.com/b/coding4fun/archive/2009/10/08/9905168.aspx
The post includes instructions on capturing the microphone level, etc.
Original post. Microphone Input
EDIT: Blog moved here: https://channel9.msdn.com/coding4fun/articles/NET-Voice-Recorder
Related
I am developing an application in C#, at some point of the program, I'd like to have control of the speaker, more specifically, I'd like to control the voice balance (which speaker - left/right - the voice is coming from). Is there a way to do this?
Thank you,
It depends on how you are using the audio. If you have a two speaker setup, then all you need to do is to create a sound that only plays on the left or right chanel - depending on your requirements.
I have not done this recently, but a few opensource libraries you could have a look at are:
http://windowsmedianet.sourceforge.net/
http://naudio.codeplex.com/
Also check out the multimedia MSDN entry:
http://msdn.microsoft.com/en-us/library/ms712636(VS.85).aspx
Hope this helps.
Cheers.
Just doing some advanced scouting so to speak here...
For my Pandora client, Elpis, I support global media keys (MediaPlayPause, MediaNext, etc. on the keyboard) and I want to be able to support AVRCP from bluetooth headphones if possible. I do not currently have any (though will try to get some soon).
My main question is, what events (keyboard or otherwise) are fired by AVRCP commands in windows?
Is it something that depends on the BT adapter and/or driver stack?
I would love it if they just were exposed as the same media keys mentioned above, but I can not find any official MS documentation confirming or denying that... But from what I can tell, WMP supports it but some other media players do not (though they support the standard media keys), which leads me to believe it is different events.
Any insight would be greatly appreciated.
There isn't a set of exposed events available for Bluetooth on Windows. Btd.dll contains this functionality and uses the PassThruOpId enum for play, stop, pause, FF and RW. Click here for the MSDN entry on this.
UPDATE As per the comment below I am unable to find any documentation other than that of the Compact Framework for this question.
UPDATE: Here is a link to the Windows Bluetooth Driver Stack. Also checkout this other stack question.
Don't know where its documented at MSDN...assuming it exists at all. But I have some other references:
http://download.microsoft.com/download/5/E/6/5E66B27B-988B-4F50-AF3A-C2FF1E62180F/CON-T564_WH08.pptx
Slide 10 -- "HF and AVRCP controls are mapped to Human Interface Device (HID) controls"
Slide 14 -- "AVRCP Controls are mapped to Human Interface Device (HID) API"
and table of mapping between AVRCP and HID values
IIRC it's also discussed by Larry Ostermann in this video: http://channel9.msdn.com/blogs/charles/inside-windows-7-larry-osterman-on-new-audio-capabilities At least Bluetooth phone Call control is discussed at 00:33:35 according to my notes.
I need to listen for keyboard events from a specific keyboard device & know which key is pressed in a (C#) WPF application. Ideally, this shouldn't be window dependant and work so long as the application has focus.
unfortunately I can't think of / find any way to do this.
any ideas?
D.R
Edit: I've been looking into the OpenTK.Input library, which has a nice interface for keys... Does anybody know how to get a KeyboardDevice without creating a GameWindow
Info: Just by the way, this is for a barcode scanner which emulates a keyboard... who's bright idea was that, eh?
I'm actually working on a project that does exactly that. Check out Kaptivate. It installs a global keyboard hook, and ties together (using magic) the raw input api, and then invokes a callback function so that YOU can decide (1) is this the device I'm after?, and (2) should I allow other apps to see it, or just keep the keystroke for myself. Right now it's only C++ but one of the goals is eventually to have C# wrappers.
For keyboards, each generated event tells you the vkey, scan code, and source device.
Have a look at the below 2 articles.
Using global keyboard hook (WH_KEYBOARD_LL) in WPF / C#
https://gist.github.com/471698
both should be exactly what you want...
Managed to find this tutorial on msdn. along with a Sample Scanner object which comes with the POS.Net SDK
I haven't really had the time to pick apart how it works yet to give a proper overview, but it seems I should be able to write a custom service object abstraction for any "keyboard wedge" HID device.
I would like to know if it is possible to mute only a specific window. For example I have got Firefox open and two more windows. I want to mute everything related to Firefox but not the whole sound of my computer.
Is this possible? If so, how can it be done?
look, basically, there isn't any relation between the window handle and the sound which something in its code is playing.. the audio card can't tell who wants it to play.
theoretically, there is an option to do what you want on web browsers, but it's not easy, and not 100%. it goes like this:
most of the audio that is playing from browsers are from known objects like wmp/quick time/vlc/flash/etc..
when the user will choose to mute all audio from firefox, your application will search those known objects in the firefox tabs, and mute/unmute them using their api.
in order to do that, you will need to write an extension to firefox, so you could have an access to the tabs memory from your application.
btw, what os?
and check this out: http://www.indev.no/?p=projects#flashmute (flashmute) i believe it does what is said - only for flash.
On Vista/Windows 7:
I expect there to be some API which can change the volume on a per process basis which the audiomanager uses. Should be relatively straight forward to use.
On XP
I don't think there is any built in functionality for what you want to do. I recommend just not offering that feature on XP. But if you really want to, there are some hackish solutions:
Usermode API hooking. Intercept the calls to audioapis with your own functions. These change the volume or manipulate the audiosignal so you get what you want. You need to do this differently for any of the several available audio-apis. I guess DirectSound and DirectShow are particularly annoying. And this requires injection of a dll into any process you want to manipulate. And this dll better not require the .net runtime. Search for IAT(import address table) or EAT(export address table) hooking.
Kernel mode audio hooking. Write a driver which intercepts the audio in the kernel and changes it on a per process basis. No clue how to do that.
But as you can see both solutions aren't good.
I'm writting a hobby project to deal with files on cameras.
Previously I found issues with the camera and the FolderBrowserDialog.
What I believe is happing is that the camera is using MTP or PTP (Picture Transfer Protocol not peer-to-peer).
In order to make interfacing with the camera more seamless I'd like to use PTP or MTP to access the camera. Are there any MTP / PTP Wrappers for .Net people can recommend? I'm keen to avoid writing my own or dabbling in unmanaged code if possible.
I have found this blog post by dimeby8 which has been a great starting point with a lot of useful information about how the protocol works, however it leaves a lot to be desired in the way of managed implementations
http://blogs.msdn.com/dimeby8/archive/tags/C_2300_/default.aspx
I have also found a crude C++/CLI MTP wrapper- it has next to no functionality but is a good demonstration of mixed managed/unmanged code:
http://ko.sourceforge.jp/projects/sfnet_mtpsharp/
And there's a CodePlex project but it doesn't demonstrate transfers or - what I'm interested in- editing camera metadata (specifically the camera date)
http://www.codeplex.com/portabledevicelib/
Have you had any success with this project?