Example #1
0
        private void TokenGroupSelected(object sender, EventArgs e)
        {
            _selectedNoteGroup = _noteGroups[_colorRects.IndexOf((Rectangle)sender)];

            LeftBoundUD.Value = _selectedNoteGroup.LeftBound;
            RightBoundUD.Value = _selectedNoteGroup.RightBound;
            HorizShiftUD.Value = _selectedNoteGroup.HorizOffset;
            VertShiftUD.Value = _selectedNoteGroup.VertOffset;
            RepDelayUD.Value = Convert.ToDecimal(_selectedNoteGroup.RepetitionInterval);
            NoteDurationUD.Value = Convert.ToDecimal(_selectedNoteGroup.NoteDuration);
        }
Example #2
0
        private void WindowLoaded(object sender, EventArgs e)
        {
            // Automatically make a basic song out of the CA generated. Don't load the window if you haven't made one yet, stupid.

            double songDuration = double.Parse(SongLengthTB.Text)/double.Parse(BeatDurationTB.Text);
            _currentScale = Scales.CMajor;

            _noteGroups = new List<NoteGroup>(TokenGroupFactory.TokenGroupsFromCA(_ca).Select(x => new NoteGroup(x, _currentScale, songDuration)));
            _selectedNoteGroup = _noteGroups[0];
            _groupsToDraw = new bool[_ca.PopulationSize];

            UpdateNoteDurationAndRepDelayMins();

            //_currentSong = SongFactory.SongFromTokenGroupList();
        }
Example #3
0
        private void DrawNoteGroup(NoteGroup ng)
        {
            foreach (Chord chord in ng.Chords)
            {
                foreach (Note note in chord.Notes)
                {
                    // Draw a rectangle, starting at the beginning of a note, over to the end, and then down for the height of row.
                    for (int x = (int)(chord.StartBeat * _beatWidth); x < (note.StartBeat + note.Duration) * _beatWidth; x++)
                    {
                        int rowStart = Array.IndexOf(_currentScale, note.Pitch)*ROW_HEIGHT; // Having to find the IndexOf for every note... ewwwwwwwwww
                        for (int y = rowStart; y < rowStart + ROW_HEIGHT; y++)
                        {
                            if (x >= _imageWidth)
                                continue;

                            SetPixel(x, y, ng.Color);
                        }
                    }
                }
            }
        }