以编程方式在Mac上的Cocoa中流式传输音频 [英] Programmatically stream audio in Cocoa on the Mac

查看:229
本文介绍了以编程方式在Mac上的Cocoa中流式传输音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Mac上的Cocoa以编程方式创建音频流。例如,在Cocoa应用程序中,在Mac OSX上使用核心框架的白噪声发生器?

How do I go about programmatically creating audio streams using Cocoa on the Mac. To make, say a white-noise generator using core frameworks on Mac OSX in Cocoa apps?

推荐答案

a href =http://developer.apple.com/documentation/MusicAudio/Reference/CoreAudio/book_intro/chapter_1_section_1.html#//apple_ref/doc/uid/TP30001108-CH201-DontLinkElementID_85 =nofollow noreferrer> CoreAudio DefaultOutputUnit。

One way is using the CoreAudio DefaultOutputUnit.

您可以使用输出采样率,分辨率和输出样本格式等参数进行配置。然后你可以通过编程方式创建一个原始声波并提供给输出单元。

You can configure it with parameters such as output sampling rate, resolution, and output sample format. Then you can programmatically create a raw sound wave and provide this to the output unit.

看看这个例子在你的机器上的/ Developer / Examples / CoreAudio / SimpleSDK / DefaultOutputUnit /

Take a look at this example on your machine at /Developer/Examples/CoreAudio/SimpleSDK/DefaultOutputUnit/

它使用默认输出单位播放以程序方式渲染的正弦波。

Which uses the default output unit to play a programmatically rendered sine wave. Using that as a starting point and you can write a routine to render any thing else to output.

这个位置在/ Developer / Examples / CoreAudio /还包含吨的其他核心音频示例。

This location at /Developer/Examples/CoreAudio/ also contains tons of other core audio examples.

这篇关于以编程方式在Mac上的Cocoa中流式传输音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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