Example #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());
        }
Example #2
0
 internal clsBatchParams(clsKeysAlg.eProfile profile, clsKeysAlg.eAlg alg, int changepenalty)
 {
     Total         = 0;
     Profile       = profile;
     Alg           = alg;
     ChangePenalty = changepenalty;
 }
Example #3
0
        private string Calculate(clsFileStream fs, int?inertia)
        {
            KeysList   = new List <clsKeysAlg>();
            KeysLabels = new List <string>();
            clsKeysAlg.eAlg alg = clsKeysAlg.eAlg.Weighted;
            if (optAlgFlat.Checked)
            {
                alg = clsKeysAlg.eAlg.Flat;
            }
            //clsFileStream csvfileconv;
            clsNoteMap notemap;

            if (chkChordFile.Checked)
            {
                if (P.F.CF?.Evs == null || P.F.CF.Evs.Count == 0)
                {
                    return("Empty ChordFile");
                }
                notemap = P.F.CF.NoteMap;
            }
            else
            {
                if (fs != null)
                {
                    notemap = fs.NoteMap;
                }
                else
                {
                    try {
                        notemap = (new clsFileStream(FileName, TrkSelect, true, false, true)).NoteMap;
                    }
                    catch (MidiFileException exc) {
                        return("MidiFileException: " + exc.Message);
                    }
                }
            }

            clsKeysAlg.eProfile profile = clsKeysAlg.eProfile.Default;
            if (optProfileJazz.Checked)
            {
                profile = clsKeysAlg.eProfile.Jazz;
            }
            else if (optProfileSpecial.Checked)
            {
                profile = clsKeysAlg.eProfile.Special;
            }
            Segments = new clsKeysAlg.clsSegments(notemap);
            if (Segments.indEmpty)
            {
                return("Empty Tracks");
            }
            CF = (chkLoadTxt.Checked && P.F.CF != null) ? CF = P.F.CF : null;
            KeysLabels.Add("Txt"); //leave in, even if text not present
            clsKeysAlg.Alg = alg;
            //clsKeysAlg.Trace = indTrace;
            clsKeysAlg.Segments = Segments;

            if (inertia.HasValue)
            {
                AddToKeysList(alg, profile, inertia.Value);
            }
            else
            {
                AddToKeysList(alg, profile, 0);
                AddToKeysList(alg, profile, 30);
                AddToKeysList(alg, profile, 50);
                AddToKeysList(alg, profile, 70);
                AddToKeysList(alg, profile, 90);
                AddToKeysList(alg, profile, 110);
            }

            CalcMinorScores();

            PopulatelvMod(true);
            //cmdDebugSegs.Enabled = true;
            return("");
        }