internal void ResetRecord() { //* clear Record Record = new clsList(AudioSync); Record.Add(0); //AutoSync.Record_LastUsed = ela.Record.ToList(); }
internal void CopyRecordToPlay() { //Play = Record.ToList(); Play = new clsList(AudioSync); for (int i = 0; i < Record.Count; i++) { Play.Add(Math.Max(0, Record[i])); } //foreach (long l in Record) { // Play.Add(Math.Max(0, l)); //} }
private void ReadSection(List <string> lines, ref int i, out clsList list) { list = new clsList(AudioSync); for (; i < lines.Count; i++) { string l = lines[i]; if (l.Trim() == "+++") //End of Play / Start of Record { i++; break; } long elapsed; long.TryParse(l, out elapsed); //0 by default list.Add(elapsed); } }
internal int ValidatePlay(bool prompt) //check Play only //* return beatnumber of first error, or -1 //if (Play[0] != 0) return 0; //doesn't start with 0 { int startbeat = 1; for (; startbeat < Play.Count; startbeat++) //locate to first non-zero { if (Play[startbeat] != 0) { break; } } if (startbeat == Play.Count) { return(Play.Count); //no non-zero values } long lastpos = 0; //last non-zero position for (int b = startbeat; b < Play.Count; b++) { //if (Play[b] > 0 && Play[b] <= Play[b - 1]) { if (Play[b] > 0) { if (Play[b] <= lastpos) { string msg = "File sequence error at beat " + (b + 1); if (!prompt) { MessageBox.Show(msg); return(b); } if (MessageBox.Show(msg + " - truncate file?", MessageBoxButtons.YesNo) == DialogResult.Yes) { Play = Play.GetRange(0, b); return(-1); } return(b); } lastpos = Play[b]; } } return(-1); }
internal clsElapsed(clsAudioSync autosync, List <string> lines) //from .cht file //* create list from .cht file { AudioSync = autosync; int i = 0; clsList list; ReadSection(lines, ref i, out list); //to "+++" or EOF Play = list; ReadSection(lines, ref i, out list); if (list.Count == 0) { ResetRecord(); } else { Record = list; } AudioSync.indSave = false; }
internal clsElapsed(clsElapsed elapsed) //copy { Record = elapsed.Record.ToList(); Play = elapsed.Play.ToList(); AudioSync = elapsed.AudioSync; }
internal bool SequenceEqual(clsList list) { return(List.SequenceEqual(list.List)); }
internal void ResetPlay() { //* clear Play Play = new clsList(AudioSync); Play.Add(0); }