//protected override int GetPW(int qilo, int pwval, int qtime) { // return pwval; //} protected override int GetPixPerNote(Forms.frmTrackMap frm) //frm not used here { if (IShowNoteMap.OneOct) { return(0); } return(IShowNoteMap.GetPixPerNoteInt() * (int)IShowNoteMap.nudHeightVal); }
//* used by frmMultiMap - one trk only internal clsPicNoteMapMM(Forms.frmTrackMap multimap, PictureBox pic, clsTrks.T trk) : base(pic, trk, false, multimap.BarFont, false) { frmMM = multimap; //FileName = multimap.FileName; //NoteMap = multimap.NoteMap; //MaxQTime = multimap.MaxQTime; //NumTrks = multimap.NumTrks; //QIdd = multimap.QIdd; //TicksPerQI = multimap.TicksPerQI; //FirstTrk = false; SetPicSize(multimap); }
internal Size SetPicSize(Forms.frmTrackMap frm) { PixPerNote = VFactor; if (!OneOct) { PixPerNote = GetPixPerNote(frm); } if (PixPerNote == 0) { PixPerNote = 1; Pic.BackColor = Color.LightGray; } else { Pic.BackColor = Color.White; } BarDivMod = BarDiv; if (ShowBeats && BarDiv != 1) { BarDivMod = 1; } ShowBarNumbers = (BarDiv > 0 && BarFont != null); if (OneOct) { Height = 12 * PixPerNote; } else { Height = GetTrkHeight(frm); } if (ShowBarNumbers) { Height += BarFont.Height; } Width = (P.F.MaxBBT.QI * HFactor) / HDiv; Size size = new Size(Width, Height); Pic.ClientSize = size; GetRanges(frm); //if (frm != null && Trk == frm.RecTrk) Debugger.Break(); return(size); }
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); } } } } }
protected override int GetTrkHeight(Forms.frmTrackMap frm) //frm not used here { return(P.frmSC.VFactor * Octaves * 12); }
protected override int GetPixPerNote(Forms.frmTrackMap frm) //frm not used here { return(P.frmSC.VFactor); }
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); }
protected abstract void GetRanges(Forms.frmTrackMap frm);
protected abstract int GetTrkHeight(Forms.frmTrackMap frm);
protected abstract int GetPixPerNote(Forms.frmTrackMap frm);
protected override int GetTrkHeight(Forms.frmTrackMap frm) //frm not used here { return(IShowNoteMap.GetTrkHeight(PixPerNote)); }
protected override int GetTrkHeight(Forms.frmTrackMap frm) { return(frm.GetTrkHeight(Octaves)); }
//protected override int GetPW(int qilo, int pwval, int qtime) { // if (qtime == qilo) pwval = frmMM.FileStream.PitchBend[Trk].SearchGetValueQI(qtime); // else pwval = frmMM.FileStream.PitchBend[Trk].SeqGetValueQI(qtime); // return pwval; //} protected override int GetPixPerNote(Forms.frmTrackMap frm) { return(frm.GetPixPerNoteInt(Octaves)); //frmMultiMap }