Esempio n. 1
0
        private void AddToKeysList(clsKeysAlg.eAlg alg, clsKeysAlg.eProfile profile, int penalty)
        {
            clsKeysAlg keysalg = new clsKeysAlg(profile, alg, penalty);

            KeysList.Add(keysalg);
            KeysLabels.Add(penalty.ToString());
        }
Esempio n. 2
0
        private void CalcMinorScores()
        {
            //* calculate minor key scores for different minor key types
            //* use currently selected inertia(penalty), alg, profile

            //* calculate totals of each pitchclass for segements(bars) in a minor key
            int[] pctots = new int[12]; //pitchclass totals
            for (int i = 0; i < 12; i++)
            {
                pctots[i] = 0;
            }
            int index = (KeysList.Count > 1) ? GetInertia() : 0;

            if (KeysList.Count == 0)
            {
                LogicError.Throw(eStopError.Y003); //unable to reproduce this, but it did happen!
                return;
            }
            clsKeysAlg keysalg = KeysList[index];

            clsKeysAlg.clsSegments segs = clsKeysAlg.Segments;
            for (int segnum = 0; segnum < keysalg.Keys.Count; segnum++)
            {
                clsKeyTicks key = keysalg.Keys[segnum];
                if (key != null && key.Scale == "minor")
                {
                    if (segnum != key.BBT.Bar)
                    {
                        LogicError.Throw(eLogicError.X094);
                        break;
                    }
                    for (int pc = 0; pc < 12; pc++)
                    {
                        pctots[pc] += segs.Segs[segnum][pc];
                    }
                }
            }

            //* calculate totals of l/l- t/t- combinations
            int totharmonic = pctots[8] + pctots[11]; //l- t
            int totmelup    = pctots[9] + pctots[11]; //l t
            int totmeldown  = pctots[8] + pctots[10]; //l- t-
            int totspecial  = pctots[9] + pctots[10]; //l t-

            lblTotHarmonic.Text = totharmonic.ToString();
            lblTotMelUp.Text    = totmelup.ToString();
            lblTotMelDown.Text  = totmeldown.ToString();
            lblTotSpecial.Text  = totspecial.ToString();

            eMinorKeyType maxtottype = eMinorKeyType.Harmonic;
            int           maxtot     = totharmonic;

            if (totmelup > maxtot)
            {
                maxtottype = eMinorKeyType.MelodicUp;
                maxtot     = totmelup;
            }

            if (totmeldown > maxtot)
            {
                maxtottype = eMinorKeyType.MelodicDown;
                maxtot     = totmeldown;
            }

            if (totspecial > maxtot)
            {
                maxtottype = eMinorKeyType.Special;
                maxtot     = totspecial;
            }

            FontStyle fontstyle;

            fontstyle           = (maxtottype == eMinorKeyType.Harmonic) ? FontStyle.Bold : FontStyle.Regular;
            lblTotHarmonic.Font = new Font(lblTotHarmonic.Font, fontstyle);

            fontstyle        = (maxtottype == eMinorKeyType.MelodicUp) ? FontStyle.Bold : FontStyle.Regular;
            lblTotMelUp.Font = new Font(lblTotMelUp.Font, fontstyle);

            fontstyle          = (maxtottype == eMinorKeyType.MelodicDown) ? FontStyle.Bold : FontStyle.Regular;
            lblTotMelDown.Font = new Font(lblTotMelDown.Font, fontstyle);

            fontstyle          = (maxtottype == eMinorKeyType.Special) ? FontStyle.Bold : FontStyle.Regular;
            lblTotSpecial.Font = new Font(lblTotSpecial.Font, fontstyle);

            if (chkUseHighestMinorKeyType.Checked)
            {
                P.frmStart.MinorKeyType = maxtottype;
            }
        }