mp3播放器代码java的简单介绍( 四 )


}
/**
* Decodes a single frame.
*
* @return true if there are no more frames to decode, false otherwise.
*/
protected boolean decodeFrame () throws JavaLayerException
{
try
{
AudioDevice out = audio;
if (out == null)
return false;
Header h = bitstream.readFrame ();
if (h == null)
return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer) decoder.decodeFrame (h, bitstream);
synchronized (this)
{
out = audio;
if (out != null)
{
out.write (output.getBuffer (), 0, output.getBufferLength ());
}
}
bitstream.closeFrame ();
}
catch (RuntimeException ex)
{
throw new JavaLayerException ("Exception decoding audio frame", ex);
}
/*
* catch (IOException ex) {
* System.out.println("exception decoding audio frame: "+ex); return
* false; } catch (BitstreamException bitex) {
* System.out.println("exception decoding audio frame: "+bitex); return
* false; } catch (DecoderException decex) {
* System.out.println("exception decoding audio frame: "+decex); return
* false; }
*/
return true;
}
public static void main ( String[] args )
{
try
{
Player player = new Player (new FileInputStream (new File ("D:\\Youdagames\\JLayer1.0.1\\abc.mp3")));
player.play ();
}
catch (FileNotFoundException e)
{
e.printStackTrace ();
}
catch (JavaLayerException e)
{
e.printStackTrace ();
}
}
}
【mp3播放器代码java的简单介绍】关于mp3播放器代码java和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

推荐阅读