示例#1
0
        private void btnShowContentClick(object sender, RoutedEventArgs e)
        {
            string filename  = txt_SongFilePath.Text;
            string extension = System.IO.Path.GetExtension(filename);

            switch (extension)
            {
            case ".mid":
                showMidiTracks(MidiReader.ReadMidi(filename));
                D_Staff midi_staff         = MidiParser.getInstance().parseFile(filename);
                string  converted_lilypond = LilypondComposer.getInstance().composeLilypondFromStaff(midi_staff);
                this.editor.setText(converted_lilypond);
                this.editor.enable();
                break;

            case ".ly":
                this.editor.enable();
                this.editor.setFileName(filename);
                this.editor.readFile();
                //this.songData = LilypondParser.getInstance().parseFile(filename);
                break;

            default:
                Console.WriteLine("I can't parse " + extension);
                break;
            }

            this.updateNoteViewer();
        }
示例#2
0
        public static MidiParser getInstance()
        {
            if (instance == null)
            {
                instance = new MidiParser();
            }

            return(instance);
        }