Пример #1
0
        private void btnNewNote_Click(object sender, EventArgs e)
        {
            GuitarStringType stringType = GetSelectedString();
            NoteTypes        noteType   = GetCheckedType();
            int track = GetStringValue(stringType);

            if (noteType == NoteTypes.Whole)
            {
                stroke += 4;
                MusicalStorage.AddNote(new MusicalNote_Whole(stringType, track, IdCounter.ToString()));
            }
            else if (noteType == NoteTypes.Half)
            {
                stroke += 2;
                MusicalStorage.AddNote(new MusicalNote_Half(stringType, track, IdCounter.ToString()));
            }
            else if (noteType == NoteTypes.PunctedQuarter)
            {
                stroke += 1.5;
                MusicalStorage.AddNote(new MusicalNote_PunctedQuarter(stringType, track, IdCounter.ToString()));
            }
            else if (noteType == NoteTypes.Quarter)
            {
                stroke++;
                MusicalStorage.AddNote(new MusicalNote_Quarter(stringType, track, IdCounter.ToString()));
            }
            else if (noteType == NoteTypes.Eighth)
            {
                stroke += 0.5;
                MusicalStorage.AddNote(new MusicalNote_Eighth(stringType, track, IdCounter.ToString()));
            }

            if (stroke >= 4)
            {
                stroke = stroke - 4;
                MusicalStorage.AddNote(new MusicalNote_Stroke(IdCounter.ToString(), stroke));
            }

            IdCounter++;
            txtChordCounter.Text = IdCounter.ToString();
        }
Пример #2
0
        private void btnNewChord_Click(object sender, EventArgs e)
        {
            NoteTypes noteType = GetCheckedType();

            if (noteType == NoteTypes.Whole)
            {
                stroke += 4;
            }
            else if (noteType == NoteTypes.Half)
            {
                stroke += 2;
            }
            else if (noteType == NoteTypes.PunctedQuarter)
            {
                stroke += 1.5;
            }
            else if (noteType == NoteTypes.Quarter)
            {
                stroke += 1;
            }
            else if (noteType == NoteTypes.Eighth)
            {
                stroke += 0.5;
            }

            string ChordName = txtNewChordName.Text;
            var    ListTupel = new List <Tuple <GuitarStringType, int> >();

            if (cckHighE.Checked)
            {
                ListTupel.Add(new Tuple <GuitarStringType, int>(GuitarStringType.e, Convert.ToInt32(numValueHighE.Value)));
            }
            if (cckB.Checked)
            {
                ListTupel.Add(new Tuple <GuitarStringType, int>(GuitarStringType.B, Convert.ToInt32(numValueB.Value)));
            }
            if (cckG.Checked)
            {
                ListTupel.Add(new Tuple <GuitarStringType, int>(GuitarStringType.G, Convert.ToInt32(numValueG.Value)));
            }
            if (cckD.Checked)
            {
                ListTupel.Add(new Tuple <GuitarStringType, int>(GuitarStringType.D, Convert.ToInt32(numValueD.Value)));
            }
            if (cckA.Checked)
            {
                ListTupel.Add(new Tuple <GuitarStringType, int>(GuitarStringType.A, Convert.ToInt32(numValueA.Value)));
            }
            if (cckE.Checked)
            {
                ListTupel.Add(new Tuple <GuitarStringType, int>(GuitarStringType.E, Convert.ToInt32(numValueE.Value)));
            }
            if (ChordName == "")
            {
                ChordName = "NoName";
            }

            MusicalStorage.AddNote(new MusicalNote_Chord(ListTupel.ToArray(), IdCounter.ToString(), noteType, ChordName));


            if (stroke >= 4)
            {
                stroke = stroke - 4;
                MusicalStorage.AddNote(new MusicalNote_Stroke(IdCounter.ToString(), stroke));
            }

            IdCounter++;
            txtChordCounter.Text = IdCounter.ToString();
        }