public void AddAudioData(long startByte, byte[] data) { AudioSegment segment = new AudioSegment() { StartIndex = startByte, Data = data }; if (CurrentSegment == null) { if (startByte + data.Length > Position) { CurrentSegment = segment; } } else { CurrentSegment.Insert(segment); } }
public void Insert(AudioSegment newSegment) { if (NextSegment == null) { if (newSegment.StartIndex + newSegment.Data.Length > StartIndex + Data.Length) { NextSegment = newSegment; } } else { if (newSegment.StartIndex < NextSegment.StartIndex) { newSegment.NextSegment = NextSegment; NextSegment = newSegment; } else { NextSegment.Insert(newSegment); } } }