internal override clsNote Copy() { clsNotePC ret = new clsNotePC(_PC_NoKBTrans); ret.OnBBT = OnBBT; ret.OffBBT = OffBBT; return(ret); }
internal clsEvPC(clsCFPC chordfile, clsMTime.clsBBT onbbt, int[] chord) //BIAB, ManChords { CF = chordfile; OnBBT = onbbt; Root = true; List <clsNotePC> listnpw = new List <clsNotePC>(); for (int i = 0; i < chord.Length; i++) { clsNotePC npw = new clsNotePC(); //npw.PC_NoKBTrans = chord[i].Mod12(); npw.Set_PC_NoKBTrans(chord[i]); listnpw.Add(npw); } _Notes = listnpw.ToArray(); }
internal clsEvPC(clsCFPC cf, string[] ll) //null bbt, or called by other constructor //bars. beats, twelfths start at 0 { CF = cf; //Index = index; if (ll[1] == "null") //no chord - use scale (7 note chord) { _Notes = new clsNotePC[0]; return; //show nothing } List <clsNotePC> listnpw = new List <clsNotePC>(); int chordpitch = -1; int notecnt = 0; for (int i = 1; i < ll.Length; i++) //ll = space delimited line, incl bbt { string l = ll[i]; if (l.StartsWith("..")) //bassnote { BassNote = l.TrimStart(new char[] { '.' }); //not yet used... } else if (l.StartsWith(".")) //chordname { string name = l.TrimStart(new char[] { '.' }); chordpitch = NoteName.GetPitchAndQualifier(name, out ChordQualifier); if (chordpitch < 0) { throw new ChordFileException(); //should be ChordFileException } //} else if (l.StartsWith(":")) { //chordname (marked) // string name = l.TrimStart(new char[] { ':' }); // chordpitch = NoteName.GetPitchAndQualifier(name, out ChordQualifier); // if (chordpitch < 0) throw new ChordFileException(); //should be ChordFileException // Mark = true; } else //note { if (++notecnt > (int)P.frmStart.nudMaxChordSize.Value) { continue; } clsNotePC npw = new clsNotePC(); int pitch = NoteName.GetPitch(l); if (pitch < 0) //not a valid note - assume chord+qualifier { ll[i--] = "." + l; continue; } npw.Set_PC_NoKBTrans(NoteName.GetPitch(l)); listnpw.Add(npw); } } if (chordpitch >= 0) //chordname present, with or without notes { string qual = ChordQualifier.ToLower(); ChordAnalysis.clsTemplate t = ChordAnalysis.NameToTemplate[qual]; ChordQualifier = t.Name; //change to correct case and spelling (if necessary) if (listnpw.Count == 0) //get notes from ChordAnalysis { listnpw.Add(new clsNotePC(chordpitch)); //root for (int p = 1; p < 12; p++) //start at 1 - root already added { if (t.PC[p]) { listnpw.Add(new clsNotePC((chordpitch + p).Mod12())); } } //* if (listnpw.Count == 0) throw new ChordFileException(); //chord qualifier not found //* temp frig - need to get user exceptions working with the debugger if (listnpw.Count == 0) { throw new ChordFileException(); } } } if (listnpw.Count < P.frmStart.nudMinChordSize.Value) //should be 0 unless advanced... { _Notes = new clsNotePC[0]; //null chord } else { _Notes = listnpw.ToArray(); if (chordpitch == Notes[0].PC[eKBTrans.None]) { Root = true; } } }