Пример #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     Recorder.Stop();
     NCorder.MP3Writer writer = new NCorder.MP3Writer();
     writer.WriteOutBuffer(Recorder.Buffer, textBox1.Text);
     // save out file
 }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     Recorder.Stop();
     NCorder.MP3Writer writer = new NCorder.MP3Writer();
     writer.WriteOutBuffer(Recorder.Buffer, textBox1.Text);
     // save out file
 }
Пример #3
0
        public void SaveTrack(long trackNumber, string title)
        {
            string          path        = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), title + ".mp3");
            RecordingBuffer trackBuffer = this.PopTrack(trackNumber);
            MP3Writer       writer      = new MP3Writer();

            writer.WriteOutBuffer(trackBuffer, path);
        }
Пример #4
0
        public void GetAlternatePathTest()
        {
            MP3Writer writer = new MP3Writer();
            PrivateObject privateObject = new PrivateObject(writer);

            string outFile = Path.GetTempFileName() + ".mp3";
            File.Delete(outFile); // this method creates the file, but that won't happen in real life.

            string alternateFile = (string)privateObject.Invoke("GetAlternatePath", null, new object[] { outFile });
            Assert.AreEqual(true, alternateFile == outFile);

            System.IO.File.WriteAllText(outFile, "GetAlternatePathTest()");
            Assert.AreEqual(true, outFile.Length > 2);

            alternateFile = (string)privateObject.Invoke("GetAlternatePath", null, new object[] { outFile });
            Assert.AreNotEqual(true, string.IsNullOrWhiteSpace(alternateFile));
            Assert.AreEqual(true, alternateFile.Length == outFile.Length + 2);
            Assert.AreNotEqual(alternateFile, outFile);

            File.Delete(outFile);
        }
Пример #5
0
 public void SaveTrack(long trackNumber, string title)
 {
     string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), title + ".mp3");
     RecordingBuffer trackBuffer = this.PopTrack(trackNumber);
     MP3Writer writer = new MP3Writer();
     writer.WriteOutBuffer(trackBuffer, path);
 }
Пример #6
0
        public void TestMP3Writer()
        {
            // private MemoryStream ConvertToWave(IList<Sample> samples, WaveFormat waveFormat)
            // private void WriteMP3(MemoryStream waveMemoryStream, string outputFile)
            MP3Writer writer = new MP3Writer();
            PrivateObject privateObject = new PrivateObject(writer);
            string outFile = Path.GetTempFileName();
            File.Delete(outFile); // this method creates the file, but that won't happen in real life.
            object result = privateObject.Invoke("ConvertToWave", null, new object[] { Samples, WaveFormat} );

            Assert.AreEqual(result.GetType(), typeof(byte[]));

            privateObject.Invoke("WriteMP3", null, new object[] { result, outFile });

            Assert.AreEqual(File.Exists(outFile), true);
            Assert.AreEqual(new FileInfo(outFile).Length > 0, true);

            // Clean up temp file.
            if (File.Exists(outFile))
            {
                File.Delete(outFile);
            }
        }