Ejemplo n.º 1
0
        public void TestConvertMidi()
        {
            // File to test against (result file)
            string baselineFilePath = @"Tests\Passacaglia, Handel_Sample_Cubase_Format0.mid";
            var    baselineFileInfo = new FileInfo(baselineFilePath);
            var    sequenceBaseline = new MidiFileReader().GetSequence(baselineFileInfo);

            // Dump Baseline Midi
            string baselineTextPath = baselineFileInfo.Name + "_dump.txt";

            sequenceBaseline.DumpMidi(baselineTextPath);

            // File to test with
            string fileName = @"Tests\Passacaglia, Handel_Sample.mid";
            var    fileInfo = new FileInfo(fileName);
            var    sequence = new MidiFileReader().GetSequence(fileInfo);

            // Convert Midi to Format 0
            var convertedSequence = sequence.Convert((int)MidiHelper.MidiFormat.SingleTrack, SequenceExtensions.FormatConversionOption.NoteOffZero2NoteOnZero, 480, "SongNameForType0");

            // Dump Converted Midi
            string convertedOutputTextPath = fileInfo.Name + "_converted_dump.txt";

            convertedSequence.DumpMidi(convertedOutputTextPath);

            if (FileCompare(baselineTextPath, convertedOutputTextPath))
            {
                Assert.Pass("The midi files are identical.");
            }
            else
            {
                Assert.Fail("The midi files are different!");
            }
        }