在可可从Mac捕获音频并保存到文件code样? [英] Code sample for capturing audio from a Mac in Cocoa and saving to file?

查看:196
本文介绍了在可可从Mac捕获音频并保存到文件code样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我由于对捕捉来自Mac的音频队列音频和需要将其保存到磁盘中一些合理的音频格式的小应用程序。

I'm due to work on a small application that captures audio from the Mac's Audio Queue and needs to save it to disk in some reasonable audio format.

有谁有一些体面的样本code(可可/ Objective-C的),他们可以分享?

Does anyone have a some decent sample code (Cocoa / Objective-C) that they can share?

我特别需要捕获正被传递到内置输出装置,以便将其录制到音频。任何见解?答案至今一直很有帮助,但并没有帮助我理解数据将如何输出可以被捕获,不可知的输入源。

I specifically need to capture the audio that is being passed to the Built-in Output device in order to record it. Any insights? The answers so far have been helpful, but have not helped me understand how the data going to the output can be captured, agnostic of the input source.

推荐答案

在Mac OS X中的音频工作涉及与核心音频接口。对于一个快速浏览,看看在核心音频概述

Working with audio in Mac OS X involves interfacing with Core Audio. For a quick overview, take a look at the Core Audio Overview.

您将需要进行输入和输出AUHAL接口;一个技术说明存在详述这样做所需的步骤。这code似乎通常是在C ++写的,因为这是在 SimplePlayThru演示所采取的步骤

You will need to interface with the AUHAL to perform input and output; a technical note exists detailing the steps required to do so. This code seems to usually be written in C++, as that is the procedure taken in the SimplePlayThru demo.

这并不包括以捕获音频输入所需的实际步骤。然而,这些链接应该为您提供足够的采样code开始与您的输入设备接口。我将在这个答案发布更多的联系,如果我碰到他们发生了。

This doesn't cover the actual steps required to capture that audio input. However, these links should provide you with enough sample code to begin interfacing with your input device. I'll post more links in this answer if I happen across them.

看看 /开发/例子/ CoreAudio的/服务/ AudioFileTools 。详细的,请看 afrecord.cpp 。诚然,这不是可可的本身的;可可本身似乎并没有对录音的具体功能。如果你需要有与C ++文件中的接口,你可能需要编写一些客观的C ++就像SimplePlayThru。

Take a look at /Developer/Example/CoreAudio/Services/AudioFileTools. Specifically, look at afrecord.cpp. Admittedly, this is not Cocoa per se; Cocoa itself doesn't seem to have any specific capabilities for recording. If you'll want to interface with the C++ file there, you'll likely need to write some Objective C++ like in SimplePlayThru.

这篇关于在可可从Mac捕获音频并保存到文件code样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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