Voicepublic class Voice extends Object implements android.os.ParcelableCharacteristics and features of a Text-To-Speech Voice. Each TTS Engine can expose
multiple voices for each locale, with different set of features. |
Fields Summary |
---|
public static final int | QUALITY_VERY_LOWVery low, but still intelligible quality of speech synthesis | public static final int | QUALITY_LOWLow, not human-like quality of speech synthesis | public static final int | QUALITY_NORMALNormal quality of speech synthesis | public static final int | QUALITY_HIGHHigh, human-like quality of speech synthesis | public static final int | QUALITY_VERY_HIGHVery high, almost human-indistinguishable quality of speech synthesis | public static final int | LATENCY_VERY_LOWVery low expected synthesizer latency (< 20ms) | public static final int | LATENCY_LOWLow expected synthesizer latency (~20ms) | public static final int | LATENCY_NORMALNormal expected synthesizer latency (~50ms) | public static final int | LATENCY_HIGHNetwork based expected synthesizer latency (~200ms) | public static final int | LATENCY_VERY_HIGHVery slow network based expected synthesizer latency (> 200ms) | private final String | mName | private final Locale | mLocale | private final int | mQuality | private final int | mLatency | private final boolean | mRequiresNetworkConnection | private final Set | mFeatures | public static final Parcelable.Creator | CREATOR |
Constructors Summary |
---|
public Voice(String name, Locale locale, int quality, int latency, boolean requiresNetworkConnection, Set features)
this.mName = name;
this.mLocale = locale;
this.mQuality = quality;
this.mLatency = latency;
this.mRequiresNetworkConnection = requiresNetworkConnection;
this.mFeatures = features;
| private Voice(android.os.Parcel in)
this.mName = in.readString();
this.mLocale = (Locale)in.readSerializable();
this.mQuality = in.readInt();
this.mLatency = in.readInt();
this.mRequiresNetworkConnection = (in.readByte() == 1);
this.mFeatures = new HashSet<String>();
Collections.addAll(this.mFeatures, in.readStringArray());
|
Methods Summary |
---|
public int | describeContents()
return 0;
| public boolean | equals(java.lang.Object obj)
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Voice other = (Voice) obj;
if (mFeatures == null) {
if (other.mFeatures != null) {
return false;
}
} else if (!mFeatures.equals(other.mFeatures)) {
return false;
}
if (mLatency != other.mLatency) {
return false;
}
if (mLocale == null) {
if (other.mLocale != null) {
return false;
}
} else if (!mLocale.equals(other.mLocale)) {
return false;
}
if (mName == null) {
if (other.mName != null) {
return false;
}
} else if (!mName.equals(other.mName)) {
return false;
}
if (mQuality != other.mQuality) {
return false;
}
if (mRequiresNetworkConnection != other.mRequiresNetworkConnection) {
return false;
}
return true;
| public java.util.Set | getFeatures()Returns the set of features it supports for a given voice.
Features can either be framework defined, e.g.
{@link TextToSpeech.Engine#KEY_FEATURE_NETWORK_TIMEOUT_MS} or engine specific.
Engine specific keys must be prefixed by the name of the engine they
are intended for. These keys can be used as parameters to
{@link TextToSpeech#speak(String, int, java.util.HashMap)} and
{@link TextToSpeech#synthesizeToFile(String, java.util.HashMap, String)}.
Features values are strings and their values must met restrictions described in their
documentation.
return mFeatures;
| public int | getLatency()
return mLatency;
| public java.util.Locale | getLocale()
return mLocale;
| public java.lang.String | getName()
return mName;
| public int | getQuality()
return mQuality;
| public int | hashCode()
final int prime = 31;
int result = 1;
result = prime * result + ((mFeatures == null) ? 0 : mFeatures.hashCode());
result = prime * result + mLatency;
result = prime * result + ((mLocale == null) ? 0 : mLocale.hashCode());
result = prime * result + ((mName == null) ? 0 : mName.hashCode());
result = prime * result + mQuality;
result = prime * result + (mRequiresNetworkConnection ? 1231 : 1237);
return result;
| public boolean | isNetworkConnectionRequired()
return mRequiresNetworkConnection;
| public java.lang.String | toString()
StringBuilder builder = new StringBuilder(64);
return builder.append("Voice[Name: ").append(mName)
.append(", locale: ").append(mLocale)
.append(", quality: ").append(mQuality)
.append(", latency: ").append(mLatency)
.append(", requiresNetwork: ").append(mRequiresNetworkConnection)
.append(", features: ").append(mFeatures.toString())
.append("]").toString();
| public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeString(mName);
dest.writeSerializable(mLocale);
dest.writeInt(mQuality);
dest.writeInt(mLatency);
dest.writeByte((byte) (mRequiresNetworkConnection ? 1 : 0));
dest.writeStringList(new ArrayList<String>(mFeatures));
|
|