コード例 #1
0
 internal LocalVoiceAudioShort(VoiceClient voiceClient, IEncoderDataFlow <short> encoder, byte id, VoiceInfo voiceInfo, int channelId)
     : base(voiceClient, encoder, id, voiceInfo, channelId)
 {
     // these 2 processors go after resampler
     this.levelMeter    = new AudioUtil.LevelMeterShort(this.info.SamplingRate, this.info.Channels); //1/2 sec
     this.voiceDetector = new AudioUtil.VoiceDetectorShort(this.info.SamplingRate, this.info.Channels);
     initBuiltinProcessors();
 }
コード例 #2
0
 internal LocalVoiceAudio(VoiceClient voiceClient, IEncoderDataFlow <T> encoder, byte id, VoiceInfo voiceInfo, int channelId)
     : base(voiceClient, encoder, id, voiceInfo, channelId,
            voiceInfo.SamplingRate != 0 ? voiceInfo.FrameSize * voiceInfo.SourceSamplingRate / voiceInfo.SamplingRate : voiceInfo.FrameSize
            )
 {
     this.channels             = voiceInfo.Channels;
     this.sourceSamplingRateHz = voiceInfo.SourceSamplingRate;
     if (this.sourceSamplingRateHz != voiceInfo.SamplingRate)
     {
         this.resampleSource = true;
         this.voiceClient.transport.LogWarning("[PV] Local voice #" + this.id + " audio source frequency " + this.sourceSamplingRateHz + " and encoder sampling rate " + voiceInfo.SamplingRate + " do not match. Resampling will occur before encoding.");
     }
 }
コード例 #3
0
ファイル: VoiceClient.cs プロジェクト: bitvalser/VoiceChat
 /// <summary>
 /// Creates outgoing audio stream. Adds audio specific features (e.g. resampling, level meter) to processing pipeline and to returning stream handler.
 /// </summary>
 /// <typeparam name="T">Element type of audio array buffers.</typeparam>
 /// <param name="voiceInfo">Outgoing audio stream parameters. Set applicable fields to read them by encoder and by receiving client when voice created.</param>
 /// <param name="channelId">Transport channel specific to frontend. Set to VoiceClient.ChannelAuto to let frontend automatically assign channel.</param>
 /// <param name="encoder">Audio encoder. Set to null to use default Opus encoder.</param>
 /// <returns>Outgoing stream handler.</returns>
 /// <remarks>
 /// voiceInfo.sourceSamplingRate and voiceInfo.SamplingRate may do not match. Automatic resampling will occur in this case.
 /// </remarks>
 public LocalVoiceAudio <T> CreateLocalVoiceAudio <T>(VoiceInfo voiceInfo, int channelId = ChannelAuto, IEncoderDataFlow <T> encoder = null)
 {
     return((LocalVoiceAudio <T>)createLocalVoice(voiceInfo, channelId, encoder, (vId, chId) => LocalVoiceAudio.Create <T>(this, vId, encoder, voiceInfo, chId)));
 }
コード例 #4
0
ファイル: VoiceClient.cs プロジェクト: bitvalser/VoiceChat
 /// <summary>
 /// Creates outgoing stream consuming sequence of values passed in array buffers of arbitrary length which repacked in frames of constant length for further processing and encoding.
 /// </summary>
 /// <typeparam name="T">Type of data consumed by outgoing stream (element type of array buffers).</typeparam>
 /// <param name="voiceInfo">Outgoing stream parameters. Set applicable fields to read them by encoder and by receiving client when voice created.</param>
 /// <param name="channelId">Transport channel specific to frontend. Set to VoiceClient.ChannelAuto to let frontend automatically assign channel.</param>
 /// <param name="encoder">Encoder compressing data stream in pipeline.</param>
 /// <returns>Outgoing stream handler.</returns>
 public LocalVoiceFramed <T> CreateLocalVoiceFramed <T>(VoiceInfo voiceInfo, int frameSize, int channelId = ChannelAuto, IEncoderDataFlow <T> encoder = null)
 {
     return((LocalVoiceFramed <T>)createLocalVoice(voiceInfo, channelId, encoder, (vId, chId) => new LocalVoiceFramed <T>(this, encoder, vId, voiceInfo, chId, frameSize)));
 }