From 7039a05147b8bbfc829babea1c65bd436450b505 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 8 Jan 2007 23:53:00 +0000 Subject: Splitting out songdbj git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11953 a1c6a512-1295-4272-9138-f99709370657 --- songdbj/javazoom/jl/player/AudioDeviceBase.java | 177 ------------------------ 1 file changed, 177 deletions(-) delete mode 100644 songdbj/javazoom/jl/player/AudioDeviceBase.java (limited to 'songdbj/javazoom/jl/player/AudioDeviceBase.java') diff --git a/songdbj/javazoom/jl/player/AudioDeviceBase.java b/songdbj/javazoom/jl/player/AudioDeviceBase.java deleted file mode 100644 index d9c84f08e7..0000000000 --- a/songdbj/javazoom/jl/player/AudioDeviceBase.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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. - *---------------------------------------------------------------------- - */ - -package javazoom.jl.player; - -import javazoom.jl.decoder.Decoder; -import javazoom.jl.decoder.JavaLayerException; - -/** - * The AudioDeviceBase class provides a simple thread-safe - * implementation of the AudioDevice interface. - * Template methods are provided for subclasses to override and - * in doing so provide the implementation for the main operations - * of the AudioDevice interface. - * - * @since 0.0.8 - * @author Mat McGowan - */ -/* - * REVIEW: It is desirable to be able to use the decoder whe - * in the implementation of open(), but the decoder - * has not yet read a frame, and so much of the - * desired information (sample rate, channels etc.) - * are not available. - */ -public abstract class AudioDeviceBase implements AudioDevice -{ - private boolean open = false; - - private Decoder decoder = null; - - /** - * Opens this audio device. - * - * @param decoder The decoder that will provide audio data - * to this audio device. - */ - public synchronized void open(Decoder decoder) throws JavaLayerException - { - if (!isOpen()) - { - this.decoder = decoder; - openImpl(); - setOpen(true); - } - } - - /** - * Template method to provide the - * implementation for the opening of the audio device. - */ - protected void openImpl() throws JavaLayerException - { - } - - /** - * Sets the open state for this audio device. - */ - protected void setOpen(boolean open) - { - this.open = open; - } - - /** - * Determines if this audio device is open or not. - * - * @return true if the audio device is open, - * false if it is not. - */ - public synchronized boolean isOpen() - { - return open; - } - - /** - * Closes this audio device. If the device is currently playing - * audio, playback is stopped immediately without flushing - * any buffered audio data. - */ - public synchronized void close() - { - if (isOpen()) - { - closeImpl(); - setOpen(false); - decoder = null; - } - } - - /** - * Template method to provide the implementation for - * closing the audio device. - */ - protected void closeImpl() - { - } - - /** - * Writes audio data to this audio device. Audio data is - * assumed to be in the output format of the decoder. This - * method may return before the data has actually been sounded - * by the device if the device buffers audio samples. - * - * @param samples The samples to write to the audio device. - * @param offs The offset into the array of the first sample to write. - * @param len The number of samples from the array to write. - * @throws JavaLayerException if the audio data could not be - * written to the audio device. - * If the audio device is not open, this method does nthing. - */ - public void write(short[] samples, int offs, int len) - throws JavaLayerException - { - if (isOpen()) - { - writeImpl(samples, offs, len); - } - } - - /** - * Template method to provide the implementation for - * writing audio samples to the audio device. - */ - protected void writeImpl(short[] samples, int offs, int len) - throws JavaLayerException - { - } - - /** - * Waits for any buffered audio samples to be played by the - * audio device. This method should only be called prior - * to closing the device. - */ - public void flush() - { - if (isOpen()) - { - flushImpl(); - } - } - - /** - * Template method to provide the implementation for - * flushing any buffered audio data. - */ - protected void flushImpl() - { - } - - /** - * Retrieves the decoder that provides audio data to this - * audio device. - * - * @return The associated decoder. - */ - protected Decoder getDecoder() - { - return decoder; - } -} -- cgit v1.2.3