Methods Summary |
---|
private int | getEncoding(java.lang.String encodingString, int sampleSizeInBits)
if (encodingString.equalsIgnoreCase(AudioFormat.ULAW))
return AU_ULAW_8;
else if (encodingString.equalsIgnoreCase(AudioFormat.ALAW))
return AU_ALAW_8;
else if (encodingString.equalsIgnoreCase(AudioFormat.LINEAR)) {
if (sampleSizeInBits == 8)
return AU_LINEAR_8;
else if (sampleSizeInBits == 16)
return AU_LINEAR_16;
else if (sampleSizeInBits == 24)
return AU_LINEAR_24;
else if (sampleSizeInBits == 32)
return AU_LINEAR_32;
else
return UNKNOWN_ENCODING;
} else if (encodingString.equalsIgnoreCase("float"))
return AU_FLOAT;
else if (encodingString.equalsIgnoreCase("double"))
return AU_DOUBLE;
else {
//System.out.println("getEncoding: returns UNKNOWN_ENCODING");
return UNKNOWN_ENCODING;
}
|
public java.lang.String | getName()
return "Basic Audio Multiplexer";
|
public javax.media.Format | setInputFormat(javax.media.Format format, int trackID)
String reason = null;
if (!(format instanceof AudioFormat))
return null;
audioFormat = (AudioFormat) format;
String encodingString = audioFormat.getEncoding();
sampleSizeInBits = audioFormat.getSampleSizeInBits();
// Linear Data has to be in big endian and should be signed
if (encodingString.equalsIgnoreCase(AudioFormat.LINEAR)) {
if (sampleSizeInBits > 8 &&
audioFormat.getEndian() == AudioFormat.LITTLE_ENDIAN)
return null;
if (audioFormat.getSigned() == AudioFormat.UNSIGNED)
return null;
if (audioFormat.getEndian() == AudioFormat.NOT_SPECIFIED ||
audioFormat.getSigned() == AudioFormat.NOT_SPECIFIED)
audioFormat = (AudioFormat)audioFormat.intersects(bigEndian);
}
// System.out.println("encodingString is " + encodingString);
encoding = getEncoding(encodingString, sampleSizeInBits);
if (encoding == UNKNOWN_ENCODING) {
reason = "No support for encoding " + encodingString;
}
sampleRate = audioFormat.getSampleRate();
channels = audioFormat.getChannels();
if (reason == null)
return audioFormat;
else
return null;
|
public int | setNumTracks(int nTracks)
if (nTracks != 1)
return 1;
else
return super.setNumTracks(nTracks);
|
protected void | writeFooter()
seek(8);
bufClear();
bufWriteInt(fileSize - HEADER_SIZE);
bufFlush();
|
protected void | writeHeader()
bufClear();
bufWriteInt(AU_SUN_MAGIC);
bufWriteInt(HEADER_SIZE);
bufWriteInt(-1); // Size of data, to be filled in at the end
bufWriteInt(encoding);
bufWriteInt((int) sampleRate);
bufWriteInt(channels);
bufFlush();
|