Esempio n. 1
0
        public void TestWriting()
        {
            AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
            FlakeWriter target;

            target = new FlakeWriter("flakewriter0.flac", null, new FlakeWriterSettings {
                PCM = buff.PCM, EncoderMode = "7"
            });
            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 FlakeWriter("flakewriter1.flac", null, new FlakeWriterSettings {
                PCM = buff.PCM, EncoderMode = "7"
            });
            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.");
        }
Esempio n. 2
0
        public void ConstructorTest()
        {
            AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
            ALACWriter  target;

            ALACWriter.Vendor = "CUETools";

            target = new ALACWriter("alacwriter1.m4a", null, new ALACWriterSettings()
            {
                PCM = buff.PCM
            });
            target.Settings.Padding = 1;
            target.CreationTime     = DateTime.Parse("15 Aug 1976");
            target.FinalSampleCount = buff.Length;
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("alac.m4a"), File.ReadAllBytes("alacwriter1.m4a"), "alacwriter1.m4a doesn't match.");

            target = new ALACWriter("alacwriter0.m4a", null, new ALACWriterSettings()
            {
                PCM = buff.PCM
            });
            target.Settings.Padding = 1;
            target.CreationTime     = DateTime.Parse("15 Aug 1976");
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("alac.m4a"), File.ReadAllBytes("alacwriter0.m4a"), "alacwriter0.m4a doesn't match.");
        }
Esempio n. 3
0
        public void ConstructorTest()
        {
            AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
            WAVWriter   target;

            target = new WAVWriter("wavwriter0.wav", null, new WAVWriterSettings(buff.PCM));
            //target.FinalSampleCount = buff.Length;
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("test.wav"), File.ReadAllBytes("wavwriter0.wav"), "wavwriter0.wav doesn't match.");

            target = new WAVWriter("wavwriter1.wav", null, new WAVWriterSettings(buff.PCM));
            target.FinalSampleCount = buff.Length;
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("test.wav"), File.ReadAllBytes("wavwriter1.wav"), "wavwriter1.wav doesn't match.");
        }
Esempio n. 4
0
        public void ConstructorTest()
        {
            AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
            FLACWriter  target;

            target = new FLACWriter("flacwriter2.flac", new FLACWriterSettings()
            {
                PCM = buff.PCM, EncoderMode = "7"
            });
            target.Settings.Padding   = 1;
            target.Settings.BlockSize = 32;
            //target.Vendor = "CUETools";
            //target.CreationTime = DateTime.Parse("15 Aug 1976");
            target.FinalSampleCount = buff.Length;
            target.Write(buff);
            target.Close();
            CollectionAssert.AreEqual(File.ReadAllBytes("flacwriter1.flac"), File.ReadAllBytes("flacwriter2.flac"), "flacwriter2.flac doesn't match.");
        }
Esempio n. 5
0
        public async Task TestWriting()
        {
            var wavStream =
                await
                    (await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///test.wav")))
                .OpenStreamForReadAsync();

            var expectedBytes =
                ReadFully(await
                              (await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///flake.flac")))
                          .OpenStreamForReadAsync());


            var         buff = WAVReader.ReadAllSamples(wavStream);
            FlakeWriter target;

            var outputStream = new MemoryStream();

            target = new FlakeWriter(outputStream, new FlakeWriterSettings {
                PCM = buff.PCM, EncoderMode = "7"
            });
            target.Settings.Padding = 1;
            target.DoSeekTable      = false;
            target.Write(buff);
            target.Close();

            outputStream.Seek(0, SeekOrigin.Begin);

            var resultContent = outputStream.ToArray();
            var outStream     = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync("out.flac",
                                                                                                  CreationCollisionOption.ReplaceExisting);

            outStream.Write(resultContent, 0, resultContent.Length);
            outStream.Dispose();
            Debug.WriteLine(ApplicationData.Current.LocalFolder.Path);


            CollectionAssert.AreEqual(expectedBytes, outputStream.ToArray(), "result and expected doesn't match.");
        }
Esempio n. 6
0
        public void ReadAllSamplesTest()
        {
            AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);

            CollectionAssert.AreEqual(testSamples, buff.Samples, "AudioBuffer.Samples was not set correctly.");
        }