Gain sole control of Audio Output, DirectSound

有些话、适合烂在心里 提交于 2019-12-11 13:59:22

问题


I am creating a basic signal generator and decided to use my audio card as the analogue output. I chose to use DirectSound because... it seemed like a good option.

I have it up and running quite nicely, but I now realize that my code using secondary buffers and as such any other sounds on the computer get mixed in with my generated signal. This is something of an issue, as when I'm running a motor I don't want it to get sent an MSN poke noise as a command.

In order to gain total control I've attempted to take over the system by setting my cooperative level to DSSCL_WRITEPRIMARY. All in all this strategy is really giving me a headache as I am running into error after error trying to get this set up. The documentation on using the primary buffer isn't great and I can't find any really good examples.

So my question is:

  1. Does anyone have a good, working example of taking over and writing to the primarybuffer.

  2. Is there a simpler way of outputing a waveform to the audio card, and ensuring that my application has full and sole control?

Thank you


回答1:


only thing I've seen related is:

http://blogs.msdn.com/b/matthew_van_eerde/archive/2009/04/03/sample-wasapi-exclusive-mode-event-driven-playback-app-including-the-hd-audio-alignment-dance.aspx



来源:https://stackoverflow.com/questions/3191107/gain-sole-control-of-audio-output-directsound

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!