Пример #1
0
        /// <summary>
        /// Handles the TTS-stream of a typed-text. Adds its phonemes to the
        /// 'Expected' list.
        /// </summary>
        /// <param name="StreamNumber"></param>
        /// <param name="StreamPosition"></param>
        /// <param name="Duration"></param>
        /// <param name="NextPhoneId"></param>
        /// <param name="Feature"></param>
        /// <param name="CurrentPhoneId"></param>
        void tts_Phoneme(int StreamNumber,
                         object StreamPosition,
                         int Duration,
                         short NextPhoneId,
                         SpeechVisemeFeature Feature,
                         short CurrentPhoneId)
        {
#if DEBUG
            string ttsinfo = "tts_Phoneme() #" + StreamNumber + " StreamPosition= " + StreamPosition + " PhoneId= " + CurrentPhoneId;
#endif
            if (CurrentPhoneId > 9)             // NOTE: This causes signifiers like silence #7 "_" and nasalvowel #9 "~" to bypass.
            {
                string phon = _phoneConverter.IdToPhone(CurrentPhoneId);
#if DEBUG
                logfile.Log(ttsinfo + " - " + phon);
                logfile.Log(". ADD to Expected");
#endif
                Expected.Add(phon);
            }
#if DEBUG
            else
            {
                logfile.Log(ttsinfo + " - " + _phoneConverter.IdToPhone(CurrentPhoneId));
                logfile.Log(". BYPASS Expected");
            }
            logfile.Log(". Duration= " + Duration);
            logfile.Log(". Feature= " + Feature);
            logfile.Log(". NextPhoneId= " + NextPhoneId);
            logfile.Log(". nextphone= " + _phoneConverter.IdToPhone(NextPhoneId));               // iffy. Can fail silently.
#endif
        }
        void voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
        {
            if (lastVisemeId!=(int)CurrentVisemeId)
                visemes.Add(new Viseme(lastVisemeId = (int)CurrentVisemeId, (int)((Decimal)StreamPosition)));

            //Console.WriteLine(string.Format("Viseme event received: {0} {1} {2} {3} {4} {5}", i, o, i2, t, f, t2));
        }
 void voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
 {
     if (lastVisemeId != (int)CurrentVisemeId)
     {
         visemes.Add(new Viseme(lastVisemeId = (int)CurrentVisemeId, (int)((Decimal)StreamPosition)));
     }
     //Console.WriteLine(string.Format("Viseme event received: {0} {1} {2} {3} {4} {5}", i, o, i2, t, f, t2));
 }
Пример #4
0
 protected void spVoice_Viseme(int streamNumber, object streamPosition, int duration, SpeechVisemeType nextViseme, SpeechVisemeFeature feature, SpeechVisemeType currentViseme)
 {
     if (VisemeUpdated != null)
     {
         var msg = new StringMessageEventArgs();
         msg.Message = Convert.ToInt32(currentViseme).ToString() + "," + duration.ToString();
         VisemeUpdated(this, msg);
     }
 }
Пример #5
0
 void voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
 {
     conductor.SetState(conductor.CreateStateFromViseme((int)CurrentVisemeId));
 }
Пример #6
0
 void voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
 {
     conductor.SetState(conductor.CreateStateFromViseme((int)CurrentVisemeId));
 }
Пример #7
0
        private void Voice_Viseme(int StreamNumber, object StreamPosition, int Duration, SpeechVisemeType NextVisemeId, SpeechVisemeFeature Feature, SpeechVisemeType CurrentVisemeId)
        {
            if (ShowAllEventsCheck.Checked)
            {
                AddEventMessage("Viseme: Duration = " + Duration.ToString() +
                                ", NextVisemeId = " + NextVisemeId.ToString() +
                                ", Feature = " + Feature.ToString() +
                                ", CurrentVisemeId = " + CurrentVisemeId.ToString());
            }

            // Show some mouth animation, though this is not
            // really accurate.
            int[]    visemeMap = { 0, 11, 11, 11, 10, 11, 9, 2, 13, 9, 12, 11, 9, 3, 6, 7, 8, 5, 4, 7, 9, 1 };
            int      index;
            Graphics g = Graphics.FromImage(MouthPicture.Image);

            g.Clear(Color.Transparent);
            g.DrawImage(MicImages.Images[0], new Point(0, 0));
            index = visemeMap[Convert.ToInt32(CurrentVisemeId)];
            g.DrawImage(MicImages.Images[index], new Point(0, 0));
            if (index % 6 == 2)
            {
                g.DrawImage(MicImages.Images[14], new Point(0, 0));
            }
            if (index % 6 == 5)
            {
                g.DrawImage(MicImages.Images[13], new Point(0, 0));
            }
            MouthPicture.Invalidate();
        }
Пример #8
0
 private void Voice_Phoneme(int StreamNumber, object StreamPosition, int Duration, short NextPhoneId, SpeechVisemeFeature Feature, short CurrentPhoneId)
 {
     if (ShowAllEventsCheck.Checked)
     {
         AddEventMessage("Phoneme: Duration = " + Duration.ToString() +
                         ", NextPhoneId = " + NextPhoneId.ToString() +
                         ", CurrentPhoneId = " + CurrentPhoneId.ToString() +
                         ", Feature = " + Feature.ToString());
     }
 }