In its simplest form, we can add audio preview with three lines of program code.
In the file named
BTSAppDelegate.m
, create the audio preview output object by adding the following program code in the method namedapplicationDidFinishLaunching:
. Add it to the capture session, just prior to the line that starts the capture session:// Allocate and initialize and audio preview object QTCaptureAudioPreviewOutput* l_audioPreviewOutput = [[QTCaptureAudioPreviewOutput alloc] init]; // Set the preview volume [l_audioPreviewOutput setVolume:0.5]; // Add the preview to our capture session [m_CaptureSession addOutput:audioPreviewOutput error:nil];
Run the iSight Recorder App and say something to hear the audio preview (make sure you are wearing headphones to avoid audio feedback).
Obviously, we would like our App user to be able to control the volume of the audio preview rather than having it permanently set to
0.5
by...