Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bitblit

macrumors newbie
Original poster
Oct 5, 2008
4
0
I'm trying to playback audio from the microphone with a variable delay. Basically, an echo. I think I'm making a fundamental error though. I used the SpeakHere application as a template. I tried creating 2 queues: one record and one playback. Both are configured with the same format. I tried calling the enqueue on the opposite queue in the callback. In other words, in the recordingCallback, I enqueued the buffer into the playback queue. In the playbackCallback, I enqueued the buffer into the recording queue. Obviously, doesn't work.

What is the best way to do what I'm trying to do?
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
The basic idea is possible... I've got an app that can record and play at the same time.

I wouldn't try touching another queue's buffer inside a callback. Save (copy) the data from one queue into a separate ring buffer until the other queue is ready and calls for more data for its own buffers.

.
 

bitblit

macrumors newbie
Original poster
Oct 5, 2008
4
0
So just do a memcpy of the buffer itself? That's probably cleaner. I just had hoped that I could do it without actually copying the data. Seems like such a waste. Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.