< prev index next >

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

Print this page

        

@@ -26,13 +26,13 @@
 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;
+import javax.sound.sampled.Mixer;
 
 /**
  * Abstract Mixer.  Implements Mixer (with abstract methods) and specifies
  * some other common methods for use by our implementation.
  *

@@ -74,33 +74,22 @@
      * 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
+     * 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,34 +111,32 @@
         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,11 +153,11 @@
         }
 
         return returnedArray;
     }
 
-
+    @Override
     public final Line.Info[] getTargetLineInfo(Line.Info info) {
 
         int i;
         Vector<Line.Info> vec = new Vector<>();
 

@@ -187,11 +174,11 @@
         }
 
         return returnedArray;
     }
 
-
+    @Override
     public final boolean isLineSupported(Line.Info info) {
 
         int i;
 
         for (i = 0; i < sourceLineInfo.length; i++) {

@@ -209,21 +196,22 @@
         }
 
         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,11 +224,11 @@
         }
 
         return localLines;
     }
 
-
+    @Override
     public final Line[] getTargetLines() {
 
         Line[] localLines;
 
         synchronized(targetLines) {

@@ -253,41 +241,41 @@
         }
 
         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,14 +293,12 @@
         }
 
         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

@@ -355,11 +341,10 @@
         }
 
         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.
      */

@@ -386,14 +371,14 @@
         }
 
         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,11 +422,10 @@
         }
 
         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) {
 

@@ -490,12 +474,10 @@
         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....
      */

@@ -508,11 +490,10 @@
         }
 
         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....
      */

@@ -525,11 +506,10 @@
         }
 
         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.
      */

@@ -549,10 +529,8 @@
         for (int i = 0; i < targetLineInfo.length; i++) {
             if (info.matches(targetLineInfo[i])) {
                 return targetLineInfo[i];
             }
         }
-
         return null;
     }
-
 }
< prev index next >