开发者

Determine when a loud sound is played in C#

开发者 https://www.devze.com 2022-12-31 13:27 出处:网络
I want to determine if another program plays a sound above a certain threshold. I am not looking for checking the volume settings on the computer or anything like that. I really just need to see if an

I want to determine if another program plays a sound above a certain threshold. I am not looking for checking the volume settings on the computer or anything like that. I really just need to see if any 开发者_StackOverflow中文版app plays something higher then what I am expecting. Anyone know if this is possible or how to do it?


Check out this project on codeproject. It's a volume meter using managed DirectX and written entirely in C#.


There are many sources of possible sound on the local machine and ultimately these will communicate via the Windows Sound System down to a mixer and out through the sound card. The only way that I know of to monitor all sounds on a Windows system is to write a Filter Driver using the Device Driver Development Kit. This would intercept all requests to the sound system , walk through the data that is being sent for play and could set flags/write to a log when it spots large differences (where abs(data[x+1] - data[x]) is a large value).

Driver development is usually done in C. There is a bunch of sample code out there on the web if you want to go this route.


This looks like a good place to start your investigation. I don't think that you'll find what you're looking for built into .Net already, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消