/**
* This method is a replacement for
* AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream), which is
* used for audio format conversion at the stream level. This method includes
* a workaround for converting from an mp3 AudioInputStream when the sketch
* is running in an applet. The workaround was developed by the Tritonus team
* and originally comes from the package javazoom.jlgui.basicplayer
*
* @param targetFormat
* the AudioFormat to convert the stream to
* @param sourceStream
* the stream containing the unconverted audio
* @return an AudioInputStream in the target format
*/
AudioInputStream getAudioInputStream(AudioFormat targetFormat,
AudioInputStream sourceStream)
{
try
{
return AudioSystem.getAudioInputStream(targetFormat, sourceStream);
}
catch (IllegalArgumentException iae)
{
debug("Using AppletMpegSPIWorkaround to get codec");
try
{
Class.forName("javazoom.spi.mpeg.sampled.convert.MpegFormatConversionProvider");
return new javazoom.spi.mpeg.sampled.convert.MpegFormatConversionProvider().getAudioInputStream(
targetFormat,
sourceStream);
}
catch (ClassNotFoundException cnfe)
{
throw new IllegalArgumentException("Mpeg codec not properly installed");
}
}
}
JSMinim.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:romanov
作者:
评论列表
文章目录