示例#1
0
        public string GetLilypond(ADPSheet _musicSheet) //Converts the ADPSheet to a string so it can be put as lilypond text in the editor (See function: convertMusicalSymbols)
        {
            string result = "";

            result += "\\relative c' { \n";
            result += "\\clef treble \n";
            result += "\\time ";
            result += _musicSheet.getTrack().Bars[1].TimeSignature[0];
            result += "/";
            result += _musicSheet.getTrack().Bars[1].TimeSignature[1];
            result += " \n";
            result += "\\tempo 4=120 \n";

            // add notes
            result += convertMusicalSymbols(_musicSheet.getTrack().Bars);

            result += "}";

            return(result);
        }
示例#2
0
 public string UpdateBarlinesFromLilypond() //Channelcommand to update the barlines from the text in the editor (see class LilyADPConverter
 {
     return(this.lilypondText.Dispatcher.Invoke(
                () =>
     {
         ADPSheet sheet = lilyADPConverter.ConvertText(lilypondText.Text);
         if (sheet != null)
         {
             showSheetVisualisation(sheet.getTrack());
         }
         return this.lilypondText.Text;
     }
                ));
 }
示例#3
0
        public void OpenFile() //Opens a filedialog where you can select a file to open, accepts: midi and lilypond files
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Filter = "Midi Files(.mid)|*.mid|Lily files (*.ly*)|*.ly*"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                txt_MidiFilePath.Text = openFileDialog.FileName;
                ADPSheet sheet = firstFileConverter.Handle(openFileDialog.FileName);
                if (sheet != null)
                {
                    showSheetVisualisation(sheet.getTrack());
                    NoteToLilypondConverter ntlc = new NoteToLilypondConverter();
                    lilypondText.Text = ntlc.GetLilypond(sheet);
                    SetNewState();
                }
            }
        }