Example #1
0
        public void ConstructorTest()
        {
            AudioBuffer  buff = Codecs.WAV.AudioDecoder.ReadAllSamples(new Codecs.WAV.DecoderSettings(), "test.wav");
            AudioEncoder target;

            target = new AudioEncoder(new EncoderSettings()
            {
                PCM = buff.PCM, EncoderMode = "7"
            }, "flakewriter0.flac");
            target.Settings.Padding = 1;
            target.DoSeekTable      = false;
            //target.Vendor = "CUETools";
            //target.CreationTime = DateTime.Parse("15 Aug 1976");
            target.FinalSampleCount = buff.Length;
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("flake.flac"), File.ReadAllBytes("flakewriter0.flac"), "flakewriter0.flac doesn't match.");

            target = new AudioEncoder(new EncoderSettings()
            {
                PCM = buff.PCM, EncoderMode = "7"
            }, "flakewriter1.flac");
            target.Settings.Padding = 1;
            target.DoSeekTable      = false;
            //target.Vendor = "CUETools";
            //target.CreationTime = DateTime.Parse("15 Aug 1976");
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("flake.flac"), File.ReadAllBytes("flakewriter1.flac"), "flakewriter1.flac doesn't match.");
        }
Example #2
0
 /// <summary>
 /// 关闭
 /// </summary>
 public void Close()
 {
     if (frameTransmit != null)
     {
         frameTransmit.Dispose();
         frameTransmit = null;
     }
     if (VC != null)
     {
         VC.Close();
         VC = null;
     }
     if (VE != null)
     {
         VE.Close();
         VE = null;
     }
     if (VD != null)
     {
         VD.Close();
         VD = null;
     }
     if (VR != null)
     {
         VR = null;
     }
     if (AC != null)
     {
         AC.Close();
         AC = null;
     }
     if (AE != null)
     {
         AE.Close(); AE = null;
     }
     if (AR != null)
     {
         AR.Close(); AE = null;
     }
     if (cam != null)
     {
         cam.Stop(); cam.Dispose();
         cam = null;
         timer1.Stop();
     }
     //cLocal.Dispose(); cLocal = null;
     //cRemote.Dispose(); cRemote = null;
     //trackBarIn.Dispose(); trackBarIn = null;
     //trackBarOut.Dispose(); trackBarOut = null;
 }
Example #3
0
        public void Close()
        {
            logger.Debug("AudioStreamer::Close()");
            closing = true;

            if (RtpSender != null)
            {
                RtpSender.Close();
                RtpSender = null;
            }

            if (audioSource != null)
            {
                audioSource.DataAvailable -= AudioSource_DataAvailable;
            }

            if (audioResampler != null)
            {
                audioResampler.Close();
                audioResampler = null;
            }
        }