Esempio n. 1
0
        public static XEFAudioSubframe FromReader(BinaryReader reader)
        {
            XEFAudioSubframe audioSubframe = new XEFAudioSubframe();

            audioSubframe.SubFrameNumber         = reader.ReadUInt32();
            audioSubframe.EventBitField          = reader.ReadUInt32();
            audioSubframe.TimeCounter            = reader.ReadUInt64();
            audioSubframe.BeamMode               = reader.ReadInt32();
            audioSubframe.BeamAngle              = reader.ReadSingle();
            audioSubframe.BeamAngleConfidence    = reader.ReadSingle();
            audioSubframe.SpeakerTrackingIdCount = reader.ReadUInt32();

            for (int j = 0; j < audioSubframe.SpeakerTrackingIds.Length; j++)
            {
                audioSubframe.SpeakerTrackingIds[j] = reader.ReadUInt64();
            }

            for (int j = 0; j < audioSubframe.OutBuffer.Length; j++)
            {
                audioSubframe.OutBuffer[j] = reader.ReadSingle();
            }

            for (int j = 0; j < audioSubframe.MicBuffer.Length; j++)
            {
                audioSubframe.MicBuffer[j] = reader.ReadSingle();
            }

            for (int j = 0; j < audioSubframe.SpkBuffer.Length; j++)
            {
                audioSubframe.SpkBuffer[j] = reader.ReadSingle();
            }

            for (int j = 0; j < audioSubframe.ReservedByteArray.Length; j++)
            {
                audioSubframe.ReservedByteArray[j] = reader.ReadByte();
            }

            return(audioSubframe);
        }
Esempio n. 2
0
        public static XEFAudioFrame FromByteArray(byte[] data)
        {
            XEFAudioFrame audioData = new XEFAudioFrame();

            using (MemoryStream stream = new MemoryStream(data))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    audioData.Version            = reader.ReadUInt32();
                    audioData.SubFrameCount      = reader.ReadUInt32();
                    audioData.SubFramesAllocated = reader.ReadUInt32();
                    audioData.Reserved           = reader.ReadUInt32();

                    Debug.Assert(audioData.SubFrameCount == audioData.SubFramesAllocated);
                    audioData.SubFrames = new XEFAudioSubframe[audioData.SubFrameCount];

                    for (int i = 0; i < audioData.SubFrameCount; i++)
                    {
                        audioData.SubFrames[i] = XEFAudioSubframe.FromReader(reader);
                    }
                }
            }
            return(audioData);
        }