Пример #1
0
 internal int this[eKBTrans kbtrans] {
     get {
         int x = (kbtrans == eKBTrans.Add) ? P.frmSC.Play.TransposeKB : 0;
         x = (kbtrans == eKBTrans.Sub) ? -P.frmSC.Play.TransposeKB : x;
         return((PC + x).Mod12());
     }
 }
Пример #2
0
 internal int this[eKBTrans kbtrans] {
     get {
         if (P.frmSC.Play == null)
         {
             return(Pitch);
         }
         int x = (kbtrans == eKBTrans.Add) ? P.frmSC.Play.TransposeKB : 0;
         x = (kbtrans == eKBTrans.Sub) ? -P.frmSC.Play.TransposeKB : x;
         return(Pitch + x); //no Mod12()
     }
 }
Пример #3
0
 internal bool[] GetBoolNotes(eKBTrans kbtrans = eKBTrans.None)
 {
     bool[] boolchord = new bool[12];
     foreach (clsNote n in Notes)
     {
         //if (kbtrans) boolchord[n.PC_KBTrans] = true;
         //else boolchord[n.PC_NoKBTrans] = true;
         boolchord[n.PC[kbtrans]] = true;
     }
     return(boolchord);
 }
Пример #4
0
            internal string ChordNameRoman(clsKeyTicks key, eKBTrans kbtrans) //eg I, vi, #IVo
            {
                if (Notes == null || Notes.Length == 0)
                {
                    return("null");
                }
                if (Notes.Length < 3 || !Root)
                {
                    return("xxxx");
                }
                //int rootpitch = (kbtrans) ? Notes[0].PC_KBTrans : Notes[0].PC_NoKBTrans;
                //string roman = NoteName.GetDegree(rootpitch, key.KBTrans_KeyNote);
                int    rootpitch = Notes[0].PC[kbtrans];
                string roman     = NoteName.GetDegree(rootpitch, key.KeyNote);

                return(roman + ChordQualifier);
            }
Пример #5
0
        //internal override void Realloc(int qlen) {
        //  if (qlen == _Map.Length) return;
        //  ushort[] newmap = new ushort[qlen];
        //  sChordAtt[] chordatt = new sChordAtt[qlen];
        //  for (int q = 0; q < qlen; q++) {
        //    if (q >= _Map.Length) {
        //      newmap[q] = 0;
        //      chordatt[q] = new sChordAtt(0);
        //    } else {
        //      newmap[q] = _Map[q];
        //      chordatt[q] = _ChordAtt[q];
        //    }
        //  }
        //  _ChordAtt = chordatt;
        //  _Map = newmap;
        //}

        public bool[] GetBoolChord(int qtime, eKBTrans kbtrans)
        {
            bool[] ch = this[qtime];
            if (kbtrans == eKBTrans.None)
            {
                return(ch);
            }
            int x = (kbtrans == eKBTrans.Add) ? P.frmSC.Play.TransposeKB : -P.frmSC.Play.TransposeKB;

            bool[] chtrans = new bool[12];
            for (int pc = 0; pc < 12; pc++)
            {
                if (ch[pc])
                {
                    chtrans[(pc + x).Mod12()] = true;
                }
            }
            return(chtrans);
        }
Пример #6
0
 //internal string ChordName(sNote[] notes) {  //eg C, Am, F#dim
 internal string ChordName(eKBTrans kbtranspc, bool kbtranskey) //eg C, Am, F#dim
 //* show in txt boxes
 {
     if (Notes == null || Notes.Length == 0)
     {
         return("null");
     }
     if (Root)
     {
         //int pitch = (kbtrans) ? Notes[0].PC_KBTrans : Notes[0].PC_NoKBTrans;
         int pitch = Notes[0].PC[kbtranspc];
         //int midikey = P.F.Keys[OnTime].KBTrans_MidiKey;
         clsKey key = P.F.Keys[OnTime, kbtranskey];
         //return NoteName.ToSharpFlat(NoteName._Names[midikey + 7][pitch].TrimEnd()) + ChordQualifier;
         return(NoteName.ToSharpFlat(NoteName.GetName(key, pitch).TrimEnd()) + ChordQualifier);
     }
     else
     {
         return("xxxx");
     }
 }
Пример #7
0
            internal bool[] GetBoolNotesTriad(eKBTrans kbtrans)
            {
                //* return bool[12] containing maj, min, dim, aug triad notes (or null)
                bool[] boolchord = new bool[12];
                if (Notes.Length < 3)
                {
                    return(null);
                }
                boolchord[Notes[0].PC[kbtrans]] = true; //root
                int count = 1;

                for (int i = 1; i < Notes.Length; i++)
                {
                    int diff = (Notes[i].PC[kbtrans] - Notes[0].PC[kbtrans]).Mod12();
                    //* check if mi3, ma3, dim5, p5, aug5 relative to root
                    if (diff != 3 && diff != 4 && diff != 6 && diff != 7 && diff != 8)
                    {
                        continue;
                    }
                    boolchord[Notes[i].PC[kbtrans]] = true;
                    count++;
                }
                return((count == 3) ? boolchord : null);
            }