示例#1
0
 internal void CreateEvs()
 {
     //* create evs from notemapcf
     Evs = new List <clsEv>();
     //for (int q = 0; q < P.F.CF.NoteMap.GetLengthQTime(); q++) {
     for (int q = 0; q < P.F.MaxBBT.QI; q++)
     {
         if (q > 0 && NoteMap.GetMap(q) == NoteMap.GetMap(q - 1) && //null != unrecognised chord
             NoteMap.GetChordAtt(q).ChordEquals(NoteMap.GetChordAtt(q - 1)))
         {
             continue;
         }
         clsMTime.clsBBT bbt = new clsMTime.clsBBT(q * P.F.TicksPerQI);
         clsNoteMapCF    ncf = (clsNoteMapCF)NoteMap;
         clsEv           ev  = new clsEvPC(this, bbt, ncf[q], ncf.GetChordAtt(q).Root);
         ev.ChordQualifier = clsNoteMap.PtrToDesc(ncf.GetChordAtt(q).Qualifier);
         if (ev.Notes.Length == 0 && P.frmStart.chkIgnoreNullChords.Checked)
         {
             continue;                                                          //null chord
         }
         //if (ncf.ChordAtt[q].Marked > 0) ev.Mark = true;
         if (Evs.Count > 0 && Evs[Evs.Count - 1].Notes.Length == 0) //previous ev was null
         {
             if (bbt.Ticks - Evs[Evs.Count - 1].OnTime <= Forms.frmSC.SyncopationDefault.Ticks)
             {
                 Evs.RemoveAt(Evs.Count - 1);
             }
         }
         if (Evs.Count > 0)
         {
             Evs[Evs.Count - 1].OffBBT = bbt;         //set offtime for previous line
         }
         Evs.Add(ev);
     }
     if (Evs.Count > 0)
     {
         SetLastEv();
     }
     SyncEvsToKeys();
     //if (P.frmSC != null && P.F.AutoSync == null) P.frmSC.mnuCreateSyncFile.Enabled = true;
 }
示例#2
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);
        }
示例#3
0
            }                                          //clone

            internal clsEvPC(clsEvPC evpc, clsMTime.clsBBT onbbt, clsMTime.clsBBT offbbt)
                : base(evpc, onbbt, offbbt)
            {
            }                            //clone for different time
示例#4
0
 internal clsEvPC(clsEvPC evpc) : base(evpc)
 {
 }                                          //clone
示例#5
0
        protected List <string> ReadNotes()
        {
            List <string> ret = new List <string>();

            if (Lnum >= Lines.Count)
            {
                return(ret);
            }
            if (Lines[Lnum].Trim() == "Start Chords")
            {
                Lnum++;                                  //not used here - skip
            }
            for (int prevonticks = int.MinValue; Lnum < Lines.Count; Lnum++)
            {
                string[]        ll; //line delimited by spaces
                clsMTime.clsBBT bbt;
                string          line = ReadBBTLine(prevonticks, out ll, out bbt);
                if (line.Length > 0)
                {
                    ret.Add(line);           //"" if > P.F.MaxBBT.Bar
                }
                if (ll == null)
                {
                    continue;      //offset or (null and chkIgnoreNullChords.Checked)
                }
                //* check for "end" line
                if (ll[1] == "end" || bbt.Bar > P.F.MaxBBT.Bar)
                {
                    break;
                    //if (Evs.Count > 0) {
                    //  int endticks = Math.Min(P.F.MaxBBT.Ticks, bbt.Ticks);
                    //  Evs[Evs.Count - 1].OffBBT = new clsMTime.clsBBT(endticks);
                    //}
                    //return ret;  //ignore anything after "end" line
                }

                //* read note(s)
                clsEvPC ev;
                try {
                    ev = new clsEvPC(this, bbt, ll);
                }
                catch (ChordFileException) { //should be ChordFileException
                    ev = new clsEvPC(this, bbt, new string[] { "", "null" });
                }

                if (ev.Notes.Length == 0 && P.frmStart.chkIgnoreNullChords.Checked)
                {
                    continue;                                              //null chord
                }
                if (Evs.Count > 0 && Evs[Evs.Count - 1].Notes.Length == 0) //previous ev was null
                {
                    if (bbt.Ticks - Evs[Evs.Count - 1].OnTime <= Forms.frmSC.SyncopationDefault.Ticks)
                    {
                        Evs.RemoveAt(Evs.Count - 1);
                    }
                }
                prevonticks = bbt.Ticks;

                if (Evs.Count > 0)
                {
                    Evs[Evs.Count - 1].OffBBT = bbt;                         //set offtime for previous line
                }
                if (Evs.Count > 0 && Evs[Evs.Count - 1].OnTime == bbt.Ticks) //same time - alternative chord
                {
                    continue;
                    //clsEv altev = new clsEv(this, ll);
                    //Evs[Evs.Count - 1].AltEv = altev;
                }
                else
                {
                    Evs.Add(ev);
                }
            }

            //* set lastev offtime (if no "end" line)
            SetLastEv();
            return(ret);
        }