public AudioInputStream getAudioInputStream(AudioFormat targetFormat,
AudioFloatInputStream sourceStream) {
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
throw new IllegalArgumentException("Unsupported conversion: "
+ sourceStream.getFormat().toString() + " to "
+ targetFormat.toString());
if (targetFormat.getChannels() != sourceStream.getFormat()
.getChannels())
sourceStream = new AudioFloatInputStreamChannelMixer(sourceStream,
targetFormat.getChannels());
if (Math.abs(targetFormat.getSampleRate()
- sourceStream.getFormat().getSampleRate()) > 0.000001)
sourceStream = new AudioFloatInputStreamResampler(sourceStream,
targetFormat);
return new AudioInputStream(new AudioFloatFormatConverterInputStream(
targetFormat, sourceStream), targetFormat, sourceStream
.getFrameLength());
}
AudioFloatFormatConverter.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:OpenJSharp
作者:
评论列表
文章目录