use of vazkii.symphony.lib.javazoom.jl.decoder.SampleBuffer in project Symphony by Vazkii.
the class Player method decodeFrame.
/**
* 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;
}
use of vazkii.symphony.lib.javazoom.jl.decoder.SampleBuffer in project Symphony by Vazkii.
the class AdvancedPlayer method decodeFrame.
/**
* 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);
}
return true;
}
Aggregations