/// <summary> /// Removes the specified value. /// </summary> /// <param name="value">Value.</param> public void Remove(SoundEnvelope value) { if (List.Contains(value)) { List.Remove(value as object); } }
/// <summary> /// Gets the size of. /// </summary> /// <returns>Size of this object.</returns> public int GetSizeOf() { int res = 1; if (HasInPoint) { res += 4; } if (HasOutPoint) { res += 4; } if (HasLoops) { res += 2; } if (HasEnvelope) { res++; if (envelopeRecord != null) { res += envelopeRecord.Count * SoundEnvelope.GetSizeOf(); } } return(res); }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { binaryReader.ReadUBits(2); syncStop = binaryReader.ReadBoolean(); syncNoMultiple = binaryReader.ReadBoolean(); bool hasEnvelope = binaryReader.ReadBoolean(); bool hasLoops = binaryReader.ReadBoolean(); bool hasOutPoint = binaryReader.ReadBoolean(); bool hasInPoint = binaryReader.ReadBoolean(); if (hasInPoint) { inPoint = binaryReader.ReadUInt32(); } if (hasOutPoint) { outPoint = binaryReader.ReadUInt32(); } if (hasLoops) { loopCount = binaryReader.ReadUInt16(); } if (hasEnvelope) { byte envPoints = binaryReader.ReadByte(); if (envPoints != 0) { envelopeRecord.Clear(); for (int i = 0; i < envPoints; i++) { SoundEnvelope envelope = new SoundEnvelope(); envelope.ReadData(binaryReader); envelopeRecord.Add(envelope); } } } }
/// <summary> /// Reads the data. /// </summary> /// <param name="binaryReader">Binary reader.</param> public void ReadData(BufferedBinaryReader binaryReader) { binaryReader.ReadUBits(2); syncStop = binaryReader.ReadBoolean(); syncNoMultiple = binaryReader.ReadBoolean(); bool hasEnvelope = binaryReader.ReadBoolean(); bool hasLoops = binaryReader.ReadBoolean(); bool hasOutPoint = binaryReader.ReadBoolean(); bool hasInPoint = binaryReader.ReadBoolean(); if (hasInPoint) inPoint = binaryReader.ReadUInt32(); if (hasOutPoint) outPoint = binaryReader.ReadUInt32(); if (hasLoops) loopCount = binaryReader.ReadUInt16(); if (hasEnvelope) { byte envPoints = binaryReader.ReadByte(); if (envPoints != 0) { envelopeRecord.Clear(); for (int i = 0; i < envPoints; i++) { SoundEnvelope envelope = new SoundEnvelope(); envelope.ReadData(binaryReader); envelopeRecord.Add(envelope); } } } }
/// <summary> /// Removes the specified value. /// </summary> /// <param name="value">Value.</param> public void Remove(SoundEnvelope value) { if (List.Contains(value)) List.Remove(value as object); }
/// <summary> /// Inserts the specified index. /// </summary> /// <param name="index">Index.</param> /// <param name="value">Value.</param> public void Insert(int index, SoundEnvelope value) { List.Insert(index, value as object); }
/// <summary> /// Get the index of. /// </summary> /// <param name="value">Value.</param> /// <returns></returns> public int IndexOf(SoundEnvelope value) { return List.IndexOf(value); }
/// <summary> /// Containses the specified value. /// </summary> /// <param name="value">Value.</param> /// <returns></returns> public bool Contains(SoundEnvelope value) { return List.Contains(value as object); }
/// <summary> /// Adds the range. /// </summary> /// <param name="values">Values.</param> public void AddRange(SoundEnvelope[] values) { IEnumerator val = values.GetEnumerator(); while (val.MoveNext()) Add((SoundEnvelope)val.Current); }
/// <summary> /// Adds the specified value. /// </summary> /// <param name="value">Value.</param> /// <returns></returns> public SoundEnvelope Add(SoundEnvelope value) { List.Add(value as object); return value; }
/// <summary> /// Get the index of. /// </summary> /// <param name="value">Value.</param> /// <returns></returns> public int IndexOf(SoundEnvelope value) { return(List.IndexOf(value)); }
/// <summary> /// Containses the specified value. /// </summary> /// <param name="value">Value.</param> /// <returns></returns> public bool Contains(SoundEnvelope value) { return(List.Contains(value as object)); }
/// <summary> /// Inserts the specified index. /// </summary> /// <param name="index">Index.</param> /// <param name="value">Value.</param> public void Insert(int index, SoundEnvelope value) { List.Insert(index, value as object); }
/// <summary> /// Adds the specified value. /// </summary> /// <param name="value">Value.</param> /// <returns></returns> public SoundEnvelope Add(SoundEnvelope value) { List.Add(value as object); return(value); }