AudioQueue in-memory playback example

2019-03-21 08:27发布

Does anybody know of any examples using AudioQueue that play from an in-memory source?

All the examples I can find play from files (using AudioFileReadPackets) but in my particular case I am generating the data myself in realtime so ideally, I want to enqueue the data myself rather than sucking it out of a file using the callback.

Any help much appreciated.

3条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-03-21 08:54

The Audio Queue Services Programming Guide should give you the details you need but obviously is a bit lax on the specific example you are looking for. You just need to push the in-memory audio data through the output queue instead of the PCM data from the file via AudioFileReadPackets.

I found a reasonable example of sound synthesis in the AudioQueue player callback in another stackoverflow question.

查看更多
在下西门庆
3楼-- · 2019-03-21 08:55

SpeakHere Example may be the best example for you. The example records sound from device and play it. You can find this example in the Apple sample site.

查看更多
Ridiculous、
4楼-- · 2019-03-21 09:07

i know of an example using audio units that you could adapt, as the callbacks are very similiar, try here

查看更多
登录 后发表回答