Does any one know how to modify the Speak Here Sample Code to record streaming audio?
Does anyone know how to modify the code Speak Here from Apple. I need to modify it to record streaming audio using Matt Gallagher AudioStreamer开发者_运维知识库 classes but somehow I can't find how to select the recording source...
Could you help?
I haven't done this but I have used Matt's AudioStreamer class quite a bit and that's really project you want to extend - not SpeakHere. (The streaming audio part is the most complex part of this).
What you would do is first setup your file for writing and then in AudioStreamer.m there are two places where the network data buffer is copied to the audio queue buffer - both are noted with this // copy data to the audio queue buffer. After those lines add the logic to write to the file (using AudioFileWritePackets). I would guess that the file write is fast enough to do this right here, immediately. If not (if the audio playback skips or breaks up) then you'd want to set up a circular buffer for file writing, copy the bytes and call the AudioFileWritePackets from a background thread.
精彩评论