C++/CLI 能让我控制音频等低级设备吗?
我想知道 - 与经典 C++ 相比,C++/CLI 有多少限制(笑) - 我想编写一个用 C# 无法实现的应用程序 - 我希望能够连接到 PC 的音频设备并且检测音频(例如)- 这是我可以用 C++/CLI 做的事情吗?
我尝试过将 NAudio 与 c# 一起使用,但我已经能够做到这一点。与 C# 相比,C++/CLI 或 C++ 还能给我带来哪些其他优势?
I was wondering - how much limitation is there to C++/CLI compared to classic C++ (chuckle) - I was wanting to write an application that I cannot do with c# -- I was wanting to be able to connect to the PC's audio device and detect audio (for example) - Is this something I can do with C++/CLI?
I have tried using NAudio with c#, but i have been able to do this. What other advantages would C++/CLI or C++ give me over c#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
免责声明:C++ 是我最喜欢的语言,所以我对像 CLR 这样的虚拟机有点偏见。
与 c# 相比,C++/CLI 或 C++ 还能给我带来哪些其他优势?
就我个人而言,我永远不会使用 C++/CLI,除非我需要包装现有的 C++ 代码库以便在 .NET 中使用。 C++/CLI 似乎将 C++ 和 .NET 的所有优点结合到了一个古怪的解决方案中。如果 .NET 是您的主要目标,我会使用 C#——它会让您的工作变得更加轻松。
Disclaimer: C++ is my favorite language, so I'm a bit biased against Virtual Machines like the CLR.
What other advantages would C++/CLI or C++ give me over c#?
Personally I'd never use C++/CLI unless I needed to wrap an existing C++ codebase for use in .NET. C++/CLI seems to have all the warts of C++ and .NET combined into one hacky solution. If .NET is your primary target, I'd use C# -- it's going to make your job a whole lot easier.
是的。 C++/CLI 为您提供本机 C++ 和 .NET 的全部功能,因为您可以根据需要混合使用两者(甚至在一个函数内)。因此,如果更容易的话,您可以用本机 C++ 编写需要的部分,而用 .NET 编写其余部分(通常是这样)。
Yes. C++/CLI gives you the full power of native C++ as well as .NET, because you can mix the two as much as you want (even inside one function). So you can write the parts that need to be native in native C++ and the rest in .NET if it's easier (which it usually is).
如果您想从 C# 应用程序捕获音频输入,那么编写 C++/CLI 包装器的所有艰苦工作都已经由 SlimDX - 他们将几乎所有内容都封装在 DirectX 中,以便在托管应用程序中使用。
就我个人而言,如果可以避免的话,我不建议在 C++/CLI 中编写任何内容。
If you want to capture audio input from a C# app, then all the hard work of writing the C++/CLI wrappers have already been done for you by the good folks over at SlimDX - they've wrapped pretty much everything in DirectX for use in managed applications.
Personally, I wouldn't recommend writing anything in C++/CLI if you can possibly avoid it.