< prev index next >

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

Print this page

        

*** 26,38 **** package com.sun.media.sound; import java.util.Vector; import javax.sound.sampled.Control; - import javax.sound.sampled.Mixer; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; /** * Abstract Mixer. Implements Mixer (with abstract methods) and specifies * some other common methods for use by our implementation. * --- 26,38 ---- package com.sun.media.sound; import java.util.Vector; import javax.sound.sampled.Control; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; + import javax.sound.sampled.Mixer; /** * Abstract Mixer. Implements Mixer (with abstract methods) and specifies * some other common methods for use by our implementation. *
*** 74,106 **** * If it was, then it won't be closed automatically, * only when close() is called manually. */ private boolean manuallyOpened = false; - - /** - * Supported formats for the mixer. - */ - //$$fb DELETE - //protected Vector formats = new Vector(); - - // STATE VARIABLES - /** ! * Source lines (ports) currently open */ private final Vector<Line> sourceLines = new Vector<>(); - /** * Target lines currently open. */ private final Vector<Line> targetLines = new Vector<>(); - /** * Constructs a new AbstractMixer. * @param mixer the mixer with which this line is associated * @param controls set of supported controls */ --- 74,95 ---- * If it was, then it won't be closed automatically, * only when close() is called manually. */ private boolean manuallyOpened = false; // STATE VARIABLES /** ! * Source lines (ports) currently open. */ private final Vector<Line> sourceLines = new Vector<>(); /** * Target lines currently open. */ private final Vector<Line> targetLines = new Vector<>(); /** * Constructs a new AbstractMixer. * @param mixer the mixer with which this line is associated * @param controls set of supported controls */
*** 122,155 **** this.mixerInfo = mixerInfo; this.sourceLineInfo = sourceLineInfo; this.targetLineInfo = targetLineInfo; } - // MIXER METHODS ! public final Mixer.Info getMixerInfo() { return mixerInfo; } ! public final Line.Info[] getSourceLineInfo() { Line.Info[] localArray = new Line.Info[sourceLineInfo.length]; System.arraycopy(sourceLineInfo, 0, localArray, 0, sourceLineInfo.length); return localArray; } ! public final Line.Info[] getTargetLineInfo() { - Line.Info[] localArray = new Line.Info[targetLineInfo.length]; System.arraycopy(targetLineInfo, 0, localArray, 0, targetLineInfo.length); return localArray; } ! public final Line.Info[] getSourceLineInfo(Line.Info info) { int i; Vector<Line.Info> vec = new Vector<>(); --- 111,142 ---- this.mixerInfo = mixerInfo; this.sourceLineInfo = sourceLineInfo; this.targetLineInfo = targetLineInfo; } // MIXER METHODS ! @Override public final Mixer.Info getMixerInfo() { return mixerInfo; } ! @Override public final Line.Info[] getSourceLineInfo() { Line.Info[] localArray = new Line.Info[sourceLineInfo.length]; System.arraycopy(sourceLineInfo, 0, localArray, 0, sourceLineInfo.length); return localArray; } ! @Override public final Line.Info[] getTargetLineInfo() { Line.Info[] localArray = new Line.Info[targetLineInfo.length]; System.arraycopy(targetLineInfo, 0, localArray, 0, targetLineInfo.length); return localArray; } ! @Override public final Line.Info[] getSourceLineInfo(Line.Info info) { int i; Vector<Line.Info> vec = new Vector<>();
*** 166,176 **** } return returnedArray; } ! public final Line.Info[] getTargetLineInfo(Line.Info info) { int i; Vector<Line.Info> vec = new Vector<>(); --- 153,163 ---- } return returnedArray; } ! @Override public final Line.Info[] getTargetLineInfo(Line.Info info) { int i; Vector<Line.Info> vec = new Vector<>();
*** 187,197 **** } return returnedArray; } ! public final boolean isLineSupported(Line.Info info) { int i; for (i = 0; i < sourceLineInfo.length; i++) { --- 174,184 ---- } return returnedArray; } ! @Override public final boolean isLineSupported(Line.Info info) { int i; for (i = 0; i < sourceLineInfo.length; i++) {
*** 209,229 **** } return false; } ! public abstract Line getLine(Line.Info info) throws LineUnavailableException; public abstract int getMaxLines(Line.Info info); protected abstract void implOpen() throws LineUnavailableException; protected abstract void implStart(); protected abstract void implStop(); protected abstract void implClose(); ! public final Line[] getSourceLines() { Line[] localLines; synchronized(sourceLines) { --- 196,217 ---- } return false; } ! @Override public abstract Line getLine(Line.Info info) throws LineUnavailableException; + @Override public abstract int getMaxLines(Line.Info info); protected abstract void implOpen() throws LineUnavailableException; protected abstract void implStart(); protected abstract void implStop(); protected abstract void implClose(); ! @Override public final Line[] getSourceLines() { Line[] localLines; synchronized(sourceLines) {
*** 236,246 **** } return localLines; } ! public final Line[] getTargetLines() { Line[] localLines; synchronized(targetLines) { --- 224,234 ---- } return localLines; } ! @Override public final Line[] getTargetLines() { Line[] localLines; synchronized(targetLines) {
*** 253,293 **** } return localLines; } - /** * Default implementation always throws an exception. */ public final void synchronize(Line[] lines, boolean maintainSync) { throw new IllegalArgumentException("Synchronization not supported by this mixer."); } - /** * Default implementation always throws an exception. */ public final void unsynchronize(Line[] lines) { throw new IllegalArgumentException("Synchronization not supported by this mixer."); } - /** * Default implementation always returns false. */ public final boolean isSynchronizationSupported(Line[] lines, boolean maintainSync) { return false; } - // OVERRIDES OF ABSTRACT DATA LINE METHODS /** * This implementation tries to open the mixer with its current format and buffer size settings. */ public final synchronized void open() throws LineUnavailableException { open(true); } /** --- 241,281 ---- } return localLines; } /** * Default implementation always throws an exception. */ + @Override public final void synchronize(Line[] lines, boolean maintainSync) { throw new IllegalArgumentException("Synchronization not supported by this mixer."); } /** * Default implementation always throws an exception. */ + @Override public final void unsynchronize(Line[] lines) { throw new IllegalArgumentException("Synchronization not supported by this mixer."); } /** * Default implementation always returns false. */ + @Override public final boolean isSynchronizationSupported(Line[] lines, boolean maintainSync) { return false; } // OVERRIDES OF ABSTRACT DATA LINE METHODS /** * This implementation tries to open the mixer with its current format and buffer size settings. */ + @Override public final synchronized void open() throws LineUnavailableException { open(true); } /**
*** 305,318 **** } if (Printer.trace) Printer.trace("<< AbstractMixer: open() succeeded"); } - // METHOD FOR INTERNAL IMPLEMENTATION USE - /** * The default implementation of this method just determines whether * this line is a source or target line, calls open(no-arg) on the * mixer, and adds the line to the appropriate vector. * The mixer may be opened at a format different than the line's --- 293,304 ----
*** 355,365 **** } if (Printer.trace) Printer.trace("<< AbstractMixer: open(" + line + ") completed"); } - /** * Removes this line from the list of open source lines and * open target lines, if it exists in either. * If the list is now empty, closes the mixer. */ --- 341,350 ----
*** 386,399 **** } if (Printer.trace) Printer.trace("<< AbstractMixer: close(" + line + ") succeeded"); } - /** * Close all lines and then close this mixer. */ public final synchronized void close() { if (Printer.trace) Printer.trace(">> AbstractMixer: close()"); if (isOpen()) { // close all source lines Line[] localLines = getSourceLines(); --- 371,384 ---- } if (Printer.trace) Printer.trace("<< AbstractMixer: close(" + line + ") succeeded"); } /** * Close all lines and then close this mixer. */ + @Override public final synchronized void close() { if (Printer.trace) Printer.trace(">> AbstractMixer: close()"); if (isOpen()) { // close all source lines Line[] localLines = getSourceLines();
*** 437,447 **** } if (Printer.trace) Printer.trace("<< AbstractMixer: start(" + line + ") succeeded"); } - /** * Stops the mixer if this was the last running line. */ final synchronized void stop(Line line) { --- 422,431 ----
*** 490,501 **** implStop(); if (Printer.trace) Printer.trace("<< AbstractMixer: stop(" + line + ") succeeded"); } - - /** * Determines whether this is a source line for this mixer. * Right now this just checks whether it's supported, but should * check whether it actually belongs to this mixer.... */ --- 474,483 ----
*** 508,518 **** } return false; } - /** * Determines whether this is a target line for this mixer. * Right now this just checks whether it's supported, but should * check whether it actually belongs to this mixer.... */ --- 490,499 ----
*** 525,535 **** } return false; } - /** * Returns the first complete Line.Info object it finds that * matches the one specified, or null if no matching Line.Info * object is found. */ --- 506,515 ----
*** 549,558 **** for (int i = 0; i < targetLineInfo.length; i++) { if (info.matches(targetLineInfo[i])) { return targetLineInfo[i]; } } - return null; } - } --- 529,536 ----
< prev index next >