public static string SerializeCSS()
        {
            string css = string.Empty;

            //Opening
            css += "." + ClassName + "{\n";

            //Properties
            css += "position: absolute;\n";
            css += "left: 0px;\n";
            css += "top: " + (StyleOptions.HeaderLength + 1) + "px;\n";
            css += "height: " + StyleOptions.ContentLength + "px;\n";
            css += "width: " + (MusicalStorage.CalculateSongDuration() + StyleOptions.TabInfoSize) + "px;\n";

            //Closing
            css += "}\n";

            //Generate the css that is needed for the tags inside the tabulator
            css += CSS_MusicalNote.SerializeCSS();
            css += CSS_MusicalStroke.SerializeCSS();
            css += CSS_AllStrings.SerializeCSS();
            css += CSS_RythmInfo.SerializeCSS();
            css += MusicalStorage.SerializeMelodieToCSS();

            return(css);
        }
        public static FrameOptions GetIntervallTime(int optionNumber)
        {
            double timeDuration = MusicalStorage.SongDurationInMS();

            double physDuration = MusicalStorage.CalculateSongDuration();

            double delta = physDuration / timeDuration;

            if (optionNumber == 0)
            {
                double interval = 1.0 / delta;
                var    options  = new FrameOptions();
                options.frameInterval  = interval;
                options.numberOfPixels = 1;
                return(options);
            }
            else if (optionNumber == 1)
            {
                var options = new FrameOptions();
                options.frameInterval  = 1;
                options.numberOfPixels = delta;
                return(options);
            }
            else
            {
                throw new Exception("invalid optionNumber");
            }
        }
        public static int GetAnimationStoppingPoint()
        {
            double length = MusicalStorage.CalculateSongDuration() + StyleOptions.TabInfoSize;

            length = length - StyleOptions.TabInfoSize;
            length = length - (StyleOptions.PreTabSize / 2);
            double correctedLength = Math.Ceiling(length);
            double negatedLength   = -correctedLength;

            return(Convert.ToInt32(negatedLength));
        }
        private static Song GetSongModel()
        {
            var song = new Song();

            song.SongTitle    = SongTitle;
            song.BPM          = BpmValue;
            song.SongDuration = MusicalStorage.SongDurationInMS();
            song.Notation     = new List <INote>();

            int    beatCounter   = -1; //2 strokes in the beginning, but we want to start with value 1
            double strokeCounter = 0;

            foreach (var musicalNote in MusicalStorage.Melodie)
            {
                if (musicalNote is MusicalNote_Stroke)
                {
                    beatCounter++; if (strokeCounter >= 4)
                    {
                        strokeCounter -= 4;
                    }
                }
                else if (musicalNote is MusicalNote_Chord)
                {
                    var chord         = musicalNote as MusicalNote_Chord;
                    var notationChord = new Chord();

                    notationChord.ID           = chord.NoteID;
                    notationChord.Duration     = chord.GetMusicalDuration();
                    notationChord.BeatNumber   = beatCounter;
                    notationChord.StrokeNumber = strokeCounter;
                    notationChord.Name         = chord.ChordName;
                    song.Notation.Add(new INote(notationChord));

                    strokeCounter += notationChord.Duration;
                }
                else
                {
                    var notationNote = new Note();
                    notationNote.ID           = musicalNote.NoteID;
                    notationNote.Name         = MusicalCalculator.GetNameFromPosition(ClassicalGuitar.ObjToEnum(musicalNote.StringOfNote), musicalNote.NoteValue);
                    notationNote.Duration     = musicalNote.GetMusicalDuration();
                    notationNote.BeatNumber   = beatCounter;
                    notationNote.StrokeNumber = strokeCounter;
                    song.Notation.Add(new INote(notationNote));

                    strokeCounter += notationNote.Duration;
                }
            }
            return(song);
        }
        public static string SerializeCSS()
        {
            string css = string.Empty;

            //Opening
            css += "." + ClassName + "{\n";

            //Properties
            css += "height: 0px;\n";
            css += "width: " + MusicalStorage.CalculateSongDuration() + "px;\n";
            css += "border: solid 1px lightgray;\n";
            css += "position: absolute;\n";
            css += "left: " + StyleOptions.TabInfoSize + "px;\n";
            css += "top: " + ClassicalGuitar.A.CalculateTop(6) + "px;\n";

            //Closing
            css += "}\n";

            return(css);
        }
Example #6
0
        public static string SerializeCSS()
        {
            string css = string.Empty;

            //Opening
            css += "." + ClassName + "{\n";

            //Properties
            css += "position: absolute;\n";
            css += "left: 0px;\n";
            css += "top: 0px;\n";
            css += "z-index: 0;\n";
            css += "width: " + (MusicalStorage.CalculateSongDuration() + StyleOptions.TabInfoSize) + "px;\n";
            css += "height: " + StyleOptions.ContentLength + "px;\n";

            //Closing
            css += "}\n";

            return(css);
        }
Example #7
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();
        }
Example #8
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                SongOptions.SongTitle = txtSongName.Text;
                SongOptions.SetBPM(Convert.ToInt32(txtBPM.Text));

                StyleOptions.SizeOfQuarter = Convert.ToInt32(txtDistanceBeat.Text);
                StyleOptions.HeaderLength  = Convert.ToInt32(txtHeaderLength.Text);
                StyleOptions.ContentLength = Convert.ToInt32(txtChordLength.Text);

                MusicalStorage.DumpStorage();

                btnNewChord.Enabled = true;
                btnGenerate.Enabled = true;
                btnNewNote.Enabled  = true;
            }
            catch
            {
                MessageBox.Show("Please enter valid numbers");
            }
        }
Example #9
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();
        }