获得对音频输出、DirectSound 的唯一控制

编程入门 行业动态 更新时间:2024-10-26 02:30:40
本文介绍了获得对音频输出、DirectSound 的唯一控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在创建一个基本的信号发生器并决定使用我的声卡作为模拟输出.我选择使用 DirectSound 是因为...它似乎是一个不错的选择.

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.

我已经启动并运行得很好,但我现在意识到我使用辅助缓冲区的代码以及计算机上的任何其他声音都会与我生成的信号混合在一起.这是一个问题,因为当我运行电机时,我不希望它收到 MSN 戳噪声作为命令.

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.

为了获得完全控制,我试图通过将我的合作级别设置为 DSSCL_WRITEPRIMARY 来接管系统.总而言之,这个策略真的让我很头疼,因为我在尝试设置此设置时遇到了一个又一个错误.关于使用主缓冲区的文档不是很好,我找不到任何真正好的例子.

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.

所以我的问题是:

有没有人有一个很好的、有效的例子来接管和写入主缓冲区.

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

是否有一种更简单的方法可以将波形输出到声卡,并确保我的应用程序拥有完全和唯一的控制权?

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

谢谢

推荐答案

我见过的唯一相关的是:

only thing I've seen related is:

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

这篇关于获得对音频输出、DirectSound 的唯一控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 20:15:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1123433.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:音频输出   DirectSound

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!