public void ProcessText(string text, object voice, ref FragmentState fragmentState, int position, bool fIgnore)
        {
            if (!fIgnore)
            {
                TtsEngineAction action = fragmentState.Action;
                if (_paragraphStarted)
                {
                    fragmentState.Action = TtsEngineAction.StartParagraph;
                    _speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState));
                    _paragraphStarted = false;

                    // Always add the start sentence.
                    _sentenceStarted = true;
                }
                if (_sentenceStarted)
                {
                    fragmentState.Action = TtsEngineAction.StartSentence;
                    _speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState));
                    _sentenceStarted = false;
                }
                fragmentState.Action = ActionTextFragment(action);
                _speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState, text, _ssmlText, position, text.Length));
                fragmentState.Action = action;
            }
        }
        private void AddParseUnknownFragment(object voice, ref FragmentState fragmentState, string text)
        {
            TtsEngineAction action = fragmentState.Action;

            fragmentState.Action = TtsEngineAction.ParseUnknownTag;
            _speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState, text));
            fragmentState.Action = action;
        }
 public void ProcessBreak(object voice, ref FragmentState fragmentState, EmphasisBreak eBreak, int time, bool fIgnore)
 {
     if (!fIgnore)
     {
         TtsEngineAction action = fragmentState.Action;
         fragmentState.Action = ActionTextFragment(fragmentState.Action);
         _speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState));
         fragmentState.Action = action;
     }
 }
 public void ProcessMark(object voice, ref FragmentState fragmentState, string name, bool fIgnore)
 {
     if (!fIgnore)
     {
         TtsEngineAction action = fragmentState.Action;
         fragmentState.Action = ActionTextFragment(fragmentState.Action);
         _speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState, name));
         fragmentState.Action = action;
     }
 }
 public FragmentState(TtsEngineAction action, int langId, int emphasis, int duration, SayAs sayAs, Prosody prosody, char[] phonemes)
 {
     _action   = action;
     _langId   = langId;
     _emphasis = emphasis;
     _duration = duration;
     _sayAs    = sayAs;
     _prosody  = prosody;
     _phoneme  = phonemes;
 }
 internal void FragmentStateToPtr(FragmentState state, Collection <IntPtr> memoryBlocks)
 {
     _action   = state.Action;
     _langId   = state.LangId;
     _emphasis = state.Emphasis;
     _duration = state.Duration;
     if (state.SayAs != null)
     {
         _sayAs = Marshal.AllocCoTaskMem(Marshal.SizeOf((object)state.SayAs));
         memoryBlocks.Add(_sayAs);
         Marshal.StructureToPtr((object)state.SayAs, _sayAs, false);
     }
     else
     {
         _sayAs = IntPtr.Zero;
     }
     if (state.Phoneme != null)
     {
         short[] array = new short[state.Phoneme.Length + 1];
         for (uint num = 0u; num < state.Phoneme.Length; num++)
         {
             array[num] = (short)state.Phoneme[num];
         }
         array[state.Phoneme.Length] = 0;
         int num2 = Marshal.SizeOf((object)array[0]);
         _phoneme = Marshal.AllocCoTaskMem(num2 * array.Length);
         memoryBlocks.Add(_phoneme);
         for (uint num3 = 0u; num3 < array.Length; num3++)
         {
             Marshal.Copy(array, 0, _phoneme, array.Length);
         }
     }
     else
     {
         _phoneme = IntPtr.Zero;
     }
     _prosody = ProsodyInterop.ProsodyToPtr(state.Prosody, memoryBlocks);
 }
 private static TtsEngineAction ActionTextFragment(TtsEngineAction action)
 {
     return(action);
 }