/// <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)); }
internal AssignedVoice(AvailableVoice r, int rate, int pitch) { root = r; rateModification = rate; pitchModification = pitch; this.Male = root.Male; }
/// <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()); } }