Ejemplo n.º 1
0
        internal void Populateclb(clsFileStream fsmm)
        {
            CSVFileSummary = fsmm;
            //int lasttrk = 1;
            clbTrk.Items.Clear();
            string fmt = "{0,2} {1,2} {2,5} {3,3} {4,3} {5,3} {6,3} {7,3} {8,-10} {9,6} {10,-24} {11,-40}";

            //txtTitle.Text = string.Format(fmt, "Tk", "Ch", "Count", "Min", "Max", "Min", "Max", "Rng", "Style", "Poly", "Patch", "Title");
            foreach (clsTrks.T trk in P.F.Chan.Next)
            {
                int      chan     = P.F.Chan[trk];
                string   chantxt  = "";
                string[] patchtxt = new string[] { "" };
                if (chan >= 0)
                {
                    chantxt = (chan + 1).ToString();
                    if (chan == 9) // percussion
                    {
                        patchtxt = new string[] { "*** channel 10 ***" };
                    }
                    else
                    {
                        clsFileStream fs = null;
                        if (P.F.FSTrackMap != null)
                        {
                            fs = P.F.FSTrackMap;
                        }
                        if (fs != null)
                        {
                            patchtxt = fs.MidiCtlrs.GetPatchList(chan);
                        }
                    }
                }

                int diff = fsmm.TrkMaxPitch[trk] - fsmm.TrkMinPitch[trk];
                if (diff < 0)
                {
                    diff = 0;
                }
                string poly  = (fsmm.Poly[trk] < 0) ? "" : string.Format("{0:N2}", fsmm.Poly[trk]);
                string chord = (fsmm.ChordNeg[trk] < 0) ? "" : string.Format("{0:N2}", fsmm.ChordNeg[trk]);
                string txt   = string.Format(fmt,
                                             trk.ToString(),
                                             chantxt,
                                             fsmm.OnCount[trk],
                                             (fsmm.OnCount[trk] == 0) ? "*" : NoteName.GetPitchStr(fsmm.TrkMinPitch[trk]),
                                             (fsmm.OnCount[trk] == 0) ? "*" : NoteName.GetPitchStr(fsmm.TrkMaxPitch[trk]),
                                             (fsmm.OnCount[trk] == 0) ? "*" : NoteName.GetPitchStrMidi(fsmm.TrkMinPitch[trk]),
                                             (fsmm.OnCount[trk] == 0) ? "*" : NoteName.GetPitchStrMidi(fsmm.TrkMaxPitch[trk]),
                                             diff,
                                             fsmm.TrkType[trk].ToString(),
                                             poly,
                                             patchtxt[0],
                                             fsmm.Title[trk].Trim(new char[] { '"' }));

                clbTrk.Items.Add(txt);
                for (int i = 1; i < patchtxt.Length; i++) //start at 2nd element
                {
                    clbTrk.Items.Add(string.Format(fmt, "", "", "", "", "", "", "", "", "", "", patchtxt[i], ""));
                }
            }
        }