public override int FromPacketToAudioDataInt16(BytePacket packet, ref VoicePacketInfo info, byte[] out_audioData, int out_audioDataOffset) { int dataCount = Mathf.Min(packet.CurrentLength - packet.CurrentSeek, out_audioData.Length - out_audioDataOffset); packet.ReadByteData(out_audioData, out_audioDataOffset, dataCount); FromPacketToAudioInt16 = true; if (UseInfo) { info = this.Info; } return(dataCount); }
/// <summary> /// Processes a Gamepacket into audio data in format Int16 /// </summary> /// <param name="packet">GamePacket to process</param> /// <param name="info">data info</param> /// <param name="out_audioData">output array on which data will be written</param> /// <param name="out_audioDataOffset">output array start index</param> /// <returns>total number of bytes written</returns> public override int FromPacketToAudioDataInt16(BytePacket packet, ref VoicePacketInfo info, byte[] out_audioData, int out_audioDataOffset) { int maxP = packet.CurrentLength - packet.CurrentSeek - sizeof(int); int dataCount = Mathf.Min(Mathf.Min(packet.ReadInt(), out_audioData.Length - out_audioDataOffset), maxP); if (dataCount <= 0) { info.ValidPacketInfo = false; return(dataCount); } packet.ReadByteData(out_audioData, out_audioDataOffset, dataCount); return(dataCount); }