コード例 #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
 internal clsSegments(clsNoteMap notemap)
 {
     //CSVFileConv = csvfileconv;
     //int barnum = 1;  //tmp debugging
     clsMTime.clsSegment startbar = new clsMTime.clsSegBar(P.F.TicksPerQI, 0, P.F.MaxBBT.QI);
     for (clsMTime.clsSegment bar = startbar; !bar.OOR; bar++)
     {
         //Debug.WriteLine("Bar: " + barnum++
         //  + " TicksLo: " + bar.SegQILo * P.F.TicksPerQI
         //  + " TicksHi: " + bar.SegQIHi * P.F.TicksPerQI);  //temp debugging
         int[] seg = new int[12];
         for (int qi = bar.SegQILo; qi <= bar.SegQIHi; qi++)
         {
             notemap.CalcKeys_CalcSegQI(seg, qi, ref indEmpty);
             //CalcSegQI(notemap, seg, qi, indEmpty);
         }
         Segs.Add(seg);
     }
 }
コード例 #3
0
 protected override bool GetNoteMap(clsNoteMap notemap, int qtime, int note, bool mod)
 {
     return(((clsNoteMapMidi)notemap)[qtime, note, mod]); //all trks
 }
コード例 #4
0
 private Brush GetNoteBrush(int[] chweights, int maxchweight, Brush brush, int notemod, clsNoteMap notemap, int qtime)
 {
     if (Pic.Name != "picNoteMapMidi" && Pic.Name != "picNoteMapQuant" && Pic.Name != "picNoteMapFile")
     {
         return(brush);
     }
     else if (P.F.frmChordMapAdv != null && P.F.frmChordMapAdv.optChordBlack.Checked)
     {
         return(clsChBrush.Black);
     }
     else if (Pic.Name != "picNoteMapFile" && (P.F.frmChordMapAdv != null && P.F.frmChordMapAdv.optChordMatch.Checked))
     {
         return((P.F.CF.NoteMap[qtime, notemod]) ? clsChBrush.Red : clsChBrush.Black);
         //} else if (!P.F.frmNoteMapAdv.optChordBlack.Checked) {
     }
     else
     {
         if (chweights != null && chweights[notemod] > 0)
         {
             //* show weight -> black or red
             //if (chweights[notemod] == maxchweight) brush = clsChBrush.Pink;  //part of potential chord
             //else brush = clsChBrush.Black;  //not part of potential chord
             brush = clsChBrush.Black;
         }
         return(brush);
         //* show weight -> fromarg (green)
         //* int b = (chweights[note] * 255) / maxchweight;
         //* brush = new SolidBrush(Color.FromArgb(0, b, 0));  //shades of green
     }
     //else {
     //  LogicError.Throw(eLogicError.X076);
     //  return clsChBrush.Black;
     //}
 }
コード例 #5
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);
                        }
                    }
                }
            }
        }
コード例 #6
0
        internal void PaintMap(clsNoteMap notemap, Forms.frmTrackMap frm, Graphics xgr, int pixlo, int pixhi, clsMTime mtime)
        {
            //* frm = frmMultiMap if multimap and showing multiple octaves
            //* bardiv=0: don't show bars
            //if (Pic.Name == "picNoteMapCF") Debugger.Break();
            //pixlo = 0;
            //pixhi = NoteMap.GetLengthQTime();
            //Brush brushkb = new SolidBrush(Color.FromArgb(200, 200, 200));
            Brush brushkb = P.ColorsNoteMap["Keyboard"].Br;
            int   qilo    = (pixlo * HDiv) / HFactor;
            int   qihi    = (pixhi * HDiv) / HFactor;

            if (qihi > P.F.MaxBBT.QI)
            {
                qihi = P.F.MaxBBT.QI;
            }
            //SetPicSize(frm);  //call moved to frmMultiMap & frmNoteMap
            //if (!Loc.IsEmpty) Pic.Location = Loc;
            Pen penline = new Pen(Color.Black);

            if (ShowBarNumbers)
            {
                int y = BarFont.Height;
                xgr.DrawLine(penline, 0, y, Width, y); //start
            }
            //* draw keyboard
            if (ShowKB)
            {
                int hi = 12;
                if (!OneOct)
                {
                    hi = Octaves * 12;
                    //if (frm != null) hi = frm.Octaves[Trk] * 12;  //frmMultiMap
                    //else hi = P.F.frmNoteMap.Octaves * 12;  //frmNoteMap
                }
                for (int o = 0; o < hi; o += 12)
                {
                    int   kbxlo = pixlo, kbxhi = pixhi;
                    int[] offset = new int[] { 1, 3, 6, 8, 10 };
                    xgr.FillRectangle(brushkb, kbxlo, GetY(o + offset[0], PixPerNote), kbxhi, PixPerNote); //C#
                    xgr.FillRectangle(brushkb, kbxlo, GetY(o + offset[1], PixPerNote), kbxhi, PixPerNote); //E-
                    //xgr.DrawLine(penline, kbxlo, GetY(o+4), kbxhi, GetY(4));   //E|F
                    xgr.FillRectangle(brushkb, kbxlo, GetY(o + offset[2], PixPerNote), kbxhi, PixPerNote); //F#
                    xgr.FillRectangle(brushkb, kbxlo, GetY(o + offset[3], PixPerNote), kbxhi, PixPerNote); //G#
                    xgr.FillRectangle(brushkb, kbxlo, GetY(o + offset[4], PixPerNote), kbxhi, PixPerNote); //B-
                }
            }

            //* draw notes
            //Color color = Color.Black;
            int pwval = 8192;

            //for (int qtime = 0; qtime < NoteMap.GetLengthQTime(); qtime++) {
            for (int qtime = qilo; qtime < qihi; qtime++)
            {
                //if (qtime >= notemap.GetLengthQTime()) break;
                if (qtime >= P.F.MaxBBT.QI)
                {
                    break;
                }
                //pwval = GetPW(qilo, pwval, qtime);
                //if (frm != null) pwval = ((clsNoteMapMidi)notemap).PB[Trk][qtime];
                if (frm != null)
                {
                    pwval = ((clsNoteMapMidi)notemap).GetPB(Trk, qtime);
                }
                //if (pwval != 8192) color = Color.SkyBlue; else color = Color.Black;
                DrawChord(notemap, xgr, frm, pwval, qtime, HDiv, PixPerNote);
            }

            //draw bars
            // height was GetY(-1, pixpernote);
            DrawBars(BarFont, xgr, Height, ShowBeats, HFactor, HDiv, BarDivMod, qilo, qihi, mtime);
        }
コード例 #7
0
 protected abstract bool GetNoteMap(clsNoteMap notemap, int qtime, int note, bool mod);
コード例 #8
0
 protected override bool GetNoteMap(clsNoteMap notemap, int qtime, int note, bool mod)
 {
     //* must be multiple octaves - top pic (Midi)
     return(((clsNoteMapMidi)notemap)[qtime, note, mod]);
 }
コード例 #9
0
 protected override bool GetNoteMap(clsNoteMap notemap, int qtime, int note, bool mod)
 {
     return(((clsNoteMapMidi)notemap)[qtime, note, Trk, mod]); //incl. pb notes, current trk
 }