コード例 #1
0
 public void inputMainMelodyChange(int x, string insertStr)//旋律轨道音符改变,x为音符序号,inserStr为要修改的字符串
 {
     if (inputMainMelody == null)
     {
         inputMainMelody = textBlock_main.Text;
     }
     inputMainMelody     = inputMainMelody.Remove(x * LengthOfeachNote, LengthOfeachNote).Insert(x * LengthOfeachNote, insertStr);
     textBlock_main.Text = NoteInput.devideBar(inputMainMelody);
     clearAll();
     setMelody(textBlock_main.Text);
 }
コード例 #2
0
        public void smartChord()
        {
            string myStr = inputMainMelody = textBlock_main.Text.Replace(",", "");

            textBlock_main.Text = NoteInput.devideBar(myStr);
            myAlgorithm.init();//初始化后重新算一遍
            string str = myAlgorithm.multiChordGenertor(textBlock_main.Text);

            if (str.Last() != ' ')
            {
                str += " ";
            }
            textBlock_main2.Text = inputMainChord = str;
        }
コード例 #3
0
        public void pianoKeyDown(int xKey)
        {
            string send = NoteInput.input(xKey);

            if (editSingleNote)
            {
                inputMainMelodyChange(singleNoteId, send);
                editSingleNote = false;
            }
            else
            {
                this.textBlock_main.Text += send;
                addMelody(send.Trim());//加一个音
            }
            keyDown(send);
        }
コード例 #4
0
        //public void change


        public void mainPlay()
        {
            string[] track  = new string[instrumentN];
            string   score0 = textBlock_main.Text.Replace(" ", "").Replace(",", "");// 去掉曲谱里的逗号和空格

            try
            {
                NoteInput.inputCheck(score0);
                winInputCheck();
                track[0] = textBlock_main.Text.Replace(" ", "");
                if (muteMainScore)
                {
                    track[0] = NoteInput.muteNote(track[0]);
                }

                string resultChordSeq = textBlock_main2.Text.Trim();
                // MessageBox.Show(textBlock_main2.Text);
                track[1] = chordTrack[0].splitedChordNote(resultChordSeq);
                track[2] = chordTrack[1].splitedChordNote(resultChordSeq);
                track[3] = chordTrack[2].splitedChordNote(resultChordSeq);

                /*
                 * for (int i = 0; i < instrumentN; i++)
                 * {
                 *  if (track[i].Last() == ',')
                 *      track[i] = track[i].Substring(0, track[i].Length - 1);
                 *
                 *  chordTrack[i].adjustForOctave(track[i], track[0]);//调整八度关系
                 *  //MessageBox.Show(track[i]);
                 * }
                 */
                /*
                 * foreach(string x in track)
                 * {
                 *  MessageBox.Show(x);
                 * }
                 */
                // if( ! ( textBlock_main.Text==null && textBlock_main2.Text== null) )
                MidiPlay.BrandNew(myMidiDevice, track[0], timbreTrack[0], track[1], timbreTrack[1], track[2], timbreTrack[2], track[3], timbreTrack[3]);
            }
            catch (UserInputException e)
            {
                MessageBox.Show("请输入音符");
                initAllInputWin();
            }
        }
コード例 #5
0
 private void appBarButton_Accept_Click(object sender, RoutedEventArgs e)
 {
     textBlock_main.Text = NoteInput.devideBar(textBlock_main.Text);
     //textBox_inputNote.Text = "";//是否清空输入栏
     textBlock_main2.Text = myAlgorithm.multiChordGenertor(textBlock_main.Text);
 }
コード例 #6
0
        public void pianoKeyUp(int xKey)
        {
            string send = NoteInput.input(xKey);

            send.Substring(0, send.Length - 1);
        }