Ejemplo n.º 1
0
 /// <summary>
 /// 添加自定义音标
 /// </summary>
 /// <param name="word">文字</param>
 /// <param name="pinyin">拼音</param>
 /// <param name="tone">音标</param>
 public void AddCustomTone(string word, string pinyin, int tone)
 {
     if (_customTones.ContainsKey(word))
     {
         CustomTone ct = _customTones[word];
         ct.Word   = word;
         ct.Pinyin = pinyin;
         ct.Tone   = tone;
     }
     else
     {
         _customTones.Add(word, Main.m_ReferencePool.Spawn <CustomTone>().Fill(word, pinyin, tone));
     }
 }
Ejemplo n.º 2
0
 public static void PlaySound(CustomTone customTone)
 {
     try
     {
         if (string.IsNullOrEmpty(customTone.GetTonePath()))
         {
             return;
         }
         var audio = new SoundPlayer(customTone.GetTonePath());
         audio.Play();
     }
     catch (Exception exp)   //We have to catch the exception here, or the IDE can crash
     {
         System.Diagnostics.Debug.WriteLine(exp.StackTrace);
     }
 }
Ejemplo n.º 3
0
 public void AddCustomTone(CustomTone tone)
 {
     if (tone.ToneType == CustomToneType.Single)
     {
         // TODO
     }
     else if (tone.ToneType == CustomToneType.Dual)
     {
         Dialogic.AddDualTone(_devh, tone.Tid, tone.Freq1, tone.Frq1Dev, tone.Freq2, tone.Frq2Dev, tone.Mode);
     }
     else if (tone.ToneType == CustomToneType.DualWithCadence)
     {
         Dialogic.AddDualToneWithCadence(_devh, tone.Tid, tone.Freq1, tone.Frq1Dev, tone.Freq2, tone.Frq2Dev, tone.Ontime, tone.Ontdev, tone.Offtime,
                                         tone.Offtdev, tone.Repcnt);
     }
     Dialogic.DisableTone(_devh, tone.Tid);
 }
Ejemplo n.º 4
0
 public void AddTonalTalkPointToCurrentLine(CustomTone customTone, bool doesContinue)
 {
     try
     {
         var cursorPos = GetCurrentCursorPosition();
         var filePath  = GetActiveDocumentPath();
         //Toggling Talkpoint
         RemoveIfTalkpointsExists(filePath, cursorPos);
         if (CheckIfBreakpointExists(filePath, cursorPos))
         {
             RemoveBreakpoints(filePath, cursorPos);
             return;
         }
         Talkpoint talkpoint = new ToneTalkpoint(filePath, cursorPos, doesContinue, customTone);
         AddTalkPoint(talkpoint);
     }
     catch (Exception exp)   //We have to catch the exception here, or the IDE can crash
     {
         Debug.WriteLine(exp.StackTrace);
     }
 }
Ejemplo n.º 5
0
 public ToneTalkpoint(string filePath, CursorPos position, bool doesContinue, CustomTone customTone) : base(filePath, position, doesContinue)
 {
     this.customTalkpointTone = customTone;
     this.isCustomTone        = true;
 }