public virtual void PostStereo(string filename, SpeechAudioChannel channel, SpeechEnroller.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (AppendStereo(filename, channel))
         {
             Post(callback);
         }
     }
 }
 public virtual void Post(WaveStream stream, SpeechEnroller.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (Append(stream))
         {
             Post(callback);
         }
     }
 }
 public virtual void Post(string filename, SpeechEnroller.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (Append(filename))
         {
             Post(callback);
         }
     }
 }
Пример #4
0
        public override void Post(SpeechEnroller.PostCallback callback)
        {
            if (IsSessionOpen && !IsSessionClosing)
            {
                EnrollResults.Clear();

                Uri uri = Configuration.Server.BuildEndpoint(URI_PATH_PROCESS);

                Logger?.LogDebug("SpeechEnroller_HttpClient_Version1.Post(callback): URI: " + uri.ToString());

                using (var request = BuildRequest(CallMode.Process, uri))
                {
                    var task = mHttpClient.SendAsync(request).ContinueWith((requestTask) => {
                        if (requestTask.IsFaulted)
                        {
                            EnrollResult = SpeechEnroller.Result.Timeout;
                            Logger?.LogError(requestTask.Exception);
                            callback?.Invoke(EnrollResult);
                            return;
                        }
                        HandleResponse(CallMode.Process, request, requestTask.Result).ContinueWith((responseTask) => {
                            if (responseTask.IsFaulted)
                            {
                                EnrollResult = SpeechEnroller.Result.Timeout;
                                Logger?.LogError(responseTask.Exception);
                                callback?.Invoke(EnrollResult);
                                return;
                            }
                            callback?.Invoke(EnrollResult);
                        });
                    });

                    if (task.IsFaulted)
                    {
                        EnrollResult = SpeechEnroller.Result.Timeout;
                        Logger?.LogError(task.Exception);
                        callback?.Invoke(EnrollResult);
                    }

                    return;
                }
            }
            callback?.Invoke(EnrollResult = SpeechEnroller.Result.Invalid);
        }
 public virtual void PostStereo(WaveStream stream, SpeechAudioChannel channel, SpeechEnroller.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (AppendStereo(stream, channel))
         {
             Post(callback);
         }
     }
 }
 public abstract void Post(SpeechEnroller.PostCallback callback);