Exemplo n.º 1
0
        /// <summary>
        /// Turn an available voice into an assigned one by adding random variation
        /// </summary>
        /// <param name="v1"></param>
        /// <returns></returns>
        AssignedVoice AddVariation(AvailableVoice v1)
        {
            int rate  = GetRandom(2) - 1;
            int pitch = GetRandom(2) - 1;

            return(new AssignedVoice(v1, rate, pitch));
        }
Exemplo n.º 2
0
 internal AssignedVoice(AvailableVoice r, int rate, int pitch)
 {
     root              = r;
     rateModification  = rate;
     pitchModification = pitch;
     this.Male         = root.Male;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Choose a random voice constrained by gender.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        AssignedVoice PickRandomVoice(UUID id)
        {
            AvailableVoice chosen = null;

            // Get the avatar gender, if known.  If not known,
            // this is a 50/50 random guess.
            bool male = control.env.people.isMale(id);

            if (GenderAvailable(male))
            {
                if (male)
                {
                    chosen = maleVoiceLibrary[maleIndex[GetRandom(maleIndex.Length)]];
                }
                else
                {
                    chosen = femaleVoiceLibrary[femaleIndex[GetRandom(femaleIndex.Length)]];
                }

                return(AddVariation(chosen));
            }
            else
            {
                return(PickRandomVoice());
            }
        }