本文整理汇总了Java中javax.media.format.AudioFormat.ULAW属性的典型用法代码示例。如果您正苦于以下问题:Java AudioFormat.ULAW属性的具体用法?Java AudioFormat.ULAW怎么用?Java AudioFormat.ULAW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.media.format.AudioFormat
的用法示例。
在下文中一共展示了AudioFormat.ULAW属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSupportedInputFormats
@Override
public Format[] getSupportedInputFormats()
{
// TODO: query AudioSystem
return new Format[] {
new AudioFormat(AudioFormat.LINEAR, -1, 8, -1, -1,
AudioFormat.SIGNED),
new AudioFormat(AudioFormat.LINEAR, -1, 16, -1,
AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
new AudioFormat(AudioFormat.LINEAR, -1, 24, -1,
AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
new AudioFormat(AudioFormat.LINEAR, -1, 32, -1,
AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
new AudioFormat(AudioFormat.ULAW), // TODO: narrow down
new AudioFormat(AudioFormat.ALAW) // TODO: narrow down
};
}
示例2: convertFormat
/**
* Convert javax.sound.sampled.AudioFormat to
* javax.media.format.AudioFormat.
*/
public static AudioFormat convertFormat(
javax.sound.sampled.AudioFormat format)
{
Encoding encoding = format.getEncoding();
int channels = format.getChannels();
float frameRate = format.getFrameRate();
int frameSize = format.getFrameSize() < 0 ? format.getFrameSize()
: (format.getFrameSize() * 8);
float sampleRate = format.getSampleRate();
int sampleSize = format.getSampleSizeInBits();
int endian = format.isBigEndian() ? AudioFormat.BIG_ENDIAN
: AudioFormat.LITTLE_ENDIAN;
int signed = Format.NOT_SPECIFIED;
String encodingString = AudioFormat.LINEAR;
if (encoding == Encoding.PCM_SIGNED)
{
signed = AudioFormat.SIGNED;
encodingString = AudioFormat.LINEAR;
} else if (encoding == Encoding.PCM_UNSIGNED)
{
signed = AudioFormat.UNSIGNED;
encodingString = AudioFormat.LINEAR;
} else if (encoding == Encoding.ALAW)
{
encodingString = AudioFormat.ALAW;
} else if (encoding == Encoding.ULAW)
{
encodingString = AudioFormat.ULAW;
} else
{
encodingString = encoding.toString();
}
AudioFormat jmfFormat = new AudioFormat(encodingString, sampleRate,
sampleSize, channels, endian, signed, frameSize, frameRate,
Format.byteArray);
return jmfFormat;
}