示例#1
0
        //protected override void GetMinMaxPitch(out int min, out int max) {
        //  min = IShowNoteMap.MinC;  //may be lower than necessary
        //  max = IShowNoteMap.MinC + IShowNoteMap.Octaves * 12;  //may be higher than necessary
        //}

        //protected override void GetYMinC(Forms.frmTrackMap frm, out int y, out int minc) {
        //  y = PixPerNote;
        //  minc = IShowNoteMap.MinC;  //frmNoteMap
        //}

        protected override bool GetNoteMap(clsNoteMap notemap, int qtime, int notemod)
        {
            if (Weighted)
            {
                return(notemap.IsF(qtime, notemod));
            }
            //if (notemap is clsNoteMapMidi) return ((clsNoteMapMidi)notemap).GetMapPB(qtime, notemod);
            return(notemap[qtime, notemod]);
        }
示例#2
0
        private void DrawChord(clsNoteMap notemap, Graphics xgr, Forms.frmTrackMap frm, int pwval, int qtime,
                               int hdiv, int vfactor)
        {
            string name = Pic.Name;

            //int trk = Trk;
            int[] chweights   = null;
            int   maxchweight = 0;
            Brush brush;

            if (pwval != 8192)
            {
                brush = BrushPW;
            }
            else
            {
                brush = BrushNoPW;
            }
            int noteborder = (ShowKB) ? vfactor / 3 : 0; //vertical pixels not coloured in (to allow black keyboard notes to be seen)

            if (Trk == null)                             //all channels (not multimap)
            //* get chord colours (int[12] chweights)
            {
                bool[] boolmap;
                if (Weighted)
                {
                    boolmap = notemap.IsF(qtime);
                }
                else
                {
                    boolmap = notemap[qtime];
                }
                ChordDB.clsDesc desc = ChordDB.GetChord(boolmap);
                if (desc != null) //matches chord exactly
                //brush = clsChBrush.GetOldBrush(desc.Rank);
                {
                    brush = clsChBrush.GetOldBrush();
                }
                else //no match - show note weights
                {
                    chweights   = ChordDB.GetChordWeights(boolmap);
                    maxchweight = chweights.Max();
                }
            }

            int width = Math.Max(1, HFactor / hdiv);

            if (!OneOct) //frmMultiMap or notemap.midi
            //* calc note display limits
            //int minpitch, maxpitch;
            //GetMinMaxPitch(out minpitch, out maxpitch);
            //int y, minc;
            //GetYMinC(frm, out y, out minc);

            //* draw note if notemap[..] true
            {
                for (int note = MinPitchShow; note <= MaxPitchShow; note++)
                {
                    if (!GetNoteMap(notemap, qtime, note, false))
                    {
                        continue;
                    }
                    int notemod = note.Mod12();
                    if (Pic.Name == "picNoteMapMidi")
                    {
                        //brush = Brushes.Black;
                        if (P.F.CF != null && P.F.CF.NoteMap[qtime, note.Mod12()])
                        {
                            brush = P.ColorsNoteMap["Note Match"].Br;
                        }
                        else
                        {
                            brush = P.ColorsNoteMap["Note No Match"].Br;
                        }
                    }
                    else if (Pic == P.frmSC.picNoteMap)
                    {
                        for (int i = 0; i < P.frmSC.MapTrks.Count; i++)
                        {
                            clsTrks.T trk    = P.frmSC.MapTrks[i];
                            int       trknum = trk.TrkNum;
                            if (trknum > 15)
                            {
                                trknum %= 16;
                            }
                            if (((clsNoteMapMidi)notemap)[qtime, note, trk, false])
                            {
                                brush = TrkBrushes[i];
                                xgr.FillRectangle(brush, (qtime * HFactor) / hdiv, GetY(note - MinC, PixPerNoteInt), width, vfactor);
                            }
                        }
                        continue;
                    }
                    else
                    {
                        brush = GetNoteBrush(chweights, maxchweight, brush, notemod, notemap, qtime);
                    }
                    if (frm?.NoteMap?.Delete != null && //trackmap
                        Trk == frm.MouseTrk &&
                        frm.NoteMap.Delete[qtime, note])
                    {
                        brush = Brushes.Red;
                    }
                    xgr.FillRectangle(brush, (qtime * HFactor) / hdiv, GetY(note - MinC, PixPerNoteInt), width, vfactor);
                }
            }
            else //oneoct - called from frm NoteMap (any) or frmMultiMap
            //* draw note if notemap[..] true
            {
                for (int notemod = 0; notemod < 12; notemod++)
                {
                    if (!GetNoteMap(notemap, qtime, notemod))
                    {
                        continue;
                    }
                    if (Pic.Name == "picNoteMapMidi")
                    {
                        brush = Brushes.Black;
                        if (P.F.CF != null && P.F.CF.NoteMap[qtime, notemod])
                        {
                            brush = P.ColorsNoteMap["Note Match"].Br;
                        }
                        else
                        {
                            brush = P.ColorsNoteMap["Note No Match"].Br;
                        }
                    }
                    else
                    {
                        brush = GetNoteBrush(chweights, maxchweight, brush, notemod, notemap, qtime);
                    }
                    xgr.FillRectangle(brush, (qtime * HFactor) / hdiv, GetY(notemod, vfactor) + noteborder, width, vfactor - 2 * noteborder);
                }
                if ((Pic.Name == "picNoteMapMidi" || Pic.Name == "picNoteMapQuant") &&
                    (P.F.frmChordMapAdv != null && P.F.frmChordMapAdv.optChordMatch.Checked))
                {
                    //* check if pitchclass (pc) present in notemapcf, but not in pic
                    for (int pc = 0; pc < 12; pc++)
                    {
                        if (P.F.CF.NoteMap[qtime, pc] && !GetNoteMap(notemap, qtime, pc))
                        {
                            Brush gbrush = clsChBrush.Green;
                            xgr.FillRectangle(gbrush, (qtime * HFactor) / hdiv, GetY(pc, vfactor) + noteborder, width, vfactor - 2 * noteborder);
                        }
                    }
                }
            }
        }