private void ReadChunk(AByteArray aByteArray) { string lId = aByteArray.ReadString(4); UInt32 lSize = aByteArray.ReadUInt32(); int lPositionStart = aByteArray.Position; // Check Padding. if (lSize % 2 == 1) { if (lPositionStart + lSize <= aByteArray.Length && aByteArray.ReadByte(( int )(lPositionStart + lSize)) == 0x00) { lSize++; Logger.Debug("Padding:" + lSize); } else { Logger.Debug("No Padding:" + lSize); } aByteArray.SetPosition(lPositionStart); } FormChunk lRiffWave = Construct(lId, lSize, aByteArray, this); chunkList.Add(lRiffWave); if (aByteArray.Position != lPositionStart + lSize) { Logger.Debug("Modify Position:" + aByteArray.Position + "->" + (lPositionStart + lSize)); aByteArray.SetPosition(( int )(lPositionStart + lSize)); } }
public RiffDls_Data(string aId, UInt32 aSize, AByteArray aByteArray, RiffChunkList aParent) : base(aId, aSize, aByteArray, aParent) { informationList.Add("Sample Array:" + position); aByteArray.SetPosition(( int )(position + Size)); }
public virtual void WriteByteArray(AByteArray aByteArrayRead, AByteArray aByteArray) { for (int i = 0; i < id.Length; i++) { aByteArray.WriteUByte(( Byte )id[i]); } aByteArray.WriteUInt32(( UInt32 )Size); aByteArrayRead.SetPosition(( int )position); aByteArray.WriteBytes(aByteArrayRead.ReadBytes(Size)); }
private void ReadSampleArray24(AByteArray aByteArray, int aBasePosition) { aByteArray.SetPosition(aBasePosition); for (int i = 0; i < format.samples; i++) { for (int j = 0; j < format.channels; j++) { Int32 lSample = aByteArray.ReadInt24(); sampleByteArray[j][i] = ( sbyte )(lSample >> 16); } } }
private void ReadSampleArray24(AByteArray aByteArray, int aPositionSample) { aByteArray.SetPosition(basePosition + 3 * format.channels * aPositionSample); for (int i = 0; i < bufferLength && i < format.samples - aPositionSample; i++) { for (int j = 0; j < format.channels; j++) { Int32 lSample = aByteArray.ReadInt24(); sampleArray[j][i] = ( float )lSample / ( float )Int24.MaxValue; } } }
public RiffDls_Fmt_(string aId, UInt32 aSize, AByteArray aByteArray, RiffChunkList aParent) : base(aId, aSize, aByteArray, aParent) { tag = aByteArray.ReadUInt16(); channles = aByteArray.ReadUInt16(); samplesPerSec = aByteArray.ReadUInt32(); averageBytesPerSec = aByteArray.ReadUInt32(); blockAlign = aByteArray.ReadUInt16(); bitsPerSample = aByteArray.ReadUInt16(); informationList.Add("Tag:" + tag); informationList.Add("Channels:" + channles); informationList.Add("Samples Per Sec:" + samplesPerSec); informationList.Add("Average Bytes Per Sec:" + averageBytesPerSec); informationList.Add("Block Align:" + blockAlign); informationList.Add("Bits Per Sample:" + bitsPerSample); aByteArray.SetPosition(( int )(position + Size)); }
protected FormChunkList(string aId, UInt32 aSize, AByteArray aByteArray, FormChunkList aParent) : base(aId, aSize, aByteArray, aParent) { chunkList = new List <FormChunk>(); listListDictionary = new Dictionary <string, List <FormChunkList> >(); type = aByteArray.ReadString(4); try { while (aByteArray.Position < position + aSize) { ReadChunk(aByteArray); } } catch (Exception aExpection) { Logger.Error("Expection at Form Read:" + aExpection.ToString()); } aByteArray.SetPosition(( int )(position + aSize)); }