Esempio n. 1
0
        private void btn_ShowContent_Click(object sender, RoutedEventArgs e)
        {
            string extension = txt_MidiFilePath.Text.Split('.').Last();

            if (extension == "mid")
            {
                ShowMidiTracks(MidiReader.ReadMidi(txt_MidiFilePath.Text));
                MidiToObject midiToObject = new MidiToObject(txt_MidiFilePath.Text);
                IWrapper     wrapper      = new Wrapper();
                wrapper.draw(scrollViewer, midiToObject.getTrackObject());
                textBox.Visibility             = Visibility.Hidden;
                tabCtrl_MidiContent.Visibility = Visibility.Visible;
            }
            else if (extension == "ly")
            {
                initialLilypond                = File.ReadAllText(txt_MidiFilePath.Text);
                textBox.Visibility             = Visibility.Visible;
                tabCtrl_MidiContent.Visibility = Visibility.Hidden;
                LyToObject lyToObject = new LyToObject(initialLilypond);
                initialLilypond = new ObjectToLy().convert(lyToObject.getTrackObject());
                textBox.Text    = initialLilypond;
                IWrapper wrapper = new Wrapper();
                wrapper.draw(scrollViewer, lyToObject.getTrackObject());
            }
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        private void btn_ShowContent_Click(object sender, RoutedEventArgs e) //Shows the content of a midi file in the tracks section of the MainWindow, also shows the sheetvisualisation
        {
            string extension = txt_MidiFilePath.Text.Split('.').Last();

            if (extension == "mid")
            {
                showMidiTracks(MidiReader.ReadMidi(txt_MidiFilePath.Text));
                //MidiConverter midiConverter = new MidiConverter();
                //MyMusicSheet mss = midiConverter.convertMidi(txt_MidiFilePath.Text);
                //ShowTrack(mss.Tracks[1], mss.TimeSignature[0], mss.TimeSignature[1]);
                MidiADPConverter midiConverter = new MidiADPConverter();
                ADPSheet         sheet         = midiConverter.ReadFile(txt_MidiFilePath.Text);
                showSheetVisualisation(sheet.Tracks[1]);
            }
        }