public TargettedSpeech(bool stop = true) { IsStop = stop; PcmData = null; Target = SpeechTarget.Normal; TargetId = 0; }
/// <summary> /// Add some raw PCM data to the buffer to send /// </summary> /// <param name="pcm"></param> /// <param name="target"></param> /// <param name="targetId"></param> public void Add(PcmArray pcm, SpeechTarget target, uint targetId) { lock (_unencodedBuffer) { _unencodedBuffer.Enqueue(new TargettedSpeech(pcm, target, targetId)); } }
public override void EncodedVoice(byte[] data, uint userId, long sequence, IVoiceCodec codec, SpeechTarget target) { User user = Users.FirstOrDefault(u => u.Id == userId); if (user != null) Console.WriteLine(user.Name + " is speaking. Seq" + sequence); base.EncodedVoice(data, userId, sequence, codec, target); }
public TargettedSpeech(bool stop = true) { IsStop = stop; Pcm = default(ArraySegment <byte>); Target = SpeechTarget.Normal; TargetId = 0; }
public TargettedSpeech(PcmArray pcm, SpeechTarget target, uint targetId) { TargetId = targetId; Target = target; PcmData = pcm; IsStop = false; }
/// <summary> /// Add some raw PCM data to the buffer to send /// </summary> /// <param name="pcm"></param> /// <param name="target"></param> /// <param name="targetId"></param> public void Add(PcmArray pcm, SpeechTarget target, uint targetId) { lock (_bufferLock) { _unencodedBuffer.Enqueue(new TargettedSpeech(pcm, target, targetId)); Monitor.Pulse(_bufferLock); } }
public TargettedSpeech(ArraySegment <byte> pcm, SpeechTarget target, uint targetId) { TargetId = targetId; Target = target; Pcm = pcm; IsStop = false; }
public void SendVoice(ArraySegment <byte> buffer, SpeechTarget target = SpeechTarget.Normal) { Owner.SendVoice( buffer, target: target, targetId: Id ); }
public void SendVoice(PcmArray pcm, SpeechTarget target, uint targetId) { _encodingBuffer.Add(pcm, target, targetId); if (!_encodingThread.IsAlive) { _encodingThread.Start(); } }
public void SendVoice(ArraySegment <byte> pcm, SpeechTarget target, uint targetId) { if (!Connection.VoiceSupportEnabled) { throw new InvalidOperationException("Voice Support is disabled with this connection"); } _encodingBuffer.Add(pcm, target, targetId); }
public void SendVoice(PcmArray pcm, SpeechTarget target, uint targetId) { _encodingBuffer.Add(pcm, target, targetId); if (_encodingThread == null) { _encodingThread = new Thread(EncodingThreadEntry) { IsBackground = true }; _encodingThread.Start(); } }
private bool TryAddToEncodingBuffer(TargettedSpeech t, out bool stopped) { if (t.IsStop) { stopped = true; return(false); } stopped = false; if (!(_pcmBuffer.Count == 0 || (_target == t.Target && _targetId == t.TargetId))) { return(false); } _pcmBuffer.Write(t.Pcm); _target = t.Target; _targetId = t.TargetId; return(true); }
public void SendVoice(ArraySegment<byte> pcm, SpeechTarget target, uint targetId) { _encodingBuffer.Add(pcm, target, targetId); }
/// <summary> /// Received a voice packet from the server /// </summary> /// <param name="data"></param> /// <param name="userId"></param> /// <param name="sequence"></param> /// <param name="codec"></param> /// <param name="target"></param> public virtual void EncodedVoice(byte[] data, uint userId, long sequence, IVoiceCodec codec, SpeechTarget target) { User user; if (!UserDictionary.TryGetValue(userId, out user)) return; user.ReceiveEncodedVoice(data, sequence, codec); }
public override void EncodedVoice(byte[] data, uint userId, long sequence, IVoiceCodec codec, SpeechTarget target) { User user = Users.FirstOrDefault(u => u.Id == userId); if (user != null) { Console.WriteLine(user.Name + " is speaking. Seq" + sequence); } base.EncodedVoice(data, userId, sequence, codec, target); }
/// <summary> /// Received a voice packet from the server /// </summary> /// <param name="data"></param> /// <param name="userId"></param> /// <param name="sequence"></param> /// <param name="codec"></param> /// <param name="target"></param> public virtual void EncodedVoice(byte[] data, uint userId, long sequence, IVoiceCodec codec, SpeechTarget target) { User user; if (!UserDictionary.TryGetValue(userId, out user)) { return; } user.ReceiveEncodedVoice(data, sequence, codec); }
public void SendVoice(ArraySegment <byte> pcm, SpeechTarget target, uint targetId) { _encodingBuffer.Add(pcm, target, targetId); }
/// <summary> /// Add some raw PCM data to the buffer to send /// </summary> /// <param name="pcm"></param> /// <param name="target"></param> /// <param name="targetId"></param> public void Add(ArraySegment<byte> pcm, SpeechTarget target, uint targetId) { _unencodedBuffer.Add(new TargettedSpeech(pcm, target, targetId)); }
public TargettedSpeech(ArraySegment<byte> pcm, SpeechTarget target, uint targetId) { TargetId = targetId; Target = target; Pcm = pcm; IsStop = false; }
public TargettedSpeech(bool stop = true) { IsStop = stop; Pcm = default(ArraySegment<byte>); Target = SpeechTarget.Normal; TargetId = 0; }
private bool TryAddToEncodingBuffer(TargettedSpeech t, out bool stopped) { if (t.IsStop) { stopped = true; return false; } stopped = false; if (!(_pcmBuffer.Count == 0 || (_target == t.Target && _targetId == t.TargetId))) return false; _pcmBuffer.Write(t.Pcm); _target = t.Target; _targetId = t.TargetId; return true; }
public new void SendVoice(ArraySegment <byte> pcm, SpeechTarget target, uint targetId) { base.SendVoice(pcm, target, targetId); }
public void SendVoice(PcmArray pcm, SpeechTarget target, uint targetId) { _stopSendingRequested = false; _encodingBuffer.Add(pcm, target, targetId); _waitHandle.Set(); }
/// <summary> /// Received a voice packet from the server /// </summary> /// <param name="data"></param> /// <param name="userId"></param> /// <param name="sequence"></param> /// <param name="codec"></param> /// <param name="target"></param> public virtual void EncodedVoice(byte[] data, uint userId, long sequence, IVoiceCodec codec, SpeechTarget target) { if (!Connection.VoiceSupportEnabled) { throw new InvalidOperationException("Voice Support is disabled with this connection"); } User user; if (!UserDictionary.TryGetValue(userId, out user)) { return; } user.ReceiveEncodedVoice(data, sequence, codec); }
public new void SendVoice(ArraySegment<byte> pcm, SpeechTarget target, uint targetId) { base.SendVoice(pcm,target,targetId); }
/// <summary> /// Add some raw PCM data to the buffer to send /// </summary> /// <param name="pcm"></param> /// <param name="target"></param> /// <param name="targetId"></param> public void Add(ArraySegment <byte> pcm, SpeechTarget target, uint targetId) { _unencodedBuffer.Add(new TargettedSpeech(pcm, target, targetId)); }
public EncodedTargettedSpeech(byte[] encodedPcm, SpeechTarget target, uint targetId) { TargetId = targetId; Target = target; EncodedPcm = encodedPcm; }