Package com.sun.speech.freetts.diphone
Class AliasDiphone
- java.lang.Object
-
- com.sun.speech.freetts.diphone.Diphone
-
- com.sun.speech.freetts.diphone.AliasDiphone
-
public class AliasDiphone extends Diphone
Represent an alias diphone which is just another name for an already-existing original diphone. This can be used just like a "real" diphone.- Author:
- Marc Schröder
-
-
Field Summary
-
Fields inherited from class com.sun.speech.freetts.diphone.Diphone
ALIAS_MAGIC, MAGIC, NAME_LENGTH
-
-
Constructor Summary
Constructors Constructor Description AliasDiphone(java.lang.String name, java.lang.String originalName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dump()
dumps out this Diphone.void
dumpBinary(java.io.DataOutputStream os)
Dumps the diphone to the given channel.void
dumpBinary(java.nio.ByteBuffer bb)
Dumps the diphone to the given channel.int
getMidPoint()
Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.java.lang.String
getOriginalName()
Get the name of the original name that this alias points to.int
getPbPositionMillis()
Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.Sample[]
getSamples()
Returns the samples associated with this diphone.Sample
getSamples(int which)
Returns a particular sample.int
getUnitSize(int unitPart)
Returns the total number of residuals in the given part for this diphone.Sample
nearestSample(float uIndex, int unitPart)
Returns the sample that is closest to uIndex.void
setOriginalDiphone(Diphone original)
Associate the actual diphone object of the original with this alias.-
Methods inherited from class com.sun.speech.freetts.diphone.Diphone
getName, loadBinary, loadBinary
-
-
-
-
Method Detail
-
getOriginalName
public java.lang.String getOriginalName()
Get the name of the original name that this alias points to.
-
setOriginalDiphone
public void setOriginalDiphone(Diphone original)
Associate the actual diphone object of the original with this alias.- Parameters:
original
- a diphone object whose getName() must return the same as our getOriginalName().- Throws:
java.lang.IllegalArgumentException
- if the diphone to be registered as the original has a name which is different from this AliasDiphone's original name as returned by getOriginalName().
-
getSamples
public Sample[] getSamples()
Returns the samples associated with this diphone.- Overrides:
getSamples
in classDiphone
- Returns:
- the samples associated with this diphone
-
getSamples
public Sample getSamples(int which)
Returns a particular sample.- Overrides:
getSamples
in classDiphone
- Parameters:
which
- which sample to return- Returns:
- the desired sample
-
getMidPoint
public int getMidPoint()
Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.- Overrides:
getMidPoint
in classDiphone
- Returns:
- the midpoint index.
-
getPbPositionMillis
public int getPbPositionMillis()
Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.- Overrides:
getPbPositionMillis
in classDiphone
- Returns:
- the midpoint index.
-
nearestSample
public Sample nearestSample(float uIndex, int unitPart)
Returns the sample that is closest to uIndex.- Overrides:
nearestSample
in classDiphone
- Parameters:
uIndex
- the desired indexunitPart
- do we want the first have (1) or the second half (2)- Returns:
- the sample nearest to the given index in the given part
-
getUnitSize
public int getUnitSize(int unitPart)
Returns the total number of residuals in the given part for this diphone.- Overrides:
getUnitSize
in classDiphone
- Parameters:
unitPart
- indicates which part is of interest (1 or 2)- Returns:
- the number of residuals in the specified part
-
dumpBinary
public void dumpBinary(java.nio.ByteBuffer bb) throws java.io.IOException
Dumps the diphone to the given channel.- Overrides:
dumpBinary
in classDiphone
- Parameters:
bb
- the ByteBuffer to write to- Throws:
java.io.IOException
- if IO error occurs
-
dumpBinary
public void dumpBinary(java.io.DataOutputStream os) throws java.io.IOException
Dumps the diphone to the given channel.- Overrides:
dumpBinary
in classDiphone
- Parameters:
os
- the DataOutputStream to write to- Throws:
java.io.IOException
- if IO error occurs
-
-