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(String name, String originalName)`

## Method Summary

Modifier and Type
Method
Description
`void`
`dump()`
dumps out this Diphone.
`void`
`dumpBinary(DataOutputStream os)`
Dumps the diphone to the given channel.
`void`
`dumpBinary(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.
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AliasDiphone

public AliasDiphone(String name, String originalName)

Parameters:
  `name` - The alias name to use for the existing diphone
  `originalName` - the original name of the diphone.

## Method Details

### getOriginalName

public 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:
  `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 class `Diphone`
Returns:
  the samples associated with this diphone

### getSamples

public Sample getSamples(int which)
Returns a particular sample.

Overrides:
  `getSamples` in class `Diphone`
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 class `Diphone`
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 class `Diphone`
Returns:
  the midpoint index.

### nearestSample

public Sample nearestSample(float uIndex, int unitPart)
Returns the sample that is closest to uIndex.

Overrides:
  `nearestSample` in class `Diphone`
Parameters:
  `uIndex` - the desired index
  `unitPart` - 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 class `Diphone`
Parameters:
  `unitPart` - indicates which part is of interest (1 or 2)
Returns:
  the number of residuals in the specified part

### dump

public void dump()
dumps out this Diphone.

Overrides:
  `dump` in class `Diphone`

### dumpBinary

public void dumpBinary(ByteBuffer bb) throws IOException
Dumps the diphone to the given channel.

Overrides:
  `dumpBinary` in class `Diphone`
Parameters:
  `bb` - the ByteBuffer to write to
Throws:
  `IOException` - if IO error occurs

### dumpBinary

public void dumpBinary(DataOutputStream os) throws IOException
Dumps the diphone to the given channel.

Overrides:
  `dumpBinary` in class `Diphone`
Parameters:
  `os` - the DataOutputStream to write to
Throws:
  `IOException` - if IO error occurs