X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FBenchmarks%2FSSJava%2FMP3Decoder%2FPlayer.java;h=8159c3ee6d31be2f31975a24ff0b924e2d5b1b25;hb=15e12c52c54314d14b860b578c46251adb3e8625;hp=1e82e90753e82ae1a738ac7a8ea493bc08e1a35b;hpb=47cc527f574f19b71e92fceac668fb8c0655b13b;p=IRC.git diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java b/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java index 1e82e907..8159c3ee 100644 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java @@ -1,261 +1,261 @@ -import java.awt.image.SampleModel; - -import FileOutputStream; - -/* - * 11/19/04 1.0 moved to LGPL. - * 29/01/00 Initial version. mdm@techie.com - *----------------------------------------------------------------------- - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - *---------------------------------------------------------------------- - */ - -/** - * The Player class implements a simple player for playback of an - * MPEG audio stream. - * - * @author Mat McGowan - * @since 0.0.8 - */ - -// REVIEW: the audio device should not be opened until the -// first MPEG audio frame has been decoded. -@LATTICE("BPlayer instance. - */ - public Player() throws JavaLayerException { - this(null); - } - - public Player(AudioDevice device) throws JavaLayerException { - // bitstream = new Bitstream(stream); - decoder = new Decoder(); - - // if (device!=null) - // { - // audio = device; - // } - // else - // { - // FactoryRegistry r = FactoryRegistry.systemRegistry(); - // audio = r.createAudioDevice(); - // } - - device.open(decoder); - } - - public void play() throws JavaLayerException { - play(Integer.MAX_VALUE); - } - - /** - * Plays a number of MPEG audio frames. - * - * @param frames - * The number of frames to play. - * @return true if the last frame was played, or false if there are more - * frames. - */ - @LATTICE("OUT - * AudioDevice that is used by this player to sound the decoded audio - * samples. - */ - public int getPosition() { - // int position = lastPosition; - - // AudioDevice out = audio; - // if (out!=null) - // { - // position = out.getPosition(); - // } - // return position; - return 0; - } - - /** - * Decodes a single frame. - * - * @return true if there are no more frames to decode, false otherwise. - */ - @LATTICE("CPlayer class implements a simple player for playback of an + * MPEG audio stream. + * + * @author Mat McGowan + * @since 0.0.8 + */ + +// REVIEW: the audio device should not be opened until the +// first MPEG audio frame has been decoded. +@LATTICE("BPlayer instance. + */ + public Player() throws JavaLayerException { + this(null); + } + + public Player(AudioDevice device) throws JavaLayerException { + // bitstream = new Bitstream(stream); + decoder = new Decoder(); + + // if (device!=null) + // { + // audio = device; + // } + // else + // { + // FactoryRegistry r = FactoryRegistry.systemRegistry(); + // audio = r.createAudioDevice(); + // } + + device.open(decoder); + } + + public void play() throws JavaLayerException { + play(Integer.MAX_VALUE); + } + + /** + * Plays a number of MPEG audio frames. + * + * @param frames + * The number of frames to play. + * @return true if the last frame was played, or false if there are more + * frames. + */ + @LATTICE("OUT + * AudioDevice that is used by this player to sound the decoded audio + * samples. + */ + public int getPosition() { + // int position = lastPosition; + + // AudioDevice out = audio; + // if (out!=null) + // { + // position = out.getPosition(); + // } + // return position; + return 0; + } + + /** + * Decodes a single frame. + * + * @return true if there are no more frames to decode, false otherwise. + */ + @LATTICE("C