+import java.awt.image.SampleModel;\r
+\r
import FileOutputStream;\r
\r
/*\r
/**\r
* The MPEG audio bitstream.\r
*/\r
- // javac blank final bug.\r
- /* final */@LOC("ST")\r
- private Bitstream bitstream;\r
+ // private Bitstream bitstream;\r
\r
/**\r
* The MPEG audio decoder.\r
/**\r
* Creates a new <code>Player</code> instance.\r
*/\r
- public Player(InputStream stream) throws JavaLayerException {\r
- this(stream, null);\r
+ public Player() throws JavaLayerException {\r
+ this(null);\r
}\r
\r
- public Player(InputStream stream, AudioDevice device) throws JavaLayerException {\r
- bitstream = new Bitstream(stream);\r
+ public Player(AudioDevice device) throws JavaLayerException {\r
+ // bitstream = new Bitstream(stream);\r
decoder = new Decoder();\r
\r
// if (device!=null)\r
public boolean play(@LOC("IN") int frames) throws JavaLayerException {\r
@LOC("IN") boolean ret = true;\r
\r
- // FileOutputStream fos = new FileOutputStream("output.txt");\r
-\r
int count = 0;\r
SSJAVA: while (frames-- > 0 && ret) {\r
ret = decodeFrame();\r
}\r
\r
- // fos.flush();\r
- // fos.close();\r
/*\r
* if (!ret) { // last frame, ensure all data flushed to the audio device.\r
* AudioDevice out = audio; if (out!=null) { out.flush(); synchronized\r
// if (out==null)\r
// return false;\r
\r
- Header h = bitstream.readFrame();\r
+ // Header h = bitstream.readFrame();\r
+ Header h = BitstreamWrapper.readFrame();\r
\r
if (h == null)\r
return false;\r
\r
- // eom debug\r
- // System.out.println("header framesize=" + h.framesize);\r
- // System.out.println("br total="+h.getBitReserve().hsstell());\r
- //\r
-\r
- // sample buffer set when decoder constructed\r
- @LOC("O") SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);\r
+ // @LOC("O") SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h);\r
+ decoder.decodeFrame(h);\r
\r
// eom debug\r
- int sum=0;\r
- short[] outbuf = output.getBuffer();\r
- for (int i = 0; i < output.getBufferLength(); i++) {\r
-// System.out.println(outbuf[i]);\r
- sum+=outbuf[i];\r
+ int sum = 0;\r
+ short[] outbuf = SampleBufferWrapper.getOutput().getBuffer();\r
+ // short[] outbuf = output.getBuffer();\r
+ for (int i = 0; i < SampleBufferWrapper.getOutput().getBufferLength(); i++) {\r
+ // System.out.println(outbuf[i]);\r
+ sum += outbuf[i];\r
}\r
System.out.println(sum);\r
//\r