internal clsNoteMapMidi(clsOnOff onoff, clsTrks.Array <int> trkminpitch, clsTrks.Array <int> trkmaxpitch, clsFileStream filestream) { //NumTrks = numtrks; TrkMinPitch = trkminpitch; TrkMaxPitch = trkmaxpitch; int len = P.F.MaxBBT.MaxNoteMapQI; Filter = new byte[len, 12]; #if MemoryInfo long before = GC.GetTotalMemory(true); #endif PropagatePW(filestream, len, null); _Map = new clsTrks.Array <ushort[]>(delegate() { return(new ushort[len]); }); //NewMap = clsTrks.Array<ushort[]>.NewClass(delegate () { return new ushort[onoff.Length]; }); InitMap(onoff, null, filestream.ExclPB); _FullMap = new clsTrks.Array <BigInteger[]>(delegate() { return(new BigInteger[len]); }); //BigInteger 128 bits //NewFullMap = clsTrks.Array<BigInteger[]>.NewClass(delegate () { return new BigInteger[onoff.Length]; });//BigInteger 128 bits InitFullMap(onoff, null, filestream.ExclPB); #if MemoryInfo long after = GC.GetTotalMemory(true); long diff = after - before; TotalMem += diff; Debug.WriteLine("clsNoteMapMidi new diff = " + diff + " total diff = " + TotalMem + " bytes"); #endif InitFilter(0, Filter.GetLength(0) - 1); EleW = new clsW(this); CreateOnOffPairs(); }
private void InitMap(clsOnOff onoff, clsTrks.T intrk, bool exclpb) //virtual channel (= track) { foreach (clsTrks.T trk in P.F.Trks.Ints.Next) //create this[] from modded note (map) { if (intrk != null && intrk != trk) { continue; } for (int note = 0; note < 12; note++) { int cnt = 0; for (int qtime = 0; qtime < onoff.Length; qtime++) { cnt += onoff[qtime, note, trk, true]; //if (cnt > 0) Debugger.Break(); //ON this[qtime, note, trk] = (cnt > 0); } } if (exclpb) { for (int qtime = 0; qtime < onoff.Length; qtime++) { for (int note = 0; note < 12; note++) { if (this[qtime, note, trk] && PB[trk][qtime] != 8192) { this[qtime, note, trk] = false; } } } } } }
//internal override bool QI_OOR(int qi) { // return (qi >= P.F.MaxBBT.QI || qi >= NewMap[new clsTrks.T(P.F.Trks, 0)].Length); //} //internal override void Realloc(int qlen) { // int maplen = _Map[new clsTrks.T(P.F.Trks, 0)].Length; // if (qlen == maplen) return; // clsTrks.Array<ushort[]> newmap = new clsTrks.Array<ushort[]>(delegate () { return new ushort[qlen]; }); // clsTrks.Array<BigInteger[]> newfullmap = new clsTrks.Array<BigInteger[]>(delegate () { return new BigInteger[qlen]; }); // bool[,] trk_selected = new bool[qlen, 128]; // clsTrks.Array<short[]> pb = new clsTrks.Array<short[]>(delegate () { // short[] pw = new short[qlen]; // for (int i = 0; i < qlen; i++) pw[i] = -1; // return pw; // }); // byte[,] filter = new byte[qlen, 12]; // for (int q = 0; q < qlen; q++) { // if (q < maplen) { // foreach (clsTrks.T trk in P.F.Trks.Ints.Next) { // newmap[trk][q] = _Map[trk][q]; // newfullmap[trk][q] = _FullMap[trk][q]; // pb[trk][q] = PB[trk][q]; // } // for (int n = 0; n < 128; n++) trk_selected[q, n] = Trk_Selected[q, n]; // for (int n = 0; n < 12; n++) filter[q, n] = Filter[q, n]; // } // } //} private void InitFullMap(clsOnOff onoff, clsTrks.T intrk, bool exclpb) { foreach (clsTrks.T trk in TrkMinPitch.Next) //create this[] from unmodded note (fullmap) { if (intrk != null && intrk != trk) { continue; } for (int note = TrkMinPitch[trk]; note <= TrkMaxPitch[trk]; note++) { int cnt = 0; for (int qtime = 0; qtime < onoff.Length; qtime++) { cnt += onoff[qtime, note, trk, false]; //if (cnt > 0) Debugger.Break(); //ON this[qtime, note, trk, false] = (cnt > 0); } } if (exclpb) { for (int qtime = 0; qtime < onoff.Length; qtime++) { for (int note = TrkMinPitch[trk]; note <= TrkMaxPitch[trk]; note++) { if (this[qtime, note, trk, false] && PB[trk][qtime] != 8192) { this[qtime, note, trk, false] = false; } } } } } }
//internal clsNoteMapCF() { //default // if (P.F.MaxTicks <= 0) Debugger.Break(); // if (P.F.TicksPerQI <= 0) Debugger.Break(); // int len = P.F.MaxTicks / P.F.TicksPerQI; // NewMap = new ushort[len]; //} internal clsNoteMapCF(clsCF cf, clsOnOff onoff) { CF = cf; #if MemoryInfo long before = GC.GetTotalMemory(true); Debug.WriteLine("clsNoteMapCF len = " + len); Debug.WriteLine("memory before = " + before + " bytes"); #endif _Map = new ushort[P.F.MaxBBT.MaxNoteMapQI]; //Map = new clsMap(len, 12); #if MemoryInfo long after = GC.GetTotalMemory(true); Debug.WriteLine("memory after = " + after + " bytes"); Debug.WriteLine("diff = " + (after - before) + " bytes"); #endif _ChordAtt = new sChordAtt[P.F.MaxBBT.MaxNoteMapQI]; for (int qi = 0; qi < P.F.MaxBBT.MaxNoteMapQI; qi++) { _ChordAtt[qi] = new sChordAtt(0); //root -1 etc. } if (onoff != null) { InitMap(onoff); } //CF.UndoRedoCF = new clsCF.clsUndoRedo(this); //CF.UndoRedoCF.Active = true; }
//internal override bool QI_OOR(int qi) { // return (qi >= P.F.MaxBBT.QI || qi >= NewMap.Length); //} private void InitMap(clsOnOff onoff) { for (int note = 0; note < 12; note++) { int cnt = 0; for (int qtime = 0; qtime < onoff.Length; qtime++) { cnt += onoff[qtime, note, new clsTrks.T(P.F.CFTrks, 0), true]; //trk0 (only one trk) if (cnt > 0) { this[qtime, note] = true; } } } }