Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InputTextToSpeech" /> class.
 /// </summary>
 /// <param name="text">Text to convert (10,000 characters max) (required).</param>
 /// <param name="type">Text or file type (required) (default to TypeEnum.PlainText).</param>
 /// <param name="voice">Voice locale (must match language of input text) (required) (default to VoiceEnum.EnUSAriaFemale).</param>
 public InputTextToSpeech(string text = default(string), TypeEnum type = TypeEnum.PlainText, VoiceEnum voice = VoiceEnum.EnUSAriaFemale)
 {
     // to ensure "text" is required (not null)
     this.Text  = text ?? throw new ArgumentNullException("text is a required property for InputTextToSpeech and cannot be null");
     this.Type  = type;
     this.Voice = voice;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="InputTextToSpeech" /> class.
        /// </summary>
        /// <param name="text">Text to convert (10,000 characters max) (required).</param>
        /// <param name="type">Text or file type (required) (default to TypeEnum.PlainText).</param>
        /// <param name="voice">Voice locale (must match language of input text) (required) (default to VoiceEnum.EnUSAriaFemale).</param>
        public InputTextToSpeech(string text = default(string), TypeEnum type = TypeEnum.PlainText, VoiceEnum voice = VoiceEnum.EnUSAriaFemale)
        {
            // to ensure "text" is required (not null)
            if (text == null)
            {
                throw new InvalidDataException("text is a required property for InputTextToSpeech and cannot be null");
            }
            else
            {
                this.Text = text;
            }

            // to ensure "type" is required (not null)
            if (type == null)
            {
                throw new InvalidDataException("type is a required property for InputTextToSpeech and cannot be null");
            }
            else
            {
                this.Type = type;
            }

            // to ensure "voice" is required (not null)
            if (voice == null)
            {
                throw new InvalidDataException("voice is a required property for InputTextToSpeech and cannot be null");
            }
            else
            {
                this.Voice = voice;
            }
        }
Beispiel #3
0
 public void Play(VoiceEnum name)
 {
     if (!_audioDic[name].isPlaying)
     {
         _audioDic[name].Play();
     }
 }
Beispiel #4
0
    private IEnumerator _Play(VoiceEnum name, float delay)
    {
        if (!_audioDic[name].isPlaying)
        {
            yield return(new WaitForSeconds(delay));

            _audioDic[name].Play();
        }
    }
Beispiel #5
0
 public void Stop(VoiceEnum name)
 {
     _audioDic[name].Stop();
 }
Beispiel #6
0
 public void PlayOneShot(VoiceEnum name)
 {
     _audioDic[name].PlayOneShot(_audioDic[name].clip);
 }
Beispiel #7
0
 public void Play(VoiceEnum name, float delay)
 {
     StartCoroutine(_Play(name, delay));
 }