Esempio n. 1
0
 internal static string PtrToDesc(sbyte ptr)
 {
     if (ptr == 0)
     {
         return("");
     }
     if (ptr > 0)
     {
         return(ChordAnalysis.PtrToDesc(ptr));
     }
     return(ChordDB.PtrToDesc(ptr));
 }
Esempio n. 2
0
        internal static string ShowChordText(int[] chord, clsKeyTicks key)
        {
            //* form thread
            //* show current playchord (root and qualifier)
            if (chord == null || chord.Length < 3)
            {
                //P.frmSC.txtChordBottom.Text = "";
                return("");
            }
            bool[] pcs = new bool[12];
            foreach (int c in chord)
            {
                pcs[c] = true;
            }
            int rootpc = chord[0];
            //List<string> names = ChordAnalysis.GetMatchingChordNames(pcs, rootpc);
            //string qualifier = (names.Count == 0) ? "xxx" : names[0];
            string qualifier = ChordAnalysis.GetName(pcs);
            //string txt = NoteName.ToSharpFlat(NoteName._Names[key.MidiKey + 7][rootpc].TrimEnd()) + qualifier;
            string txt = NoteName.ToSharpFlat(NoteName.GetName(key, rootpc).TrimEnd()) + qualifier;

            return(txt);
        }
Esempio n. 3
0
        internal ChordAnalysis.clsScore ChordinateEv(ref clsEvPC ev) //return score
        //* assumes ChordAnalysis OpenDumpChords/SetParams already executed
        {
            if (ev.Notes == null)
            {
                return(null);
            }
            bool[]          chord  = new bool[12];
            clsMTime.clsBBT onbbt  = ev.OnBBT;
            clsMTime.clsBBT offbbt = ev.OffBBT;
            List <int>      chnotes;
            string          qualifier;

            for (int i = 0; i < ev.Notes.Length; i++)
            {
                chord[ev.Notes[i].PC[eKBTrans.None]] = true;
            }
            //ChordAnalysis.clsScore score = ChordAnalysis.GetTopChord(chord, P.F.Keys[onbbt.Ticks],
            //  (int)P.frmCfgChords.nudMaxChordTypeNoMatch.Value, onbbt,
            //  out qualifier, out chnotes);
            ChordAnalysis.clsScore score = ChordAnalysis.GetTopChord(chord, P.F.Keys[onbbt.Ticks],
                                                                     Forms.frmChordRanks.MaxRankNoMatch, onbbt, out qualifier, out chnotes);
            if (score != null)
            {
                bool[] t = new bool[12];
                for (int n = 0; n < chnotes.Count; n++)
                {
                    t[chnotes[n]] = true;
                }
                ev = new clsEvPC(this, onbbt, t, chnotes);
                ev.ChordQualifier = qualifier;
                ev.OffBBT         = offbbt;
                ev.Root           = true;
                return(score);
            }
            return(null);
        }