GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

how can I insert empty sound during recording?

Open fengally opened this issue 14 years ago • 0 comments

Hi BradLarson,

I want to add a mute during the recording function. So I insert some code in the GPUImageWriter:

        if (!shouldRecordSound) {
            CFAllocatorRef allocator = CFAllocatorGetDefault();
            CMSampleBufferRef sbufCopyOut;
            CMSampleBufferCreateCopy(allocator,audioBuffer,&sbufCopyOut);

            CMSampleBufferSetDataBuffer (sbufCopyOut,NULL);
            NSLog(@"%@",sbufCopyOut);
            [assetWriterAudioInput appendSampleBuffer:sbufCopyOut];
            free(sbufCopyOut);

// CFRelease(sbufCopyOut); }else { [assetWriterAudioInput appendSampleBuffer:audioBuffer]; }

The setDataBuffer null doesn't work. I wonder if I should create a empty block buffer? But how should I do. I am not familiar with those framework. Could you help me, plz?

fengally avatar May 31 '12 03:05 fengally