在Qt中捕获音频信号 [英] Capturing Audio signals in Qt

查看:60
本文介绍了在Qt中捕获音频信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在Qt中捕获音频输出的副本,以便我可以对其进行处理.这里表示可以监视播放,但我认为只有在使用自制音乐播放器的情况下才有可能,但我不希望这样做.我想从播放器的任何位置(youtube,spotify,facebook等)捕获信号.有没有一种方法可以使用Qt分析此数据?可以将声卡的输出设置为QMediaSource吗?

I was wondering if it is possible to capture a copy of the audio output in Qt so I can process it. Here they said it's possible to monitor the playback, but I think it's only possible if you use a self made music player, which I don't want. I want to capture the signal from no matter where it is player (youtube, spotify, facebook, etc.). Is there a way to analyze this data with Qt? Is it possible to set my output of my soundcard as a QMediaSource?

谢谢.

推荐答案

通常,不可能,这仅仅是因为您的进程(以及因此加载到您的进程中的Qt库)无法访问该信息.(我认为这种缺乏访问权限是有意的;因为如果确实具有这种访问权限,可能会涉及安全和/或隐私问题,即应用程序A可以使用它来监视应用程序B的音频输出,等等)

In general, no, that isn't possible, simply because your process (and therefore the Qt library that is loaded into your process) does not have access to that information. (I believe this lack of access is deliberate; since if it did have access like that, there might be security and/or privacy implications, i.e. app A could use it to spy on the audio output of app B, etc)

您可能会使用特定于操作系统的机制;例如,如果您在MacOS/X下运行程序,则可以安装 SoundFlower 音频驱动程序可以用作回送设备,允许程序从以前路由到其音频输出"的音频输入"中读取音频.但是,如果没有这种外部支持,当前将无法通过Qt记录计算机的音频输出.

There may be an OS-specific mechanism that you can use; for example, if you are running your program under MacOS/X, you can install the SoundFlower audio driver that can function as a loopback device, allowing programs to read audio from its "audio input" that was previously routed to its "audio output". But without that kind of external support, it's not currently possible to record the computer's audio output via Qt.

这篇关于在Qt中捕获音频信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆