Simultaneous play and record queues

Discussion in 'iOS Programming' started by bitblit, Oct 5, 2008.

  1. bitblit macrumors newbie

    Joined:
    Oct 5, 2008
    #1
    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?
     
  2. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #2
    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.

    .
     
  3. bitblit thread starter macrumors newbie

    Joined:
    Oct 5, 2008
    #3
    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.
     

Share This Page