/// <summary> /// Hello. /// </summary> /// <param name="aBuffer">Buffer.</param> public void Transcribe(UnmixedAudioBuffer aBuffer) { try { if (aBuffer.OriginalSenderTimestamp >= 0 && aBuffer.Length > 0) { long lKey = aBuffer.OriginalSenderTimestamp; // Start recognition if needed this.StartRecognisionIfNeeded(); byte[] managedArray = new byte[aBuffer.Length]; var handler = aBuffer.Data; int start = 0; int length = (int)aBuffer.Length; Marshal.Copy(handler, managedArray, start, length); // Write to stream this.mInputStream.Write(managedArray); } } catch (Exception ex) { // TODO throw ex; } }
/// <summary> /// Initializes a new instance of the <see cref="SerializableUnmixedAudioBuffer" /> class. /// </summary> /// <param name="buffer">The buffer.</param> /// <param name="participant">The participant.</param> public SerializableUnmixedAudioBuffer(UnmixedAudioBuffer buffer, IParticipant participant) { ActiveSpeakerId = buffer.ActiveSpeakerId; Length = buffer.Length; OriginalSenderTimestamp = buffer.OriginalSenderTimestamp; var i = AddParticipant(participant); if (i != null) { DisplayName = i.DisplayName; AdId = i.Id; } else { DisplayName = participant?.Resource?.Info?.Identity?.User?.DisplayName; AdId = participant?.Resource?.Info?.Identity?.User?.Id; AdditionalData = participant?.Resource?.Info?.Identity?.User?.AdditionalData; } Buffer = new byte[Length]; Marshal.Copy(buffer.Data, Buffer, 0, (int)Length); }