4

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.

dynjo
  • 45
  • 1
  • 6

3 Answers3

0

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

Aran Mulholland
  • 23,555
  • 29
  • 141
  • 228
0

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.

Community
  • 1
  • 1
rcw3
  • 3,034
  • 1
  • 27
  • 24
0

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.

cnook
  • 117
  • 12
  • 3
    As usual, it's a huge example of a very nice and complete app. It even uses some code in C++. Hard to learn from. – Dan Rosenstark Oct 29 '12 at 16:27
  • Couldn't agree more! Why must they go through and render level meters using OpenGL ES in that example? Actually, the sheer amount of code alone for the level meters is ridiculous. Sample code should be exactly that... a sample or 'example' showing how to use the code or feature in question as minimally as possible, not a fully-fleshed out app with so much extra cruft. Don't even get me started about it not having comments! Someone really needs to teach Apple how to write code that actually teaches the reader something. – Mark A. Donohoe Jan 26 '13 at 04:38