< prev index next >

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

Print this page

        

@@ -20,10 +20,11 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;

@@ -31,15 +32,15 @@
 
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.BooleanControl;
 import javax.sound.sampled.Control;
+import javax.sound.sampled.Control.Type;
 import javax.sound.sampled.DataLine;
 import javax.sound.sampled.FloatControl;
 import javax.sound.sampled.LineEvent;
 import javax.sound.sampled.LineListener;
-import javax.sound.sampled.Control.Type;
 
 /**
  * General software mixing line.
  *
  * @author Karl Helgason

@@ -128,26 +129,31 @@
             ibuffer2 = new float[nrofchannels * buffer_len];
             ibuffer_index = buffer_len + pad;
             ibuffer_len = buffer_len;
         }
 
+        @Override
         public int available() throws IOException {
             return 0;
         }
 
+        @Override
         public void close() throws IOException {
             ais.close();
         }
 
+        @Override
         public AudioFormat getFormat() {
             return targetFormat;
         }
 
+        @Override
         public long getFrameLength() {
             return AudioSystem.NOT_SPECIFIED; // ais.getFrameLength();
         }
 
+        @Override
         public void mark(int readlimit) {
             ais.mark((int) (readlimit * pitch[0]));
             mark_ibuffer_index = ibuffer_index;
             mark_ibuffer_len = ibuffer_len;
             if (mark_ibuffer == null) {

@@ -160,10 +166,11 @@
                     to[i] = from[i];
                 }
             }
         }
 
+        @Override
         public boolean markSupported() {
             return ais.markSupported();
         }
 
         private void readNextBuffer() throws IOException {

@@ -204,10 +211,11 @@
                 }
             }
 
         }
 
+        @Override
         public int read(float[] b, int off, int len) throws IOException {
 
             if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
                 cbuffer = new float[nrofchannels][len / nrofchannels];
             }

@@ -253,10 +261,11 @@
                 }
             }
             return len - remain * nrofchannels;
         }
 
+        @Override
         public void reset() throws IOException {
             ais.reset();
             if (mark_ibuffer == null)
                 return;
             ibuffer_index = mark_ibuffer_index;

@@ -269,10 +278,11 @@
                 }
             }
 
         }
 
+        @Override
         public long skip(long len) throws IOException {
             if (len > 0)
                 return 0;
             if (skipbuffer == null)
                 skipbuffer = new float[1024 * targetFormat.getFrameSize()];

@@ -300,10 +310,11 @@
 
             super(FloatControl.Type.MASTER_GAIN, -80f, 6.0206f, 80f / 128.0f,
                     -1, 0.0f, "dB", "Minimum", "", "Maximum");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             calcVolume();
         }
     }

@@ -312,10 +323,11 @@
 
         private Mute() {
             super(BooleanControl.Type.MUTE, false, "True", "False");
         }
 
+        @Override
         public void setValue(boolean newValue) {
             super.setValue(newValue);
             calcVolume();
         }
     }

@@ -324,10 +336,11 @@
 
         private ApplyReverb() {
             super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
         }
 
+        @Override
         public void setValue(boolean newValue) {
             super.setValue(newValue);
             calcVolume();
         }
 

@@ -338,10 +351,11 @@
         private Balance() {
             super(FloatControl.Type.BALANCE, -1.0f, 1.0f, (1.0f / 128.0f), -1,
                     0.0f, "", "Left", "Center", "Right");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             calcVolume();
         }
 

@@ -352,15 +366,17 @@
         private Pan() {
             super(FloatControl.Type.PAN, -1.0f, 1.0f, (1.0f / 128.0f), -1,
                     0.0f, "", "Left", "Center", "Right");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             balance_control.setValue(newValue);
         }
 
+        @Override
         public float getValue() {
             return balance_control.getValue();
         }
 
     }

@@ -370,10 +386,11 @@
         private ReverbSend() {
             super(FloatControl.Type.REVERB_SEND, -80f, 6.0206f, 80f / 128.0f,
                     -1, -80f, "dB", "Minimum", "", "Maximum");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             balance_control.setValue(newValue);
         }
 

@@ -384,10 +401,11 @@
         private ChorusSend() {
             super(CHORUS_SEND, -80f, 6.0206f, 80f / 128.0f, -1, -80f, "dB",
                     "Minimum", "", "Maximum");
         }
 
+        @Override
         public void setValue(float newValue) {
             super.setValue(newValue);
             balance_control.setValue(newValue);
         }
 

@@ -415,11 +433,11 @@
 
     float eff1gain = 0;
 
     float eff2gain = 0;
 
-    List<LineListener> listeners = new ArrayList<LineListener>();
+    List<LineListener> listeners = new ArrayList<>();
 
     final Object control_mutex;
 
     SoftMixingMixer mixer;
 

@@ -474,26 +492,30 @@
         for (LineListener listener : listener_array) {
             listener.update(event);
         }
     }
 
+    @Override
     public final void addLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
         }
     }
 
+    @Override
     public final void removeLineListener(LineListener listener) {
         synchronized (control_mutex) {
             listeners.add(listener);
         }
     }
 
+    @Override
     public final javax.sound.sampled.Line.Info getLineInfo() {
         return info;
     }
 
+    @Override
     public final Control getControl(Type control) {
         if (control != null) {
             for (int i = 0; i < controls.length; i++) {
                 if (controls[i].getType() == control) {
                     return controls[i];

@@ -502,21 +524,22 @@
         }
         throw new IllegalArgumentException("Unsupported control type : "
                 + control);
     }
 
+    @Override
     public final Control[] getControls() {
         return Arrays.copyOf(controls, controls.length);
     }
 
+    @Override
     public final boolean isControlSupported(Type control) {
         if (control != null) {
             for (int i = 0; i < controls.length; i++) {
                 if (controls[i].getType() == control) {
                     return true;
                 }
             }
         }
         return false;
     }
-
 }
< prev index next >