public static void BufferManger(CASSubSegment subSegmentFromUdp) { if (subSegmentFromUdp.segID == 1) { if (segToBuffer != null) { if (segToBuffer.IsValid) { //if(segToBuffer.Data.Count < 192*64) //{ BeamsBuffer.WriteBeamsFromDictionary(segToBuffer.GetBeamsValues()); BeamsBuffer.Heading = segToBuffer.Heading; //} } } segToBuffer = new CASSegment(subSegmentFromUdp); } else { if (segToBuffer != null) { segToBuffer.AddSubSegment(subSegmentFromUdp); } } }
public CASSegment(CASSubSegment subSegmentToAdd) { IsValid = true; Data = new List <byte>(); SubSegments = new Dictionary <int, CASSubSegment>(); Data.AddRange(subSegmentToAdd.data); SubSegments.Add(1, subSegmentToAdd); }
private static void OnTimedEventAudio(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs) { if (i >= FileBytes.Length) { Console.WriteLine("***** FINISHED *****"); var TotalSeconds = (DateTime.Now - timestart).TotalSeconds; Console.WriteLine($"TotalSeconds: {TotalSeconds}"); AudioMicroTimer.Enabled = false; return; } byte[] part = new byte[1400]; Buffer.BlockCopy(FileBytes, i, part, 0, 1400); CASSubSegment newCAS = new CASSubSegment(part); CASSegmentManger.BufferManger(newCAS); i += 1400; }
public void AddSubSegment(CASSubSegment subSegmentToAdd) { if (subSegmentToAdd.segID == SubSegments.Last().Key + 1) { try { if (subSegmentToAdd.segID == 10) { Heading = BitConverter.ToInt16(subSegmentToAdd.heading); } Data.AddRange(subSegmentToAdd.data); SubSegments.Add(subSegmentToAdd.segID, subSegmentToAdd); } catch { IsValid = false; } } else { IsValid = false; } }