以编程方式在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.