public void RenderToWavDest( string outputFile, IBaseFilter audioCompressor, AMMediaType mediaType, IDESCombineCB audioCallback) { if (audioCompressor != null) { _dc.Add(audioCompressor); } int hr; if (_firstAudioGroup == null) { throw new SplicerException("No audio stream to render"); } if (outputFile == null) { throw new SplicerException("Output file name cannot be null"); } // Contains useful routines for creating the graph ICaptureGraphBuilder2 icgb = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); _dc.Add(icgb); try { hr = icgb.SetFiltergraph(_graph); DESError.ThrowExceptionForHR(hr); IBaseFilter wavDestFilter = StandardFilters.RenderWavDest(_dc, _graph); IBaseFilter fileSink = StandardFilters.RenderFileDestination(_dc, _graph, outputFile); try { RenderGroups(icgb, audioCompressor, null, wavDestFilter, audioCallback, null); FilterGraphTools.ConnectFilters(_graph, wavDestFilter, fileSink, true); // if supplied, apply the media type to the filter if (mediaType != null) { FilterGraphTools.SetFilterFormat(mediaType, audioCompressor); } } finally { Marshal.ReleaseComObject(wavDestFilter); Marshal.ReleaseComObject(fileSink); } } finally { Marshal.ReleaseComObject(icgb); } }