Captura.RecorderParams.CreateAudioStream C# (CSharp) Method

CreateAudioStream() public method

public CreateAudioStream ( AviWriter writer ) : IAviAudioStream
writer AviWriter
return IAviAudioStream
        public IAviAudioStream CreateAudioStream(AviWriter writer)
        {
            return writer.AddAudioStream(WaveFormat.Channels, WaveFormat.SampleRate, WaveFormat.BitsPerSample);
        }
        public WaveFormat WaveFormat { get; private set; }

Usage Example

 public Recorder(RecorderParams Params)
 {
     this.Params = Params;
     // Create AVI writer and specify FPS
     writer = Params.CreateAviWriter();
     // Create video stream
     videoStream = Params.CreateVideoStream(writer);
     // Set only name. Other properties were when creating stream, 
     // either explicitly by arguments or implicitly by the encoder used
     videoStream.Name = "Captura";
     if (Params.AudioSourceId != -1)
     {
         try
         {
             var waveFormat = Params.WaveFormat;
             audioStream = Params.CreateAudioStream(writer);
             audioStream.Name = "Voice";
             audioSource = new WaveInEvent
             {
                 DeviceNumber = Params.AudioSourceId,
                 WaveFormat = waveFormat,
                 // Buffer size to store duration of 1 frame
                 BufferMilliseconds = (int)Math.Ceiling(1000 / writer.FramesPerSecond),
                 NumberOfBuffers = 3,
             };
             audioSource.DataAvailable += AudioDataAvailable;
         }
         catch { }
     }
     screenThread = new Thread(RecordScreen)
     {
         Name = typeof(Recorder).Name + ".RecordScreen",
         IsBackground = true
     };
     if (audioSource != null)
     {
         videoFrameWritten.Set();
         audioBlockWritten.Reset();
         audioSource.StartRecording();
     }
     screenThread.Start();
 }
All Usage Examples Of Captura.RecorderParams::CreateAudioStream