Ejemplo n.º 1
0
 private void Run()
 {
     FillQueue();
     setFinishedPlayingCallback(syncCallbackInstance);
     try
     {
         QueuedElement first = queue.Dequeue();
         if (first.Type == QueuedElement.types.phoneme || first.Type == QueuedElement.types.start)
         {
             Instance.PlayPhoneme(first.Symbol);
             while (true)
             {
                 ;
             }
         }
         else
         {
             Instance.internalSentencePlaybackCallback.Invoke(TapsError.TapsInvalidFirstElementInSentence);
             return;
         }
     }
     catch (InvalidOperationException emptyException)
     {
         Instance.internalSentencePlaybackCallback.Invoke(TapsError.TapsEmptyQueueSentence);
         return;
     }
 }
Ejemplo n.º 2
0
 private void CallbackHandler(int result)
 {
     if (result == 0)
     {
         phonemesPlayed++;
         try
         {
             QueuedElement element = queue.Dequeue();
             if (element.Type == QueuedElement.types.phoneme)
             {
                 Thread.Sleep(ICI);
                 if (phonemesPlayed == 1 && StartFlag)
                 {
                     OptionalStartFlagCallback?.Invoke();
                 }
                 Instance.PlayPhoneme(element.Symbol);
             }
             else
             {
                 Thread.Sleep(IWI);
                 CallbackHandler(0);
             }
         }
         catch (InvalidOperationException emptyException)
         {
             setFinishedPlayingCallback(previousCallback);
             Instance.internalSentencePlaybackCallback.Invoke(TapsError.TapsNoError);
             _thread?.Abort();
         }
     }
     else
     {
         setFinishedPlayingCallback(previousCallback);
         Instance.internalSentencePlaybackCallback.Invoke(TapsError.TapsInternalPhonemePlayingError);
         _thread?.Abort();
     }
 }