internal AssignedVoice(AvailableVoice r, int rate, int pitch) { root = r; rateModification = rate; pitchModification = pitch; this.Male = root.Male; }
internal AssignedVoice(AvailableVoice r, int rate, int pitch) { root = r; rateModification = rate; pitchModification = pitch; Male = root.Male; }
/// <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)); }
/// <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()); } }
public VoiceAssignment( PluginControl pc, string name, UUID id ) { control = pc; avatarName = name; avatarId = id; InitializeComponent(); control.talker.SayMore("Assign a voice for " + avatarName, BeepType.Open); // Inhibit demonstrations until constructore is done. doDemo = false; // Populate the fixed fields avName.Text = avatarName; library = control.talker.voices.voiceLibrary; foreach (string vname in library.Keys) { AvailableVoice v = library[vname]; voiceList.Items.Add(v.Name); } // Set the current name, if any. voiceList.ClearSelected(); voiceName = null; AssignedVoice av = null; // First check the assigned voices. av = control.talker.voices.VoiceFor( id, false ); // A voice has been assigned, so indicate that. if (av != null) { voiceName = av.root.Name; voice = library[voiceName]; rateSelector.SelectedIndex = av.rateModification + 1; pitchSelector.SelectedIndex = av.pitchModification + 1; SelectByName(voiceName); } doDemo = true; Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); }
/// <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); }
/// <summary> /// Respond to change in selected voice. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void voiceList_SelectedIndexChanged(object sender, EventArgs e) { if (voiceList.SelectedItem == null) return; voiceName = (string)voiceList.SelectedItem; voice = library[voiceName]; if (voice.Male) gender.Text = "M"; else gender.Text = "F"; // Reset the modifiers. rateModification = 0; pitchModification = 0; rateSelector.SelectedIndex = rateModification + 1; pitchSelector.SelectedIndex = pitchModification + 1; Demonstrate(); }