示例#1
0
            internal clsWeightedScores(clsChordSegs segs, clsCompScores min)
            {
                Segs = segs;
                Forms.frmCfgChords frm = P.frmCfgChords;

                int avgweight  = ((int)frm.trkSegmentHalfBar.Value + frm.trkSegmentBeat.Value) / 2;
                int hbweight   = (int)frm.trkSegmentHalfBar.Value;
                int beatweight = (int)frm.trkSegmentBeat.Value;

                if (frm.MaxHBWeight)
                {
                    hbweight = int.MaxValue;
                }
                if (frm.MinHBWeight)
                {
                    hbweight = int.MinValue;
                }
                if (frm.MaxBeatWeight)
                {
                    beatweight = int.MaxValue;
                }
                if (frm.MinBeatWeight)
                {
                    beatweight = int.MinValue;
                }

                //* don't select HB_Beats or Beats_HB if either is minimum
                if (frm.MinBeatWeight || frm.MinHBWeight)
                {
                    avgweight = int.MinValue;
                }

                //* don't select HB_Beats or Beats_HB if either is maximum
                if (frm.MaxBeatWeight || frm.MaxHBWeight)
                {
                    avgweight = int.MinValue;
                }

                Combos[0] = new clsCombo(eCombo.Bar, SelectAuto_Bar);
                Combos[1] = new clsCombo(eCombo.HB_HB, SelectAuto_HB_HB);
                Combos[2] = new clsCombo(eCombo.HB_Beats, SelectAuto_HB_Beats);
                Combos[3] = new clsCombo(eCombo.Beats_HB, SelectAuto_Beats_HB);
                Combos[4] = new clsCombo(eCombo.Beats_Beats, SelectAuto_Beats_Beats);

                Combos[0].WeightedScore = min.Bar;
                Update(1, hbweight, min.HB1, min.HB2);
                Update(2, avgweight, min.HB1, min.Beats2);
                Update(3, avgweight, min.Beats1, min.HB2);
                Update(4, beatweight, min.Beats1, min.Beats2);
                SetMaxIndex();
            }
示例#2
0
        private void SelectAlign()
        {
            //* create listci from ListCIArr[0/1]
            ListCI = new List <clsChordInfo>(250); //final chord list
            if (Align == eAlign.Auto)
            {
                //* create listci... from listciarr[0/1/2]
                ListCIBar     = ListCIArr[0];
                ListCIHalfBar = ListCIArr[1];
                ListCIBeat    = ListCIArr[2];
                Bars          = new List <clsBarSubHB>(250);

                //* get bar/halfbar/beat structure
                GetStructure();

                //* calculate minimum unweighted scores
                MinScores = new List <clsCompScores>(250);
                for (int b = 0; b < Bars.Count; b++)
                {
                    clsBarSubHB   bar = Bars[b];
                    clsCompScores min = new clsCompScores(bar);
                    MinScores.Add(min);
                    if (MinScores.Count != b + 1)
                    {
                        LogicError.Throw(eLogicError.X086);
                    }
                }

                //* calculate weighted bar score combinations
                CalcWeightedScores();

                int hbindex = 0, beatindex = 0;
                for (int bar = 0; bar < Bars.Count; bar++)
                {
                    clsWeightedScores w     = WeightedScores[bar];
                    clsChordInfo[]    cibar = w.MaxCombo.SelectAuto(bar);
                    if (DebugChords)
                    {
                        DebugBarScores(ref hbindex, ref beatindex, bar);
                        DebugComboScore(bar, cibar);
                    }
                    ListCI.AddRange(cibar);
                }
            }
            else
            {
                ListCI = ListCIArr[0];
            }
        }