コード例 #1
0
 public virtual void PostStereo(string filename, SpeechAudioChannel channel, SpeechIdentifier.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (AppendStereo(filename, channel))
         {
             Post(callback);
         }
     }
 }
コード例 #2
0
 public virtual void Post(WaveStream stream, SpeechIdentifier.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (Append(stream))
         {
             Post(callback);
         }
     }
 }
コード例 #3
0
 public virtual void Post(string filename, SpeechIdentifier.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (Append(filename))
         {
             Post(callback);
         }
     }
 }
コード例 #4
0
        public override void Post(SpeechIdentifier.PostCallback callback)
        {
            if (IsSessionOpen && !IsSessionClosing)
            {
                IdentifyResults.Clear();

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

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

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

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

                    return;
                }
            }
            callback?.Invoke(IdentifyResult = SpeechIdentifier.Result.Invalid);
        }
コード例 #5
0
 public virtual void PostStereo(WaveStream stream, SpeechAudioChannel channel, SpeechIdentifier.PostCallback callback)
 {
     if (IsSessionOpen)
     {
         if (AppendStereo(stream, channel))
         {
             Post(callback);
         }
     }
 }
コード例 #6
0
 public abstract void Post(SpeechIdentifier.PostCallback callback);