< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java

Print this page

        

*** 34,44 **** import javax.sound.sampled.Line; import javax.sound.sampled.LineEvent; import javax.sound.sampled.LineListener; import javax.sound.sampled.LineUnavailableException; - /** * AbstractLine * * @author Kara Kytle */ --- 34,43 ----
*** 70,127 **** this.info = info; this.mixer = mixer; this.controls = controls; } - // LINE METHODS public final Line.Info getLineInfo() { return info; } ! public final boolean isOpen() { return open; } ! public final void addLineListener(LineListener listener) { synchronized(listeners) { if ( ! (listeners.contains(listener)) ) { listeners.addElement(listener); } } } - /** * Removes an audio listener. * @param listener listener to remove */ public final void removeLineListener(LineListener listener) { listeners.removeElement(listener); } - /** * Obtains the set of controls supported by the * line. If no controls are supported, returns an * array of length 0. * @return control set */ public final Control[] getControls() { Control[] returnedArray = new Control[controls.length]; for (int i = 0; i < controls.length; i++) { returnedArray[i] = controls[i]; } return returnedArray; } ! public final boolean isControlSupported(Control.Type controlType) { // protect against a NullPointerException if (controlType == null) { return false; } --- 69,126 ---- this.info = info; this.mixer = mixer; this.controls = controls; } // LINE METHODS + @Override public final Line.Info getLineInfo() { return info; } ! @Override public final boolean isOpen() { return open; } ! @Override public final void addLineListener(LineListener listener) { synchronized(listeners) { if ( ! (listeners.contains(listener)) ) { listeners.addElement(listener); } } } /** * Removes an audio listener. * @param listener listener to remove */ + @Override public final void removeLineListener(LineListener listener) { listeners.removeElement(listener); } /** * Obtains the set of controls supported by the * line. If no controls are supported, returns an * array of length 0. * @return control set */ + @Override public final Control[] getControls() { Control[] returnedArray = new Control[controls.length]; for (int i = 0; i < controls.length; i++) { returnedArray[i] = controls[i]; } return returnedArray; } ! @Override public final boolean isControlSupported(Control.Type controlType) { // protect against a NullPointerException if (controlType == null) { return false; }
*** 133,143 **** } return false; } ! public final Control getControl(Control.Type controlType) { // protect against a NullPointerException if (controlType != null) { for (int i = 0; i < controls.length; i++) { --- 132,142 ---- } return false; } ! @Override public final Control getControl(Control.Type controlType) { // protect against a NullPointerException if (controlType != null) { for (int i = 0; i < controls.length; i++) {
*** 148,161 **** } throw new IllegalArgumentException("Unsupported control type: " + controlType); } - // HELPER METHODS - /** * This method sets the open state and generates * events if it changes. */ final void setOpen(boolean open) { --- 147,158 ----
*** 180,217 **** } } if (Printer.trace) Printer.trace("< "+getClass().getName()+" (AbstractLine): setOpen(" + open + ") this.open: " + this.open); } - /** * Send line events. */ final void sendEvents(LineEvent event) { getEventDispatcher().sendAudioEvents(event, listeners); } - /** * This is an error in the API: getFramePosition * should return a long value. At CD quality, * the int value wraps around after 13 hours. */ public final int getFramePosition() { return (int) getLongFramePosition(); } - /** * Return the frame position in a long value * This implementation returns AudioSystem.NOT_SPECIFIED. */ public long getLongFramePosition() { return AudioSystem.NOT_SPECIFIED; } - // $$kk: 06.03.99: returns the mixer used in construction. // this is a hold-over from when there was a public method like // this on line and should be fixed!! final AbstractMixer getMixer() { return mixer; --- 177,210 ----
*** 230,239 **** } return eventDispatcher; } } ! // ABSTRACT METHODS ! public abstract void open() throws LineUnavailableException; public abstract void close(); } --- 223,232 ---- } return eventDispatcher; } } ! @Override public abstract void open() throws LineUnavailableException; + @Override public abstract void close(); }
< prev index next >