Mac OS X 虚拟音频驱动程序 [英] Mac OS X virtual audio driver

查看:72
本文介绍了Mac OS X 虚拟音频驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个虚拟音频设备,它从默认输出(即输出 IOAudioStream)获取音频数据并将其转换为输入 IOAudioStream.

I want to create a virtual audio device that gets audio data from the default output (which is an output IOAudioStream) and converts it to an input IOAudioStream.

我浏览了我能找到的大部分示例,但是它们最多只实现了将输出 IOAudioStream 复制到输入的功能.这意味着它仅在选择音频设备作为输出时才将音频转换为输入流.

I went through most of the examples I could find, however they only implement a feature to copy the output IOAudioStream to the input one at most. That means it only converts the audio to an input stream if the audio device is selected as output.

这应该是可能的,因为 ScreenFlow 允许通过安装创建虚拟驱动程序的 kext 来录制计算机音频.

This should be possible, since ScreenFlow allows recording of computer audio by installing a kext that creates a virtual driver.

如何从默认输出访问音频数据并将其发送到我的虚拟驱动程序?

How can I access the audio data from the default output and send it to my virtual driver?

推荐答案

看看开源的WavTap,它是开源 SoundFlower 虚拟声卡驱动程序的简化分支.我相信这是一个 .kext,基本上可以满足您的需求.

Take a look at the open-source WavTap, which is a simplified fork of the open-source SoundFlower virtual sound card driver. It is a .kext that I believe does substantially what you want.

作为参考,以下是一些流行的商业闭源选项的工作原理:
Rogue Amoeba 的 Audio Hijack Pro
- 通过基于开源 SoundFlower .kext 的代码捕获系统音频
- 在启动应用程序时,通过用补丁"框架代替普通的 CoreAudio.framework 来捕获应用程序的音频
- 在 Unsanity 的 haxie应用程序增强器"(APE) 的帮助下捕获已运行应用程序的音频

For reference, here is how some popular commercial closed-source options work:
Rogue Amoeba's Audio Hijack Pro
-Captures system audio via code based off of the open-source SoundFlower .kext
-Captures an application's audio by substituting a "patch" framework for the normal CoreAudio.framework when launching the application
-Captures an already-running application's audio with the help of the haxie "Application Enhancer" (APE) from Unsanity

这些功能被称为即时启动"功能 (InstantOn.kext).

These features are branded as their "Instant On" feature (InstantOn.kext).

Ambrosia Software 的 WireTap Studio
- 通过内部开发的 .kext 捕获系统音频和应用程序音频

Ambrosia Software's WireTap Studio
-Captures system audio and application audio via an in-house developed .kext

Telestream 的 ScreenFlow
- 通过内部开发的.kext.(版本2.x 使用 varaudio.kext;3.x 版使用 TelestreamAudio.kext)

Telestream's ScreenFlow
-Captures system audio via an in-house developed .kext. (Version 2.x uses varaudio.kext; Version 3.x uses TelestreamAudio.kext)

Macsome 的 录音机
-未知方法

Macsome's Audio Recorder
-Unknown method

Araelium Group 的 Screenflick
- 使用 SoundFlower .kext 捕获系统音频

Araelium Group's Screenflick
-Captures system audio using the SoundFlower .kext

更新 #1
阅读作者的评论后,似乎潜在目标是能够捕获系统声音而无需将虚拟音频驱动程序发布为设备(将出现在系统偏好设置的列表中)和无需更改当前默认输出设备(或至少设备已更改的外观).

UPDATE #1
After reading the author's comments, it appears the underlying goal is to be able to capture the system sound without publishing the virtual audio driver as a device (that would appear in the System Preference's list) and without changing the current default output device (or at least the appearance that the device has changed).

SoundFlower:在安装时将声音设备添加到列表中
WavTap: 在安装时将声音设备添加到列表中;当 WavTap 应用程序启动时自动选择设备;应用程序关闭时自动取消选择设备并重新选择上一个设备
Audio Hijack Pro: 仅在选择默认系统声音的音频捕获时添加声音设备;不再选择音频捕获时删除声音设备并重新选择以前的设备
WireTap Studio:未知
ScreenFlow:在不更改当前默认输出设备和不将虚拟音频驱动程序发布为设备的情况下捕获系统声音

SoundFlower: Adds a sound device to the list upon installation
WavTap: Adds a sound device to the list upon installation; auto-selects the device when the WavTap application is started; auto-deselects the device when the application is shutdown and reselects the previous device
Audio Hijack Pro: Adds a sound device only when audio capture of the default system sound is selected; removes the sound device when audio capture is no longer selected and reselects the previous device
WireTap Studio: Unknown
ScreenFlow: Captures the system sound without changing the current default output device and without publishing the virtual audio driver as a device

更新 #2
引用 Apple CoreAudio 工程师 Jeff Moore 对 WireTap 和 Audio Hijack Pro 等应用的引用:
系统上没有 API 可以为您提供任何特定应用程序的输出或整个混音到硬件......系统不支持[捕获系统声音],这些人必须聪明.没有什么能阻止你做同样的事情,除非你很愿意把手弄脏.事实上,Mac OS X 的音频系统首先是为性能而设计的.这导致我们的设计在不施加性能损失的情况下支持您想要的功能并不容易.因此,我们以无法提供此功能为代价选择了更好的性能."

如果您想阅读有关该主题的更多信息,请查看 CoreAudio API 邮件列表中的这些主题:
"WireTap、CoreAudio 的 API、系统捕获和 kexts...
关于捕获软件播放的音频的另一个问题"
在 Mac 上使用 CoreAudio 捕获当前播放的音频"
"'音频劫持'"
监控系统音频输出,如线控"
将音频输出捕获到文件"
镜像音频输出"
录制系统音频"

If you want to read more on the subject, check out these threads on the CoreAudio API mailing list:
"WireTap, CoreAudio's API, and system capture, and kexts..."
"Another question on capturing audio played back by a software"
"Capturing currently played audio using CoreAudio on Mac"
"'audio hijack'"
"monitoring system audio output like wire tap"
"Capturing audio output to a file"
"Mirroring Audio Output"
"Recording system audio"

相关 SO 问题:
使用无代码 kext 隐藏音频设备

Relevant SO Questions:
Hide Audio device using codeless kext

长话短说,您不太可能从 Apple 找到实现此目的的示例,也不太可能找到实现此目的的开源代码,除非有人感觉非常慷慨的.信息似乎太有价值了.

So long story short, you're not likely to find examples from Apple that accomplish this, and you're not likely to find open source code that accomplishes this either, unless someone is feeling very generous. It appears to be too valuable of information.

这篇关于Mac OS X 虚拟音频驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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