diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java
index 9f5f09bbd1e..1745c910b9c 100644
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java
@@ -124,7 +124,9 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
if (!progressBar.isIndeterminate()) return;
stopAnimationTimer();
// start the animation thread
- startAnimationTimer();
+ if (progressBar.isDisplayable()) {
+ startAnimationTimer();
+ }
}
if ("JProgressBar.style".equals(prop)) {
@@ -141,7 +143,9 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
public void ancestorAdded(final AncestorEvent e) {
if (!progressBar.isIndeterminate()) return;
- startAnimationTimer();
+ if (progressBar.isDisplayable()) {
+ startAnimationTimer();
+ }
}
public void ancestorMoved(final AncestorEvent e) { }
diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
index 7a385a65adb..682769ac2d2 100644
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
@@ -807,6 +807,18 @@ AWT_ASSERT_APPKIT_THREAD;
- (void)sendEvent:(NSEvent *)event {
if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
+ // Move parent windows to front and make sure that a child window is displayed
+ // in front of its nearest parent.
+ if (self.ownerWindow != nil) {
+ JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
+ jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+ if (platformWindow != NULL) {
+ static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V");
+ JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings);
+ (*env)->DeleteLocalRef(env, platformWindow);
+ }
+ }
+ [self orderChildWindows:YES];
NSPoint p = [NSEvent mouseLocation];
NSRect frame = [self.nsWindow frame];
@@ -1159,6 +1171,16 @@ JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow orderBack:nil];
+ // Order parent windows
+ AWTWindow *awtWindow = (AWTWindow*)[nsWindow delegate];
+ while (awtWindow.ownerWindow != nil) {
+ awtWindow = awtWindow.ownerWindow;
+ if ([AWTWindow isJavaPlatformWindowVisible:awtWindow.nsWindow]) {
+ [awtWindow.nsWindow orderBack:nil];
+ }
+ }
+ // Order child windows
+ [(AWTWindow*)[nsWindow delegate] orderChildWindows:NO];
}];
JNF_COCOA_EXIT(env);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java
index 14aa2540acb..dd35d2e9204 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java
@@ -47,7 +47,7 @@ public abstract class TIFFColorConverter {
* @throws NullPointerException if {@code result} is
* {@code null}.
* @throws ArrayIndexOutOfBoundsException if
- * {@code result.length < 3}.
+ * {@code result.length < 3}.
*/
public abstract void fromRGB(float r, float g, float b, float[] result);
@@ -63,7 +63,7 @@ public abstract class TIFFColorConverter {
* @throws NullPointerException if {@code rgb} is
* {@code null}.
* @throws ArrayIndexOutOfBoundsException if
- * {@code rgb.length < 3}.
+ * {@code rgb.length < 3}.
*/
public abstract void toRGB(float x0, float x1, float x2, float[] rgb);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java
index bdd31218e03..f89d0de18b6 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java
@@ -353,7 +353,7 @@ public abstract class TIFFDecompressor {
*
The pixels in the source region to be copied are
* those with X coordinates of the form {@code activeSrcMinX +
* k*subsampleX}, where {@code k} is an integer such
- * that {@code 0 ≤ k < dstWidth}.
+ * that {@code 0 <= k < dstWidth}.
*/
protected int activeSrcMinX;
@@ -365,7 +365,7 @@ public abstract class TIFFDecompressor {
*
The pixels in the source region to be copied are
* those with Y coordinates of the form {@code activeSrcMinY +
* k*subsampleY}, where {@code k} is an integer such
- * that {@code 0 ≤ k < dstHeight}.
+ * that {@code 0 <= k < dstHeight}.
*/
protected int activeSrcMinY;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java
index 46d1419ee4c..0a305c09726 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java
@@ -49,6 +49,45 @@ public class TIFFIFD extends TIFFDirectory {
private long stripOrTileOffsetsPosition = -1;
private long lastPosition = -1;
+
+ /**
+ * Converts a {@code TIFFDirectory} to a {@code TIFFIFD}.
+ */
+ public static TIFFIFD getDirectoryAsIFD(TIFFDirectory dir) {
+ if(dir instanceof TIFFIFD) {
+ return (TIFFIFD)dir;
+ }
+
+ TIFFIFD ifd = new TIFFIFD(Arrays.asList(dir.getTagSets()),
+ dir.getParentTag());
+ TIFFField[] fields = dir.getTIFFFields();
+ int numFields = fields.length;
+ for(int i = 0; i < numFields; i++) {
+ TIFFField f = fields[i];
+ TIFFTag tag = f.getTag();
+ if(tag.isIFDPointer()) {
+ TIFFDirectory subDir = null;
+ if (f.hasDirectory()) {
+ subDir = f.getDirectory();
+ } else if (f.getData() instanceof TIFFDirectory) {
+ subDir = (TIFFDirectory)f.getData();
+ }
+ if (subDir != null) {
+ TIFFDirectory subIFD = getDirectoryAsIFD(subDir);
+ f = new TIFFField(tag, f.getType(), (long)f.getCount(),
+ subIFD);
+ } else {
+ f = null;
+ }
+ }
+ if (f != null) {
+ ifd.addTIFFField(f);
+ }
+ }
+
+ return ifd;
+ }
+
public static TIFFTag getTag(int tagNumber, List tagSets) {
Iterator iter = tagSets.iterator();
while (iter.hasNext()) {
@@ -704,7 +743,7 @@ public class TIFFIFD extends TIFFDirectory {
pos = nextSpace;
if (tag.isIFDPointer() && f.hasDirectory()) {
- TIFFIFD subIFD = (TIFFIFD)f.getDirectory();
+ TIFFIFD subIFD = getDirectoryAsIFD(f.getDirectory());
subIFD.writeToStream(stream);
nextSpace = subIFD.lastPosition;
} else {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java
index 933c2da5a6c..a1455315331 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java
@@ -132,7 +132,7 @@ public class TIFFImageMetadata extends IIOMetadata {
if (tag == null) {
node = f.getAsNativeNode();
} else if (tag.isIFDPointer() && f.hasDirectory()) {
- TIFFIFD subIFD = (TIFFIFD)f.getDirectory();
+ TIFFIFD subIFD = TIFFIFD.getDirectoryAsIFD(f.getDirectory());
// Recurse
node = getIFDAsTree(subIFD, tag.getName(), tag.getNumber());
@@ -1465,8 +1465,14 @@ public class TIFFImageMetadata extends IIOMetadata {
String className = st.nextToken();
Object o = null;
+ Class> setClass = null;
try {
- Class> setClass = Class.forName(className);
+ ClassLoader cl = TIFFImageMetadata.class.getClassLoader();
+ setClass = Class.forName(className, false, cl);
+ if (!TIFFTagSet.class.isAssignableFrom(setClass)) {
+ fatal(node, "TagSets in IFD must be subset of"
+ + " TIFFTagSet class");
+ }
Method getInstanceMethod =
setClass.getMethod("getInstance", (Class[])null);
o = getInstanceMethod.invoke(null, (Object[])null);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java
index 317027351fc..bf143b4a7ae 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java
@@ -35,6 +35,7 @@ import java.awt.image.ComponentColorModel;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
+import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
@@ -189,8 +190,8 @@ public class TIFFImageReader extends ImageReader {
// Seek to start of first IFD
long offset = stream.readUnsignedInt();
- imageStartPosition.add(Long.valueOf(offset));
stream.seek(offset);
+ imageStartPosition.add(Long.valueOf(offset));
} catch (IOException e) {
throw new IIOException("I/O error reading header!", e);
}
@@ -201,10 +202,10 @@ public class TIFFImageReader extends ImageReader {
private int locateImage(int imageIndex) throws IIOException {
readHeader();
- try {
- // Find closest known index
- int index = Math.min(imageIndex, imageStartPosition.size() - 1);
+ // Find closest known index
+ int index = Math.min(imageIndex, imageStartPosition.size() - 1);
+ try {
// Seek to that position
Long l = imageStartPosition.get(index);
stream.seek(l.longValue());
@@ -212,6 +213,11 @@ public class TIFFImageReader extends ImageReader {
// Skip IFDs until at desired index or last image found
while (index < imageIndex) {
int count = stream.readUnsignedShort();
+ // If zero-entry IFD, decrement the index and exit the loop
+ if (count == 0) {
+ imageIndex = index > 0 ? index - 1 : 0;
+ break;
+ }
stream.skipBytes(12 * count);
long offset = stream.readUnsignedInt();
@@ -219,12 +225,17 @@ public class TIFFImageReader extends ImageReader {
return index;
}
- imageStartPosition.add(Long.valueOf(offset));
stream.seek(offset);
+ imageStartPosition.add(Long.valueOf(offset));
++index;
}
- } catch (IOException e) {
- throw new IIOException("Couldn't seek!", e);
+ } catch (EOFException eofe) {
+ forwardWarningMessage("Ignored " + eofe);
+
+ // Ran off the end of stream: decrement index
+ imageIndex = index > 0 ? index - 1 : 0;
+ } catch (IOException ioe) {
+ throw new IIOException("Couldn't seek!", ioe);
}
if (currIndex != imageIndex) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
index 9b5e7543203..9924c3d2210 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
@@ -1478,7 +1478,7 @@ public class TIFFImageWriter extends ImageWriter {
(ExifParentTIFFTagSet.TAG_EXIF_IFD_POINTER);
if(f != null && f.hasDirectory()) {
// Retrieve the Exif IFD.
- exifIFD = (TIFFIFD)f.getDirectory();
+ exifIFD = TIFFIFD.getDirectoryAsIFD(f.getDirectory());
} else if(isPrimaryIFD) {
// Create the Exif IFD.
List exifTagSets = new ArrayList(1);
@@ -3622,6 +3622,8 @@ public class TIFFImageWriter extends ImageWriter {
streamMetadata = null;
imageMetadata = null;
+ isRescaling = false;
+
isWritingSequence = false;
isWritingEmpty = false;
isInsertingEmpty = false;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFMetadataFormat.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFMetadataFormat.java
index 94bbdde378c..1091cab9bb2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFMetadataFormat.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFMetadataFormat.java
@@ -49,7 +49,8 @@ public abstract class TIFFMetadataFormat implements IIOMetadataFormat {
}
try {
ResourceBundle bundle =
- ResourceBundle.getBundle(resourceBaseName, locale);
+ ResourceBundle.getBundle(resourceBaseName, locale,
+ this.getClass().getModule());
return bundle.getString(key);
} catch (MissingResourceException e) {
return null;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
index 641bfed328b..0dbe039f54c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
@@ -657,7 +657,6 @@ class XPStyle {
protected void paintToImage(Component c, Image image, Graphics g,
int w, int h, Object[] args) {
- boolean accEnabled = false;
Skin skin = (Skin)args[0];
Part part = skin.part;
State state = (State)args[1];
@@ -668,6 +667,8 @@ class XPStyle {
c = skin.component;
}
BufferedImage bi = (BufferedImage)image;
+ w = bi.getWidth();
+ h = bi.getHeight();
WritableRaster raster = bi.getRaster();
DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java
index b0f85799049..96ca26c7b5b 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java
@@ -32,7 +32,6 @@ import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineUnavailableException;
-
/**
* AbstractDataLine
*
@@ -147,36 +146,35 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
}
}
-
public final void open(AudioFormat format) throws LineUnavailableException {
open(format, AudioSystem.NOT_SPECIFIED);
}
-
/**
* This implementation always returns 0.
*/
+ @Override
public int available() {
return 0;
}
-
/**
* This implementation does nothing.
*/
+ @Override
public void drain() {
if (Printer.trace) Printer.trace("AbstractDataLine: drain");
}
-
/**
* This implementation does nothing.
*/
+ @Override
public void flush() {
if (Printer.trace) Printer.trace("AbstractDataLine: flush");
}
-
+ @Override
public final void start() {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized(mixer) {
@@ -200,7 +198,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
if (Printer.trace) Printer.trace("< "+getClass().getName()+".start() - AbstractDataLine");
}
-
+ @Override
public final void stop() {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
@@ -245,15 +243,17 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
// in MixerSourceLine and MixerClip, and I want to touch as little
// code as possible to change isStarted() back to isRunning().
+ @Override
public final boolean isRunning() {
return started;
}
+ @Override
public final boolean isActive() {
return active;
}
-
+ @Override
public final long getMicrosecondPosition() {
long microseconds = getLongFramePosition();
@@ -263,12 +263,12 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
return microseconds;
}
-
+ @Override
public final AudioFormat getFormat() {
return format;
}
-
+ @Override
public final int getBufferSize() {
return bufferSize;
}
@@ -283,11 +283,11 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
/**
* This implementation returns AudioSystem.NOT_SPECIFIED.
*/
+ @Override
public final float getLevel() {
return (float)AudioSystem.NOT_SPECIFIED;
}
-
// HELPER METHODS
/**
@@ -317,19 +317,12 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
synchronized (this) {
- //if (Printer.debug) Printer.debug(" AbstractDataLine: setActive: this.active: " + this.active);
- //if (Printer.debug) Printer.debug(" active: " + active);
-
if (this.active != active) {
this.active = active;
//sendEvents = true;
}
}
- //if (Printer.debug) Printer.debug(" this.active: " + this.active);
- //if (Printer.debug) Printer.debug(" sendEvents: " + sendEvents);
-
-
// $$kk: 11.19.99: take ACTIVE / INACTIVE / EOM events out;
// putting them in is technically an API change.
// do not generate ACTIVE / INACTIVE events for now
@@ -356,18 +349,12 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
synchronized (this) {
- //if (Printer.debug) Printer.debug(" AbstractDataLine: setStarted: this.started: " + this.started);
- //if (Printer.debug) Printer.debug(" started: " + started);
-
if (this.started != started) {
this.started = started;
sendEvents = true;
}
}
- //if (Printer.debug) Printer.debug(" this.started: " + this.started);
- //if (Printer.debug) Printer.debug(" sendEvents: " + sendEvents);
-
if (sendEvents) {
if (started) {
@@ -379,7 +366,6 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
if (Printer.trace) Printer.trace("< AbstractDataLine: setStarted completed");
}
-
/**
* This method generates a STOP event and sets the started state to false.
* It is here for historic reasons when an EOM event existed.
@@ -393,9 +379,6 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
if (Printer.trace) Printer.trace("< AbstractDataLine: setEOM() completed");
}
-
-
-
// OVERRIDES OF ABSTRACT LINE METHODS
/**
@@ -404,6 +387,7 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
* line is open, this should return quietly because the values
* requested will match the current ones.
*/
+ @Override
public final void open() throws LineUnavailableException {
if (Printer.trace) Printer.trace("> "+getClass().getName()+".open() - AbstractDataLine");
@@ -413,11 +397,11 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
if (Printer.trace) Printer.trace("< "+getClass().getName()+".open() - AbstractDataLine");
}
-
/**
* This should also stop the line. The closed line should not be running or active.
* After we close the line, we reset the format and buffer size to the defaults.
*/
+ @Override
public final void close() {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized (mixer) {
@@ -445,12 +429,6 @@ abstract class AbstractDataLine extends AbstractLine implements DataLine {
if (Printer.trace) Printer.trace("< "+getClass().getName()+".close() - in AbstractDataLine");
}
-
- // IMPLEMENTATIONS OF ABSTRACT LINE ABSTRACE METHODS
-
-
- // ABSTRACT METHODS
-
abstract void implOpen(AudioFormat format, int bufferSize) throws LineUnavailableException;
abstract void implClose();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java
index 6c349b968e8..53738c13353 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java
@@ -36,7 +36,6 @@ import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
-
/**
* AbstractLine
*
@@ -72,19 +71,19 @@ abstract class AbstractLine implements Line {
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)) ) {
@@ -93,22 +92,22 @@ abstract class AbstractLine implements Line {
}
}
-
/**
* 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];
@@ -119,7 +118,7 @@ abstract class AbstractLine implements Line {
return returnedArray;
}
-
+ @Override
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
@@ -135,7 +134,7 @@ abstract class AbstractLine implements Line {
return false;
}
-
+ @Override
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
@@ -150,10 +149,8 @@ abstract class AbstractLine implements Line {
throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
-
// HELPER METHODS
-
/**
* This method sets the open state and generates
* events if it changes.
@@ -182,7 +179,6 @@ abstract class AbstractLine implements Line {
if (Printer.trace) Printer.trace("< "+getClass().getName()+" (AbstractLine): setOpen(" + open + ") this.open: " + this.open);
}
-
/**
* Send line events.
*/
@@ -190,7 +186,6 @@ abstract class AbstractLine implements Line {
getEventDispatcher().sendAudioEvents(event, listeners);
}
-
/**
* This is an error in the API: getFramePosition
* should return a long value. At CD quality,
@@ -200,7 +195,6 @@ abstract class AbstractLine implements Line {
return (int) getLongFramePosition();
}
-
/**
* Return the frame position in a long value
* This implementation returns AudioSystem.NOT_SPECIFIED.
@@ -209,7 +203,6 @@ abstract class AbstractLine implements Line {
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!!
@@ -232,8 +225,8 @@ abstract class AbstractLine implements Line {
}
}
- // ABSTRACT METHODS
-
+ @Override
public abstract void open() throws LineUnavailableException;
+ @Override
public abstract void close();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java
index e9cab2c2fa4..672b76f926b 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java
@@ -26,10 +26,17 @@
package com.sun.media.sound;
import java.util.ArrayList;
-import java.util.List;
import java.util.Collections;
+import java.util.List;
-import javax.sound.midi.*;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDeviceReceiver;
+import javax.sound.midi.MidiDeviceTransmitter;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
/**
@@ -43,11 +50,8 @@ import javax.sound.midi.*;
*/
abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice {
- // STATIC VARIABLES
private static final boolean TRACE_TRANSMITTER = false;
- // INSTANCE VARIABLES
-
private ArrayList receiverList;
private TransmitterList transmitterList;
@@ -62,7 +66,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
private final MidiDevice.Info info;
-
// DEVICE STATE
private volatile boolean open;
@@ -73,15 +76,10 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
private List openKeepingObjects;
/**
- * This is the device handle returned from native code
+ * This is the device handle returned from native code.
*/
protected volatile long id;
-
-
- // CONSTRUCTOR
-
-
/**
* Constructs an AbstractMidiDevice with the specified info object.
* @param info the description of the device
@@ -99,9 +97,9 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if(Printer.trace) Printer.trace("<< AbstractMidiDevice CONSTRUCTOR completed");
}
-
// MIDI DEVICE METHODS
+ @Override
public final MidiDevice.Info getDeviceInfo() {
return info;
}
@@ -111,6 +109,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
* opened the device implicitly from closing it. The only way to close the device after
* this call is a call to close().
*/
+ @Override
public final void open() throws MidiUnavailableException {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: open()");
synchronized(this) {
@@ -120,8 +119,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if (Printer.trace) Printer.trace("< AbstractMidiDevice: open() completed");
}
-
-
/** Open the device implicitly.
* This method is intended to be used by AbstractReceiver
* and BasicTransmitter. Actually, it is called by getReceiverReferenceCounting() and
@@ -146,7 +143,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if (Printer.trace) Printer.trace("< AbstractMidiDevice: openInternal() completed");
}
-
private void doOpen() throws MidiUnavailableException {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: doOpen()");
synchronized(this) {
@@ -158,7 +154,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if (Printer.trace) Printer.trace("< AbstractMidiDevice: doOpen() completed");
}
-
+ @Override
public final void close() {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: close()");
synchronized (this) {
@@ -168,7 +164,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if (Printer.trace) Printer.trace("< AbstractMidiDevice: close() completed");
}
-
/** Close the device for an object that implicitely opened it.
* This method is intended to be used by Transmitter.close() and Receiver.close().
* Those methods should pass this for the object parameter. Since Transmitters or Receivers
@@ -196,7 +191,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if (Printer.trace) Printer.trace("< AbstractMidiDevice: closeInternal() completed");
}
-
public final void doClose() {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: doClose()");
synchronized(this) {
@@ -208,12 +202,11 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
if (Printer.trace) Printer.trace("< AbstractMidiDevice: doClose() completed");
}
-
+ @Override
public final boolean isOpen() {
return open;
}
-
protected void implClose() {
synchronized (traRecLock) {
if (receiverList != null) {
@@ -230,21 +223,21 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
-
/**
* This implementation always returns -1.
* Devices that actually provide this should over-ride
* this method.
*/
+ @Override
public long getMicrosecondPosition() {
return -1;
}
-
/** Return the maximum number of Receivers supported by this device.
Depending on the return value of hasReceivers(), this method returns either 0 or -1.
Subclasses should rather override hasReceivers() than override this method.
*/
+ @Override
public final int getMaxReceivers() {
if (hasReceivers()) {
return -1;
@@ -253,11 +246,11 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
-
/** Return the maximum number of Transmitters supported by this device.
Depending on the return value of hasTransmitters(), this method returns either 0 or -1.
Subclasses should override hasTransmitters().
*/
+ @Override
public final int getMaxTransmitters() {
if (hasTransmitters()) {
return -1;
@@ -266,7 +259,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
-
/** Retrieve a Receiver for this device.
This method returns the value returned by createReceiver(), if it doesn't throw
an exception. Subclasses should rather override createReceiver() than override
@@ -274,6 +266,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
If createReceiver returns a Receiver, it is added to the internal list
of Receivers (see getReceiversList)
*/
+ @Override
public final Receiver getReceiver() throws MidiUnavailableException {
Receiver receiver;
synchronized (traRecLock) {
@@ -283,7 +276,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return receiver;
}
-
+ @Override
@SuppressWarnings("unchecked") // Cast of result of clone
public final List getReceivers() {
List recs;
@@ -298,12 +291,12 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return recs;
}
-
/**
* This implementation uses createTransmitter, which may throw an exception.
* If a transmitter is returned in createTransmitter, it is added to the internal
* TransmitterList
*/
+ @Override
public final Transmitter getTransmitter() throws MidiUnavailableException {
Transmitter transmitter;
synchronized (traRecLock) {
@@ -313,7 +306,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return transmitter;
}
-
+ @Override
@SuppressWarnings("unchecked") // Cast of result of clone
public final List getTransmitters() {
List tras;
@@ -328,19 +321,16 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return tras;
}
-
- // HELPER METHODS
-
final long getId() {
return id;
}
-
// REFERENCE COUNTING
/** Retrieve a Receiver and open the device implicitly.
This method is called by MidiSystem.getReceiver().
*/
+ @Override
public final Receiver getReceiverReferenceCounting()
throws MidiUnavailableException {
/* Keep this order of commands! If getReceiver() throws an exception,
@@ -354,10 +344,10 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return receiver;
}
-
/** Retrieve a Transmitter and open the device implicitly.
This method is called by MidiSystem.getTransmitter().
*/
+ @Override
public final Transmitter getTransmitterReferenceCounting()
throws MidiUnavailableException {
/* Keep this order of commands! If getTransmitter() throws an exception,
@@ -371,7 +361,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return transmitter;
}
-
/** Return the list of objects that have opened the device implicitely.
*/
private synchronized List getOpenKeepingObjects() {
@@ -381,23 +370,19 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return openKeepingObjects;
}
-
-
// RECEIVER HANDLING METHODS
-
/** Return the internal list of Receivers, possibly creating it first.
*/
private List getReceiverList() {
synchronized (traRecLock) {
if (receiverList == null) {
- receiverList = new ArrayList();
+ receiverList = new ArrayList<>();
}
}
return receiverList;
}
-
/** Returns if this device supports Receivers.
Subclasses that use Receivers should override this method to
return true. They also should override createReceiver().
@@ -408,7 +393,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return false;
}
-
/** Create a Receiver object.
throwing an exception here means that Receivers aren't enabled.
Subclasses that use Receivers should override this method with
@@ -420,8 +404,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
throw new MidiUnavailableException("MIDI IN receiver not available");
}
-
-
// TRANSMITTER HANDLING
/** Return the internal list of Transmitters, possibly creating it first.
@@ -435,7 +417,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return transmitterList;
}
-
/** Returns if this device supports Transmitters.
Subclasses that use Transmitters should override this method to
return true. They also should override createTransmitter().
@@ -446,7 +427,6 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
return false;
}
-
/** Create a Transmitter object.
throwing an exception here means that Transmitters aren't enabled.
Subclasses that use Transmitters should override this method with
@@ -458,20 +438,16 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
throw new MidiUnavailableException("MIDI OUT transmitter not available");
}
- // ABSTRACT METHODS
-
protected abstract void implOpen() throws MidiUnavailableException;
-
/**
- * close this device if discarded by the garbage collector
+ * close this device if discarded by the garbage collector.
*/
+ @Override
protected final void finalize() {
close();
}
- // INNER CLASSES
-
/** Base class for Receivers.
Subclasses that use Receivers must use this base class, since it
contains magic necessary to manage implicit closing the device.
@@ -550,6 +526,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
this.tlist = tlist;
}
+ @Override
public final void setReceiver(Receiver receiver) {
if (tlist != null && this.receiver != receiver) {
if (Printer.debug) Printer.debug("Transmitter "+toString()+": set receiver "+receiver);
@@ -558,16 +535,17 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
+ @Override
public final Receiver getReceiver() {
return receiver;
}
-
/** Close the Transmitter.
* Here, the call to the magic method closeInternal() takes place.
* Therefore, subclasses that override this method must call
* 'super.close()'.
*/
+ @Override
public final void close() {
AbstractMidiDevice.this.closeInternal(this);
if (tlist != null) {
@@ -577,19 +555,19 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
+ @Override
public final MidiDevice getMidiDevice() {
return AbstractMidiDevice.this;
}
} // class BasicTransmitter
-
/**
- * a class to manage a list of transmitters
+ * a class to manage a list of transmitters.
*/
final class TransmitterList {
- private final ArrayList transmitters = new ArrayList();
+ private final ArrayList transmitters = new ArrayList<>();
private MidiOutDevice.MidiOutReceiver midiOutReceiver;
// how many transmitters must be present for optimized
@@ -712,9 +690,8 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
-
/**
- * Send this message to all transmitters
+ * Send this message to all transmitters.
*/
void sendMessage(MidiMessage message, long timeStamp) {
if (message instanceof FastShortMessage) {
@@ -746,8 +723,5 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice
}
}
}
-
-
} // TransmitterList
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
index 6ff1ccde6b0..563cb294766 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java
@@ -52,7 +52,6 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
// also for memory's sake, do not initialize the arrays here
}
-
final synchronized void readDeviceInfos() {
Info[] infos = getInfoCache();
MidiDevice[] devices = getDeviceCache();
@@ -148,10 +147,6 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
throw MidiUtils.unsupportedDevice(info);
}
-
- // INNER CLASSES
-
-
/**
* Info class for MidiDevices. Adds an index value for
* making native references to a particular device.
@@ -182,9 +177,6 @@ public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
} // class Info
-
- // ABSTRACT METHODS
-
abstract int getNumDevices();
abstract MidiDevice[] getDeviceCache();
abstract void setDeviceCache(MidiDevice[] devices);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java
index 83378615b77..7389e8dbeac 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java
@@ -28,9 +28,9 @@ 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
@@ -76,29 +76,18 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
*/
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 sourceLines = new Vector<>();
-
/**
* Target lines currently open.
*/
private final Vector targetLines = new Vector<>();
-
/**
* Constructs a new AbstractMixer.
* @param mixer the mixer with which this line is associated
@@ -124,30 +113,28 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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;
@@ -168,7 +155,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
return returnedArray;
}
-
+ @Override
public final Line.Info[] getTargetLineInfo(Line.Info info) {
int i;
@@ -189,7 +176,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
return returnedArray;
}
-
+ @Override
public final boolean isLineSupported(Line.Info info) {
int i;
@@ -211,9 +198,10 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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;
@@ -221,7 +209,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
protected abstract void implStop();
protected abstract void implClose();
-
+ @Override
public final Line[] getSourceLines() {
Line[] localLines;
@@ -238,7 +226,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
return localLines;
}
-
+ @Override
public final Line[] getTargetLines() {
Line[] localLines;
@@ -255,37 +243,37 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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);
}
@@ -307,10 +295,8 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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
@@ -357,7 +343,6 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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.
@@ -388,10 +373,10 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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()) {
@@ -439,7 +424,6 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
if (Printer.trace) Printer.trace("<< AbstractMixer: start(" + line + ") succeeded");
}
-
/**
* Stops the mixer if this was the last running line.
*/
@@ -492,8 +476,6 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
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
@@ -510,7 +492,6 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
return false;
}
-
/**
* Determines whether this is a target line for this mixer.
* Right now this just checks whether it's supported, but should
@@ -527,7 +508,6 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
return false;
}
-
/**
* Returns the first complete Line.Info object it finds that
* matches the one specified, or null if no matching Line.Info
@@ -551,8 +531,6 @@ abstract class AbstractMixer extends AbstractLine implements Mixer {
return targetLineInfo[i];
}
}
-
return null;
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java
index 010bd3d4b56..c7e4ccce344 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java
@@ -87,5 +87,4 @@ final class AiffFileFormat extends StandardFileFormat {
int getSsndChunkOffset() {
return getHeaderSize()-16;
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java
index 20dc68409ff..c8d9cd8d2db 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java
@@ -29,7 +29,6 @@ import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
-import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFileFormat.Type;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java
index e117348dbdf..30dd2e8d726 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java
@@ -33,7 +33,6 @@ import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-
/**
* A-law encodes linear data, and decodes a-law data to linear data.
*
@@ -52,7 +51,7 @@ public final class AlawCodec extends SunCodec {
0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF};
/**
- * Initializes the decode tables
+ * Initializes the decode tables.
*/
static {
for (int i=0;i<256;i++) {
@@ -83,10 +82,7 @@ public final class AlawCodec extends SunCodec {
super(alawEncodings, alawEncodings);
}
- // NEW CODE
-
- /**
- */
+ @Override
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED )) {
@@ -117,8 +113,7 @@ public final class AlawCodec extends SunCodec {
}
}
- /**
- */
+ @Override
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
Objects.requireNonNull(sourceFormat);
if( (targetEncoding.equals( AudioFormat.Encoding.PCM_SIGNED ) && sourceFormat.getEncoding().equals( AudioFormat.Encoding.ALAW)) ||
@@ -129,8 +124,7 @@ public final class AlawCodec extends SunCodec {
}
}
- /**
- */
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream){
AudioFormat sourceFormat = sourceStream.getFormat();
AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
@@ -169,9 +163,7 @@ public final class AlawCodec extends SunCodec {
return getConvertedStream(targetFormat, sourceStream);
}
- /**
- * use old code...
- */
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
throw new IllegalArgumentException("Unsupported conversion: "
@@ -180,10 +172,6 @@ public final class AlawCodec extends SunCodec {
return getConvertedStream( targetFormat, sourceStream );
}
-
- // OLD CODE
-
-
/**
* Opens the codec with the specified parameters.
* @param stream stream from which data to be processed should be read
@@ -192,7 +180,6 @@ public final class AlawCodec extends SunCodec {
* @throws IllegalArgumentException if the format combination supplied is
* not supported.
*/
- /* public AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) { */
private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {
AudioInputStream cs = null;
@@ -201,7 +188,7 @@ public final class AlawCodec extends SunCodec {
if( inputFormat.matches(outputFormat) ) {
cs = stream;
} else {
- cs = (AudioInputStream) (new AlawCodecStream(stream, outputFormat));
+ cs = new AlawCodecStream(stream, outputFormat);
}
return cs;
@@ -214,7 +201,6 @@ public final class AlawCodec extends SunCodec {
* returns an array of length 0.
* @return array of supported output formats.
*/
- /* public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
@@ -343,18 +329,20 @@ public final class AlawCodec extends SunCodec {
* Note that this won't actually read anything; must read in
* two-byte units.
*/
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
return read(b, 0, b.length);
}
-
+ @Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
// don't read fractional frames
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
index 11b0fa6ee6e..de9d124753f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
@@ -45,6 +45,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
*/
public final class AudioFileSoundbankReader extends SoundbankReader {
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
try {
@@ -59,6 +60,7 @@ public final class AudioFileSoundbankReader extends SoundbankReader {
}
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
stream.mark(512);
@@ -108,6 +110,7 @@ public final class AudioFileSoundbankReader extends SoundbankReader {
}
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
try {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java
index 77930d05657..31d7ff51d5e 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java
@@ -89,8 +89,9 @@ public abstract class AudioFloatConverter {
mask = (byte) 0xFF;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
byte[] ret = converter.toByteArray(in_buff, in_offset, in_len,
out_buff, out_offset);
@@ -102,8 +103,9 @@ public abstract class AudioFloatConverter {
return ret;
}
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
if (mask_buffer == null || mask_buffer.length < in_buff.length)
mask_buffer = new byte[in_buff.length];
System.arraycopy(in_buff, 0, mask_buffer, 0, in_buff.length);
@@ -132,8 +134,9 @@ public abstract class AudioFloatConverter {
double[] double_buff = null;
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int in_len = out_len * 8;
if (bytebuffer == null || bytebuffer.capacity() < in_len) {
bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -154,8 +157,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int out_len = in_len * 8;
if (bytebuffer == null || bytebuffer.capacity() < out_len) {
bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -184,8 +188,9 @@ public abstract class AudioFloatConverter {
double[] double_buff = null;
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int in_len = out_len * 8;
if (bytebuffer == null || bytebuffer.capacity() < in_len) {
bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -206,8 +211,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int out_len = in_len * 8;
if (bytebuffer == null || bytebuffer.capacity() < out_len) {
bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -240,8 +246,9 @@ public abstract class AudioFloatConverter {
FloatBuffer floatbuffer = null;
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int in_len = out_len * 4;
if (bytebuffer == null || bytebuffer.capacity() < in_len) {
bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -255,8 +262,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int out_len = in_len * 4;
if (bytebuffer == null || bytebuffer.capacity() < out_len) {
bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -277,8 +285,9 @@ public abstract class AudioFloatConverter {
FloatBuffer floatbuffer = null;
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int in_len = out_len * 4;
if (bytebuffer == null || bytebuffer.capacity() < in_len) {
bytebuffer = ByteBuffer.allocate(in_len).order(
@@ -292,8 +301,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int out_len = in_len * 4;
if (bytebuffer == null || bytebuffer.capacity() < out_len) {
bytebuffer = ByteBuffer.allocate(out_len).order(
@@ -316,8 +326,9 @@ public abstract class AudioFloatConverter {
// PCM 8 bit, signed
private static class AudioFloatConversion8S extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -327,8 +338,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -341,8 +353,9 @@ public abstract class AudioFloatConverter {
// PCM 8 bit, unsigned
private static class AudioFloatConversion8U extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -352,8 +365,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -372,8 +386,9 @@ public abstract class AudioFloatConverter {
// PCM 16 bit, signed, little-endian
private static class AudioFloatConversion16SL extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int len = out_offset + out_len;
for (int ox = out_offset; ox < len; ox++) {
@@ -383,8 +398,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ox = out_offset;
int len = in_offset + in_len;
for (int ix = in_offset; ix < len; ix++) {
@@ -399,8 +415,9 @@ public abstract class AudioFloatConverter {
// PCM 16 bit, signed, big-endian
private static class AudioFloatConversion16SB extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -410,8 +427,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -426,8 +444,9 @@ public abstract class AudioFloatConverter {
// PCM 16 bit, unsigned, little-endian
private static class AudioFloatConversion16UL extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -438,8 +457,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -454,8 +474,9 @@ public abstract class AudioFloatConverter {
// PCM 16 bit, unsigned, big-endian
private static class AudioFloatConversion16UB extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -466,8 +487,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -488,8 +510,9 @@ public abstract class AudioFloatConverter {
// PCM 24 bit, signed, little-endian
private static class AudioFloatConversion24SL extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -502,8 +525,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -521,8 +545,9 @@ public abstract class AudioFloatConverter {
// PCM 24 bit, signed, big-endian
private static class AudioFloatConversion24SB extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -535,8 +560,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -554,8 +580,9 @@ public abstract class AudioFloatConverter {
// PCM 24 bit, unsigned, little-endian
private static class AudioFloatConversion24UL extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -567,8 +594,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -585,8 +613,9 @@ public abstract class AudioFloatConverter {
// PCM 24 bit, unsigned, big-endian
private static class AudioFloatConversion24UB extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -598,8 +627,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -622,8 +652,9 @@ public abstract class AudioFloatConverter {
// PCM 32 bit, signed, little-endian
private static class AudioFloatConversion32SL extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -635,8 +666,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -652,8 +684,9 @@ public abstract class AudioFloatConverter {
// PCM 32 bit, signed, big-endian
private static class AudioFloatConversion32SB extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -665,8 +698,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -682,8 +716,9 @@ public abstract class AudioFloatConverter {
// PCM 32 bit, unsigned, little-endian
private static class AudioFloatConversion32UL extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -696,8 +731,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -715,8 +751,9 @@ public abstract class AudioFloatConverter {
// PCM 32 bit, unsigned, big-endian
private static class AudioFloatConversion32UB extends AudioFloatConverter {
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -729,8 +766,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -760,8 +798,9 @@ public abstract class AudioFloatConverter {
this.xbytes = xbytes;
}
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -774,8 +813,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -801,8 +841,9 @@ public abstract class AudioFloatConverter {
this.xbytes = xbytes;
}
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -816,8 +857,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -843,8 +885,9 @@ public abstract class AudioFloatConverter {
this.xbytes = xbytes;
}
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -858,8 +901,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
@@ -886,8 +930,9 @@ public abstract class AudioFloatConverter {
this.xbytes = xbytes;
}
+ @Override
public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
+ float[] out_buff, int out_offset, int out_len) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
@@ -901,8 +946,9 @@ public abstract class AudioFloatConverter {
return out_buff;
}
+ @Override
public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
+ byte[] out_buff, int out_offset) {
int ix = in_offset;
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
index 21ee186cb71..d28729fd7c5 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
@@ -32,9 +32,9 @@ import java.util.Arrays;
import java.util.Objects;
import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.spi.FormatConversionProvider;
/**
@@ -63,6 +63,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
fsize = ((targetFormat.getSampleSizeInBits() + 7) / 8);
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b);
@@ -71,6 +72,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return b[0] & 0xFF;
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int flen = len / fsize;
@@ -83,6 +85,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return ret * fsize;
}
+ @Override
public int available() throws IOException {
int ret = stream.available();
if (ret < 0)
@@ -90,22 +93,27 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return ret * fsize;
}
+ @Override
public void close() throws IOException {
stream.close();
}
+ @Override
public synchronized void mark(int readlimit) {
stream.mark(readlimit * fsize);
}
+ @Override
public boolean markSupported() {
return stream.markSupported();
}
+ @Override
public synchronized void reset() throws IOException {
stream.reset();
}
+ @Override
public long skip(long n) throws IOException {
long ret = stream.skip(n / fsize);
if (ret < 0)
@@ -141,30 +149,37 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
.isBigEndian());
}
+ @Override
public int available() throws IOException {
return (ais.available() / sourceChannels) * targetChannels;
}
+ @Override
public void close() throws IOException {
ais.close();
}
+ @Override
public AudioFormat getFormat() {
return targetFormat;
}
+ @Override
public long getFrameLength() {
return ais.getFrameLength();
}
+ @Override
public void mark(int readlimit) {
ais.mark((readlimit / targetChannels) * sourceChannels);
}
+ @Override
public boolean markSupported() {
return ais.markSupported();
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
int len2 = (len / targetChannels) * sourceChannels;
if (conversion_buffer == null || conversion_buffer.length < len2)
@@ -212,10 +227,12 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return (ret / sourceChannels) * targetChannels;
}
+ @Override
public void reset() throws IOException {
ais.reset();
}
+ @Override
public long skip(long len) throws IOException {
long ret = ais.skip((len / targetChannels) * sourceChannels);
if (ret < 0)
@@ -305,22 +322,27 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
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;
@@ -337,6 +359,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
}
}
+ @Override
public boolean markSupported() {
return ais.markSupported();
}
@@ -381,6 +404,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
@@ -431,6 +455,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return len - remain * nrofchannels;
}
+ @Override
public void reset() throws IOException {
ais.reset();
if (mark_ibuffer == null)
@@ -447,6 +472,7 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
}
+ @Override
public long skip(long len) throws IOException {
if (len < 0)
return 0;
@@ -474,8 +500,9 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
Encoding.PCM_UNSIGNED,
Encoding.PCM_FLOAT};
+ @Override
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
- AudioInputStream sourceStream) {
+ AudioInputStream sourceStream) {
if (!isConversionSupported(targetEncoding, sourceStream.getFormat())) {
throw new IllegalArgumentException(
"Unsupported conversion: " + sourceStream.getFormat()
@@ -496,8 +523,9 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return getAudioInputStream(targetFormat, sourceStream);
}
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat targetFormat,
- AudioInputStream sourceStream) {
+ AudioInputStream sourceStream) {
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
throw new IllegalArgumentException("Unsupported conversion: "
+ sourceStream.getFormat().toString() + " to "
@@ -526,16 +554,19 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
.getFrameLength());
}
+ @Override
public Encoding[] getSourceEncodings() {
return new Encoding[] { Encoding.PCM_SIGNED, Encoding.PCM_UNSIGNED,
Encoding.PCM_FLOAT };
}
+ @Override
public Encoding[] getTargetEncodings() {
return new Encoding[] { Encoding.PCM_SIGNED, Encoding.PCM_UNSIGNED,
Encoding.PCM_FLOAT };
}
+ @Override
public Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
if (AudioFloatConverter.getConverter(sourceFormat) == null)
return new Encoding[0];
@@ -543,14 +574,15 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
Encoding.PCM_FLOAT };
}
+ @Override
public AudioFormat[] getTargetFormats(Encoding targetEncoding,
- AudioFormat sourceFormat) {
+ AudioFormat sourceFormat) {
Objects.requireNonNull(targetEncoding);
if (AudioFloatConverter.getConverter(sourceFormat) == null)
return new AudioFormat[0];
int channels = sourceFormat.getChannels();
- ArrayList formats = new ArrayList();
+ ArrayList formats = new ArrayList<>();
if (targetEncoding.equals(Encoding.PCM_SIGNED))
formats.add(new AudioFormat(Encoding.PCM_SIGNED,
@@ -598,8 +630,9 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return formats.toArray(new AudioFormat[formats.size()]);
}
+ @Override
public boolean isConversionSupported(AudioFormat targetFormat,
- AudioFormat sourceFormat) {
+ AudioFormat sourceFormat) {
Objects.requireNonNull(targetFormat);
if (AudioFloatConverter.getConverter(sourceFormat) == null)
return false;
@@ -612,8 +645,9 @@ public final class AudioFloatFormatConverter extends FormatConversionProvider {
return true;
}
+ @Override
public boolean isConversionSupported(Encoding targetEncoding,
- AudioFormat sourceFormat) {
+ AudioFormat sourceFormat) {
Objects.requireNonNull(targetEncoding);
if (AudioFloatConverter.getConverter(sourceFormat) == null)
return false;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java
index a4fd10429c4..845312ca409 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.ByteArrayInputStream;
@@ -66,14 +67,17 @@ public abstract class AudioFloatInputStream {
}
+ @Override
public AudioFormat getFormat() {
return format;
}
+ @Override
public long getFrameLength() {
return buffer_len;// / format.getFrameSize();
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
if (b == null)
throw new NullPointerException();
@@ -91,6 +95,7 @@ public abstract class AudioFloatInputStream {
return len;
}
+ @Override
public long skip(long len) throws IOException {
if (pos >= buffer_len)
return -1;
@@ -102,21 +107,26 @@ public abstract class AudioFloatInputStream {
return len;
}
+ @Override
public int available() throws IOException {
return buffer_len - pos;
}
+ @Override
public void close() throws IOException {
}
+ @Override
public void mark(int readlimit) {
markpos = pos;
}
+ @Override
public boolean markSupported() {
return true;
}
+ @Override
public void reset() throws IOException {
pos = markpos;
}
@@ -163,14 +173,17 @@ public abstract class AudioFloatInputStream {
this.stream = stream;
}
+ @Override
public AudioFormat getFormat() {
return stream.getFormat();
}
+ @Override
public long getFrameLength() {
return stream.getFrameLength();
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
int b_len = len * framesize_pc;
if (buffer == null || buffer.length < b_len)
@@ -182,6 +195,7 @@ public abstract class AudioFloatInputStream {
return ret / framesize_pc;
}
+ @Override
public long skip(long len) throws IOException {
long b_len = len * framesize_pc;
long ret = stream.skip(b_len);
@@ -190,22 +204,27 @@ public abstract class AudioFloatInputStream {
return ret / framesize_pc;
}
+ @Override
public int available() throws IOException {
return stream.available() / framesize_pc;
}
+ @Override
public void close() throws IOException {
stream.close();
}
+ @Override
public void mark(int readlimit) {
stream.mark(readlimit * framesize_pc);
}
+ @Override
public boolean markSupported() {
return stream.markSupported();
}
+ @Override
public void reset() throws IOException {
stream.reset();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java
index 7479357c580..b7d292a57e5 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java
@@ -22,9 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Map;
+
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Synthesizer;
import javax.sound.sampled.AudioFormat;
@@ -53,7 +55,7 @@ public interface AudioSynthesizer extends Synthesizer {
* @return current audio data format
* @see AudioFormat
*/
- public AudioFormat getFormat();
+ AudioFormat getFormat();
/**
* Gets information about the possible properties for the synthesizer.
@@ -63,8 +65,7 @@ public interface AudioSynthesizer extends Synthesizer {
* describing possible properties. This array may be an empty array if
* no properties are required.
*/
- public AudioSynthesizerPropertyInfo[] getPropertyInfo(
- Map info);
+ AudioSynthesizerPropertyInfo[] getPropertyInfo(Map info);
/**
* Opens the synthesizer and starts rendering audio into
@@ -93,7 +94,7 @@ public interface AudioSynthesizer extends Synthesizer {
* @see #close
* @see #isOpen
*/
- public void open(SourceDataLine line, Map info)
+ void open(SourceDataLine line, Map info)
throws MidiUnavailableException;
/**
@@ -123,6 +124,7 @@ public interface AudioSynthesizer extends Synthesizer {
* @see #close
* @see #isOpen
*/
- public AudioInputStream openStream(AudioFormat targetFormat,
- Map info) throws MidiUnavailableException;
+ AudioInputStream openStream(AudioFormat targetFormat,
+ Map info)
+ throws MidiUnavailableException;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
index 11f2b7e52c9..6c7272319f7 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java
index 02c5119f22e..d0567ca3001 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java
@@ -28,7 +28,7 @@ package com.sun.media.sound;
import javax.sound.sampled.Clip;
/**
- * Interface for Clip objects that close themselves automatically
+ * Interface for Clip objects that close themselves automatically.
*
* @author Florian Bomers
*/
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java
index 70df345586c..4dc8a107fe1 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java
@@ -41,6 +41,5 @@ public interface AutoConnectSequencer {
* needs to re-connect itself to a suitable
* device in open().
*/
- public void setAutoConnect(Receiver autoConnectReceiver);
-
+ void setAutoConnect(Receiver autoConnectReceiver);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java
index 708bf4b04ca..c25be39d290 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java
index c7e6188a25c..c4f45e49cb1 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -47,8 +48,8 @@ public final class DLSInstrument extends ModelInstrument {
boolean druminstrument = false;
byte[] guid = null;
DLSInfo info = new DLSInfo();
- List regions = new ArrayList();
- List modulators = new ArrayList();
+ List regions = new ArrayList<>();
+ List modulators = new ArrayList<>();
public DLSInstrument() {
super(null, null, null, null);
@@ -62,6 +63,7 @@ public final class DLSInstrument extends ModelInstrument {
return info;
}
+ @Override
public String getName() {
return info.name;
}
@@ -70,6 +72,7 @@ public final class DLSInstrument extends ModelInstrument {
info.name = name;
}
+ @Override
public ModelPatch getPatch() {
return new ModelPatch(bank, preset, druminstrument);
}
@@ -86,6 +89,7 @@ public final class DLSInstrument extends ModelInstrument {
}
}
+ @Override
public Object getData() {
return null;
}
@@ -98,6 +102,7 @@ public final class DLSInstrument extends ModelInstrument {
return modulators;
}
+ @Override
public String toString() {
if (druminstrument)
return "Drumkit: " + info.name
@@ -362,17 +367,17 @@ public final class DLSInstrument extends ModelInstrument {
return null;
}
+ @Override
public ModelPerformer[] getPerformers() {
- List performers = new ArrayList();
+ List performers = new ArrayList<>();
- Map modmap = new HashMap();
+ Map modmap = new HashMap<>();
for (DLSModulator mod: getModulators()) {
modmap.put(mod.getSource() + "x" + mod.getControl() + "=" +
mod.getDestination(), mod);
}
- Map insmodmap =
- new HashMap();
+ Map insmodmap = new HashMap<>();
for (DLSRegion zone: regions) {
ModelPerformer performer = new ModelPerformer();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java
index 4cfa7d42a13..257777628b2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java
index feb99823a98..b3456a31cbe 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -39,7 +40,7 @@ import java.util.List;
public final class DLSRegion {
public static final int OPTION_SELFNONEXCLUSIVE = 0x0001;
- List modulators = new ArrayList();
+ List modulators = new ArrayList<>();
int keyfrom;
int keyto;
int velfrom;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java
index 047783dfdab..61d0c2298a7 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java
@@ -22,10 +22,12 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.InputStream;
import java.util.Arrays;
+
import javax.sound.midi.Soundbank;
import javax.sound.midi.SoundbankResource;
import javax.sound.sampled.AudioFormat;
@@ -60,6 +62,7 @@ public final class DLSSample extends SoundbankResource {
return info;
}
+ @Override
public Object getData() {
AudioFormat format = getFormat();
@@ -93,6 +96,7 @@ public final class DLSSample extends SoundbankResource {
this.data = new ModelByteBuffer(data, offset, length);
}
+ @Override
public String getName() {
return info.name;
}
@@ -109,6 +113,7 @@ public final class DLSSample extends SoundbankResource {
this.sampleoptions = sampleOptions;
}
+ @Override
public String toString() {
return "Sample: " + info.name;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java
index 724815bd1bd..cd178d8af45 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java
index 059f318f414..230b58fc7cd 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -40,7 +41,7 @@ public final class DLSSampleOptions {
short finetune;
int attenuation;
long options;
- List loops = new ArrayList();
+ List loops = new ArrayList<>();
public int getAttenuation() {
return attenuation;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java
index db509a96eef..e2fd9743f7e 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.File;
@@ -42,9 +43,9 @@ import javax.sound.midi.Patch;
import javax.sound.midi.Soundbank;
import javax.sound.midi.SoundbankResource;
import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
/**
* A DLS Level 1 and Level 2 soundbank reader (from files/url/streams).
@@ -100,10 +101,12 @@ public final class DLSSoundbank implements Soundbank {
return d;
}
+ @Override
public int hashCode() {
return (int)i1;
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof DLSID)) {
return false;
@@ -176,8 +179,8 @@ public final class DLSSoundbank implements Soundbank {
private final DLSInfo info = new DLSInfo();
- private final List instruments = new ArrayList();
- private final List samples = new ArrayList();
+ private final List instruments = new ArrayList<>();
+ private final List samples = new ArrayList<>();
private boolean largeFormat = false;
private File sampleFile;
@@ -300,7 +303,7 @@ public final class DLSSoundbank implements Soundbank {
DLSID uuid;
long x;
long y;
- Stack stack = new Stack();
+ Stack stack = new Stack<>();
while (riff.available() != 0) {
int opcode = riff.readUnsignedShort();
@@ -482,7 +485,7 @@ public final class DLSSoundbank implements Soundbank {
}
}
if (chunk.getType().equals("lart")) {
- List modlist = new ArrayList();
+ List modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -498,7 +501,7 @@ public final class DLSSoundbank implements Soundbank {
}
if (chunk.getType().equals("lar2")) {
// support for DLS level 2 ART
- List modlist = new ArrayList();
+ List modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -582,7 +585,7 @@ public final class DLSSoundbank implements Soundbank {
}
}
- private Map temp_rgnassign = new HashMap();
+ private Map temp_rgnassign = new HashMap<>();
private boolean readRgnChunk(DLSRegion split, RIFFReader riff)
throws IOException {
@@ -591,7 +594,7 @@ public final class DLSSoundbank implements Soundbank {
String format = chunk.getFormat();
if (format.equals("LIST")) {
if (chunk.getType().equals("lart")) {
- List modlist = new ArrayList();
+ List modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -607,7 +610,7 @@ public final class DLSSoundbank implements Soundbank {
}
if (chunk.getType().equals("lar2")) {
// support for DLS level 2 ART
- List modlist = new ArrayList();
+ List modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -902,7 +905,7 @@ public final class DLSSoundbank implements Soundbank {
RIFFWriter wvpl = writer.writeList("wvpl");
long off = wvpl.getFilePointer();
- List offsettable = new ArrayList();
+ List offsettable = new ArrayList<>();
for (DLSSample sample : samples) {
offsettable.add(Long.valueOf(wvpl.getFilePointer() - off));
writeSample(wvpl.writeList("wave"), sample);
@@ -1179,18 +1182,22 @@ public final class DLSSoundbank implements Soundbank {
return info;
}
+ @Override
public String getName() {
return info.name;
}
+ @Override
public String getVersion() {
return major + "." + minor;
}
+ @Override
public String getVendor() {
return info.engineers;
}
+ @Override
public String getDescription() {
return info.comments;
}
@@ -1207,6 +1214,7 @@ public final class DLSSoundbank implements Soundbank {
info.comments = s;
}
+ @Override
public SoundbankResource[] getResources() {
SoundbankResource[] resources = new SoundbankResource[samples.size()];
int j = 0;
@@ -1215,6 +1223,7 @@ public final class DLSSoundbank implements Soundbank {
return resources;
}
+ @Override
public DLSInstrument[] getInstruments() {
DLSInstrument[] inslist_array =
instruments.toArray(new DLSInstrument[instruments.size()]);
@@ -1226,6 +1235,7 @@ public final class DLSSoundbank implements Soundbank {
return samples.toArray(new DLSSample[samples.size()]);
}
+ @Override
public Instrument getInstrument(Patch patch) {
int program = patch.getProgram();
int bank = patch.getBank();
@@ -1256,9 +1266,9 @@ public final class DLSSoundbank implements Soundbank {
public void removeResource(SoundbankResource resource) {
if (resource instanceof DLSInstrument)
- instruments.remove((DLSInstrument) resource);
+ instruments.remove(resource);
if (resource instanceof DLSSample)
- samples.remove((DLSSample) resource);
+ samples.remove(resource);
}
public void addInstrument(DLSInstrument resource) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java
index 0bba5d49532..e366b3ad73f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java
@@ -29,6 +29,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.Soundbank;
import javax.sound.midi.spi.SoundbankReader;
@@ -41,6 +42,7 @@ import javax.sound.midi.spi.SoundbankReader;
*/
public final class DLSSoundbankReader extends SoundbankReader {
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
try {
@@ -52,6 +54,7 @@ public final class DLSSoundbankReader extends SoundbankReader {
}
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
try {
@@ -63,6 +66,7 @@ public final class DLSSoundbankReader extends SoundbankReader {
}
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
try {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java
index 95c0ff9f050..d9e969064a7 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java
@@ -27,7 +27,9 @@ package com.sun.media.sound;
import java.util.Arrays;
-import javax.sound.sampled.*;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.SourceDataLine;
/**
* Class to write an AudioInputStream to a SourceDataLine.
@@ -125,7 +127,6 @@ public final class DataPusher implements Runnable {
if (DEBUG || Printer.debug) Printer.debug("< DataPusher.start(loop="+loop+")");
}
-
public synchronized void stop() {
if (DEBUG || Printer.debug) Printer.debug("> DataPusher.stop()");
if (threadState == STATE_STOPPING
@@ -161,6 +162,7 @@ public final class DataPusher implements Runnable {
/**
* Write data to the source data line.
*/
+ @Override
public void run() {
byte[] buffer = null;
boolean useStream = (ais != null);
@@ -242,5 +244,4 @@ public final class DataPusher implements Runnable {
}
if (DEBUG || Printer.debug)Printer.debug("DataPusher:end of thread");
}
-
} // class DataPusher
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
index becf4981ba7..f65351e31c8 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
@@ -29,35 +29,35 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Vector;
-import javax.sound.sampled.*;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.BooleanControl;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.Control;
+import javax.sound.sampled.DataLine;
+import javax.sound.sampled.FloatControl;
+import javax.sound.sampled.Line;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.SourceDataLine;
+import javax.sound.sampled.TargetDataLine;
// IDEA:
// Use java.util.concurrent.Semaphore,
// java.util.concurrent.locks.ReentrantLock and other new classes/methods
// to improve this class's thread safety.
-
/**
- * A Mixer which provides direct access to audio devices
+ * A Mixer which provides direct access to audio devices.
*
* @author Florian Bomers
*/
final class DirectAudioDevice extends AbstractMixer {
- // CONSTANTS
private static final int CLIP_BUFFER_TIME = 1000; // in milliseconds
private static final int DEFAULT_LINE_BUFFER_TIME = 500; // in milliseconds
- // INSTANCE VARIABLES
-
- /** number of opened lines */
- private int deviceCountOpened = 0;
-
- /** number of started lines */
- private int deviceCountStarted = 0;
-
- // CONSTRUCTOR
DirectAudioDevice(DirectAudioDeviceProvider.DirectAudioDeviceInfo portMixerInfo) {
// pass in Line.Info, mixer, controls
super(portMixerInfo, // Mixer.Info
@@ -168,6 +168,7 @@ final class DirectAudioDevice extends AbstractMixer {
// ABSTRACT MIXER: ABSTRACT METHOD IMPLEMENTATIONS
+ @Override
public Line getLine(Line.Info info) throws LineUnavailableException {
Line.Info fullInfo = getLineInfo(info);
if (fullInfo == null) {
@@ -216,7 +217,7 @@ final class DirectAudioDevice extends AbstractMixer {
throw new IllegalArgumentException("Line unsupported: " + info);
}
-
+ @Override
public int getMaxLines(Line.Info info) {
Line.Info fullInfo = getLineInfo(info);
@@ -233,26 +234,26 @@ final class DirectAudioDevice extends AbstractMixer {
return 0;
}
-
+ @Override
protected void implOpen() throws LineUnavailableException {
if (Printer.trace) Printer.trace("DirectAudioDevice: implOpen - void method");
}
+ @Override
protected void implClose() {
if (Printer.trace) Printer.trace("DirectAudioDevice: implClose - void method");
}
+ @Override
protected void implStart() {
if (Printer.trace) Printer.trace("DirectAudioDevice: implStart - void method");
}
+ @Override
protected void implStop() {
if (Printer.trace) Printer.trace("DirectAudioDevice: implStop - void method");
}
-
- // IMPLEMENTATION HELPERS
-
int getMixerIndex() {
return ((DirectAudioDeviceProvider.DirectAudioDeviceInfo) getMixerInfo()).getIndex();
}
@@ -319,12 +320,6 @@ final class DirectAudioDevice extends AbstractMixer {
return null;
}
-
-
-
- // INNER CLASSES
-
-
/**
* Private inner class for the DataLine.Info objects
* adds a little magic for the isFormatSupported so
@@ -367,7 +362,7 @@ final class DirectAudioDevice extends AbstractMixer {
}
/**
- * Private inner class as base class for direct lines
+ * Private inner class as base class for direct lines.
*/
private static class DirectDL extends AbstractDataLine implements EventDispatcher.LineMonitor {
protected final int mixerIndex;
@@ -397,7 +392,6 @@ final class DirectAudioDevice extends AbstractMixer {
// Guards all native calls.
protected final Object lockNative = new Object();
- // CONSTRUCTOR
protected DirectDL(DataLine.Info info,
DirectAudioDevice mixer,
AudioFormat format,
@@ -414,11 +408,7 @@ final class DirectAudioDevice extends AbstractMixer {
}
-
- // ABSTRACT METHOD IMPLEMENTATIONS
-
- // ABSTRACT LINE / DATALINE
-
+ @Override
void implOpen(AudioFormat format, int bufferSize) throws LineUnavailableException {
if (Printer.trace) Printer.trace(">> DirectDL: implOpen("+format+", "+bufferSize+" bytes)");
@@ -538,7 +528,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("<< DirectDL: implOpen() succeeded");
}
-
+ @Override
void implStart() {
if (Printer.trace) Printer.trace(" >> DirectDL: implStart()");
@@ -570,6 +560,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded");
}
+ @Override
void implStop() {
if (Printer.trace) Printer.trace(">> DirectDL: implStop()");
@@ -600,6 +591,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded");
}
+ @Override
void implClose() {
if (Printer.trace) Printer.trace(">> DirectDL: implClose()");
@@ -625,8 +617,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("<< DirectDL: implClose() succeeded");
}
- // METHOD OVERRIDES
-
+ @Override
public int available() {
if (id == 0) {
return 0;
@@ -638,7 +629,7 @@ final class DirectAudioDevice extends AbstractMixer {
return a;
}
-
+ @Override
public void drain() {
noService = true;
// additional safeguard against draining forever
@@ -681,6 +672,7 @@ final class DirectAudioDevice extends AbstractMixer {
noService = false;
}
+ @Override
public void flush() {
if (id != 0) {
// first stop ongoing read/write method
@@ -699,6 +691,7 @@ final class DirectAudioDevice extends AbstractMixer {
}
// replacement for getFramePosition (see AbstractDataLine)
+ @Override
public long getLongFramePosition() {
long pos;
synchronized (lockNative) {
@@ -713,7 +706,6 @@ final class DirectAudioDevice extends AbstractMixer {
return (pos / getFormat().getFrameSize());
}
-
/*
* write() belongs into SourceDataLine and Clip,
* so define it here and make it accessible by
@@ -786,6 +778,7 @@ final class DirectAudioDevice extends AbstractMixer {
}
// called from event dispatcher for lines that need servicing
+ @Override
public void checkLine() {
synchronized (lockNative) {
if (monitoring
@@ -826,7 +819,6 @@ final class DirectAudioDevice extends AbstractMixer {
}
}
-
/////////////////// CONTROLS /////////////////////////////
protected final class Gain extends FloatControl {
@@ -844,6 +836,7 @@ final class DirectAudioDevice extends AbstractMixer {
"dB", "Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
// adjust value within range ?? spec says IllegalArgumentException
//newValue = Math.min(newValue, getMaximum());
@@ -861,13 +854,13 @@ final class DirectAudioDevice extends AbstractMixer {
}
} // class Gain
-
private final class Mute extends BooleanControl {
private Mute() {
super(BooleanControl.Type.MUTE, false, "True", "False");
}
+ @Override
public void setValue(boolean newValue) {
super.setValue(newValue);
calcVolume();
@@ -881,6 +874,7 @@ final class DirectAudioDevice extends AbstractMixer {
"", "Left", "Center", "Right");
}
+ @Override
public void setValue(float newValue) {
setValueImpl(newValue);
panControl.setValueImpl(newValue);
@@ -900,6 +894,7 @@ final class DirectAudioDevice extends AbstractMixer {
"", "Left", "Center", "Right");
}
+ @Override
public void setValue(float newValue) {
setValueImpl(newValue);
balanceControl.setValueImpl(newValue);
@@ -909,19 +904,14 @@ final class DirectAudioDevice extends AbstractMixer {
super.setValue(newValue);
}
} // class Pan
-
-
-
} // class DirectDL
-
/**
- * Private inner class representing a SourceDataLine
+ * Private inner class representing a SourceDataLine.
*/
private static final class DirectSDL extends DirectDL
implements SourceDataLine {
- // CONSTRUCTOR
private DirectSDL(DataLine.Info info,
AudioFormat format,
int bufferSize,
@@ -933,12 +923,11 @@ final class DirectAudioDevice extends AbstractMixer {
}
/**
- * Private inner class representing a TargetDataLine
+ * Private inner class representing a TargetDataLine.
*/
private static final class DirectTDL extends DirectDL
implements TargetDataLine {
- // CONSTRUCTOR
private DirectTDL(DataLine.Info info,
AudioFormat format,
int bufferSize,
@@ -947,8 +936,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("DirectTDL CONSTRUCTOR: completed");
}
- // METHOD OVERRIDES
-
+ @Override
public int read(byte[] b, int off, int len) {
flushing = false;
if (len == 0) {
@@ -1030,7 +1018,6 @@ final class DirectAudioDevice extends AbstractMixer {
// auto closing clip support
private boolean autoclosing = false;
- // CONSTRUCTOR
private DirectClip(DataLine.Info info,
AudioFormat format,
int bufferSize,
@@ -1041,6 +1028,7 @@ final class DirectAudioDevice extends AbstractMixer {
// CLIP METHODS
+ @Override
public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
throws LineUnavailableException {
@@ -1111,7 +1099,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("< DirectClip.open completed");
}
-
+ @Override
public void open(AudioInputStream stream) throws LineUnavailableException, IOException {
// $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions
@@ -1178,17 +1166,17 @@ final class DirectAudioDevice extends AbstractMixer {
} // synchronized
}
-
+ @Override
public int getFrameLength() {
return m_lengthInFrames;
}
-
+ @Override
public long getMicrosecondLength() {
return Toolkit.frames2micros(getFormat(), getFrameLength());
}
-
+ @Override
public void setFramePosition(int frames) {
if (Printer.trace) Printer.trace("> DirectClip: setFramePosition: " + frames);
@@ -1229,6 +1217,7 @@ final class DirectAudioDevice extends AbstractMixer {
}
// replacement for getFramePosition (see AbstractDataLine)
+ @Override
public long getLongFramePosition() {
/* $$fb
* this would be intuitive, but the definition of getFramePosition
@@ -1243,7 +1232,7 @@ final class DirectAudioDevice extends AbstractMixer {
return super.getLongFramePosition();
}
-
+ @Override
public synchronized void setMicrosecondPosition(long microseconds) {
if (Printer.trace) Printer.trace("> DirectClip: setMicrosecondPosition: " + microseconds);
@@ -1253,6 +1242,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("< DirectClip: setMicrosecondPosition succeeded");
}
+ @Override
public void setLoopPoints(int start, int end) {
if (Printer.trace) Printer.trace("> DirectClip: setLoopPoints: start: " + start + " end: " + end);
@@ -1283,7 +1273,7 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("< DirectClip: setLoopPoints completed");
}
-
+ @Override
public void loop(int count) {
// note: when count reaches 0, it means that the entire clip
// will be played, i.e. it will play past the loop end point
@@ -1291,10 +1281,7 @@ final class DirectAudioDevice extends AbstractMixer {
start();
}
- // ABSTRACT METHOD IMPLEMENTATIONS
-
- // ABSTRACT LINE
-
+ @Override
void implOpen(AudioFormat format, int bufferSize) throws LineUnavailableException {
// only if audioData wasn't set in a calling open(format, byte[], frameSize)
// this call is allowed.
@@ -1304,6 +1291,7 @@ final class DirectAudioDevice extends AbstractMixer {
super.implOpen(format, bufferSize);
}
+ @Override
void implClose() {
if (Printer.trace) Printer.trace(">> DirectClip: implClose()");
@@ -1333,13 +1321,14 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("<< DirectClip: implClose() succeeded");
}
-
+ @Override
void implStart() {
if (Printer.trace) Printer.trace("> DirectClip: implStart()");
super.implStart();
if (Printer.trace) Printer.trace("< DirectClip: implStart() succeeded");
}
+ @Override
void implStop() {
if (Printer.trace) Printer.trace(">> DirectClip: implStop()");
@@ -1351,8 +1340,8 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.trace) Printer.trace("<< DirectClip: implStop() succeeded");
}
-
// main playback loop
+ @Override
public void run() {
if (Printer.trace) Printer.trace(">>> DirectClip: run() threadID="+Thread.currentThread().getId());
while (thread != null) {
@@ -1418,10 +1407,12 @@ final class DirectAudioDevice extends AbstractMixer {
MixerClip. They should be moved to a base class, together
with the instance variable 'autoclosing'. */
+ @Override
public boolean isAutoClosing() {
return autoclosing;
}
+ @Override
public void setAutoClosing(boolean value) {
if (value != autoclosing) {
if (isOpen()) {
@@ -1435,6 +1426,7 @@ final class DirectAudioDevice extends AbstractMixer {
}
}
+ @Override
protected boolean requiresServicing() {
// no need for servicing for Clips
return false;
@@ -1488,5 +1480,4 @@ final class DirectAudioDevice extends AbstractMixer {
private static native boolean nRequiresServicing(long id, boolean isSource);
// called in irregular intervals
private static native void nService(long id, boolean isSource);
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
index 274571917ea..15d4fc1a93f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java
@@ -28,7 +28,6 @@ package com.sun.media.sound;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
-
/**
* DirectAudioDevice provider.
*
@@ -36,8 +35,6 @@ import javax.sound.sampled.spi.MixerProvider;
*/
public final class DirectAudioDeviceProvider extends MixerProvider {
- // STATIC VARIABLES
-
/**
* Set of info objects for all port input devices on the system.
*/
@@ -48,18 +45,11 @@ public final class DirectAudioDeviceProvider extends MixerProvider {
*/
private static DirectAudioDevice[] devices;
-
- // STATIC
-
static {
// initialize
Platform.initialize();
}
-
- // CONSTRUCTOR
-
-
/**
* Required public no-arg constructor.
*/
@@ -92,6 +82,7 @@ public final class DirectAudioDeviceProvider extends MixerProvider {
}
}
+ @Override
public Mixer.Info[] getMixerInfo() {
synchronized (DirectAudioDeviceProvider.class) {
Mixer.Info[] localArray = new Mixer.Info[infos.length];
@@ -100,7 +91,7 @@ public final class DirectAudioDeviceProvider extends MixerProvider {
}
}
-
+ @Override
public Mixer getMixer(Mixer.Info info) {
synchronized (DirectAudioDeviceProvider.class) {
// if the default device is asked, we provide the mixer
@@ -125,7 +116,6 @@ public final class DirectAudioDeviceProvider extends MixerProvider {
String.format("Mixer %s not supported by this provider", info));
}
-
private static Mixer getDevice(DirectAudioDeviceInfo info) {
int index = info.getIndex();
if (devices[index] == null) {
@@ -134,9 +124,6 @@ public final class DirectAudioDeviceProvider extends MixerProvider {
return devices[index];
}
- // INNER CLASSES
-
-
/**
* Info class for DirectAudioDevices. Adds an index value and a string for
* making native references to a particular device.
@@ -171,7 +158,6 @@ public final class DirectAudioDeviceProvider extends MixerProvider {
}
} // class DirectAudioDeviceInfo
- // NATIVE METHODS
private static native int nGetNumDevices();
// index: [0..nGetNumDevices()-1]
private static native DirectAudioDeviceInfo nNewDirectAudioDeviceInfo(int deviceIndex);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java
index 22638076fcd..73a938babab 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Random;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java
index 49709891bd0..3880682f3f2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java
@@ -35,8 +35,6 @@ import javax.sound.midi.ShortMessage;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
-
-
/**
* EventDispatcher. Used by various classes in the Java Sound implementation
* to send events.
@@ -49,39 +47,35 @@ final class EventDispatcher implements Runnable {
/**
* time of inactivity until the auto closing clips
- * are closed
+ * are closed.
*/
private static final int AUTO_CLOSE_TIME = 5000;
-
/**
- * List of events
+ * List of events.
*/
private final ArrayList eventQueue = new ArrayList<>();
-
/**
- * Thread object for this EventDispatcher instance
+ * Thread object for this EventDispatcher instance.
*/
private Thread thread = null;
-
/*
* support for auto-closing Clips
*/
- private final ArrayList autoClosingClips = new ArrayList();
+ private final ArrayList autoClosingClips = new ArrayList<>();
/*
* support for monitoring data lines
*/
- private final ArrayList lineMonitors = new ArrayList();
+ private final ArrayList lineMonitors = new ArrayList<>();
/**
* Approximate interval between calls to LineMonitor.checkLine
*/
static final int LINE_MONITOR_TIME = 400;
-
/**
* This start() method starts an event thread if one is not already active.
*/
@@ -96,7 +90,6 @@ final class EventDispatcher implements Runnable {
}
}
-
/**
* Invoked when there is at least one event in the queue.
* Implement this as a callback to process one event.
@@ -153,7 +146,6 @@ final class EventDispatcher implements Runnable {
Printer.err("Unknown event type: " + eventInfo.getEvent());
}
-
/**
* Wait until there is something in the event queue to process. Then
* dispatch the event to the listeners.The entire method does not
@@ -202,7 +194,6 @@ final class EventDispatcher implements Runnable {
}
}
-
/**
* Queue the given event in the event queue.
*/
@@ -211,10 +202,10 @@ final class EventDispatcher implements Runnable {
notifyAll();
}
-
/**
* A loop to dispatch events.
*/
+ @Override
public void run() {
while (true) {
@@ -226,7 +217,6 @@ final class EventDispatcher implements Runnable {
}
}
-
/**
* Send audio and MIDI events.
*/
@@ -243,7 +233,6 @@ final class EventDispatcher implements Runnable {
postEvent(eventInfo);
}
-
/*
* go through the list of registered auto-closing
* Clip instances and close them, if appropriate
@@ -291,7 +280,7 @@ final class EventDispatcher implements Runnable {
}
/**
- * called from auto-closing clips when one of their open() method is called
+ * called from auto-closing clips when one of their open() method is called.
*/
void autoClosingClipOpened(AutoClosingClip clip) {
if (Printer.debug)Printer.debug("> EventDispatcher.autoClosingClipOpened ");
@@ -316,7 +305,7 @@ final class EventDispatcher implements Runnable {
}
/**
- * called from auto-closing clips when their closed() method is called
+ * called from auto-closing clips when their closed() method is called.
*/
void autoClosingClipClosed(AutoClosingClip clip) {
// nothing to do -- is removed from arraylist above
@@ -340,9 +329,8 @@ final class EventDispatcher implements Runnable {
if (Printer.debug)Printer.debug("< EventDispatcher.monitorLines("+lineMonitors.size()+" monitors)");
}
-
/**
- * Add this LineMonitor instance to the list of monitors
+ * Add this LineMonitor instance to the list of monitors.
*/
void addLineMonitor(LineMonitor lm) {
if (Printer.trace)Printer.trace("> EventDispatcher.addLineMonitor("+lm+")");
@@ -362,7 +350,7 @@ final class EventDispatcher implements Runnable {
}
/**
- * Remove this LineMonitor instance from the list of monitors
+ * Remove this LineMonitor instance from the list of monitors.
*/
void removeLineMonitor(LineMonitor lm) {
if (Printer.trace)Printer.trace("> EventDispatcher.removeLineMonitor("+lm+")");
@@ -377,8 +365,6 @@ final class EventDispatcher implements Runnable {
if (Printer.debug)Printer.debug("< EventDispatcher.removeLineMonitor finished -- now ("+lineMonitors.size()+" monitors)");
}
- // /////////////////////////////////// INNER CLASSES ////////////////////////////////////////// //
-
/**
* Container for an event and a set of listeners to deliver it to.
*/
@@ -413,7 +399,7 @@ final class EventDispatcher implements Runnable {
/**
- * Container for a clip with its expiration time
+ * Container for a clip with its expiration time.
*/
private class ClipInfo {
@@ -421,7 +407,7 @@ final class EventDispatcher implements Runnable {
private final long expiration;
/**
- * Create a new instance of this clip Info class
+ * Create a new instance of this clip Info class.
*/
ClipInfo(AutoClosingClip clip) {
this.clip = clip;
@@ -440,13 +426,13 @@ final class EventDispatcher implements Runnable {
/**
* Interface that a class that wants to get regular
- * line monitor events implements
+ * line monitor events implements.
*/
interface LineMonitor {
/**
- * Called by event dispatcher in regular intervals
+ * Called by event dispatcher in regular intervals.
*/
- public void checkLine();
+ void checkLine();
}
} // class EventDispatcher
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java
index 8b1436736c0..8952cf7f60a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -588,7 +589,6 @@ public final class FFT {
i += jmax << 1;
}
-
}
// Perform Factor-4 Decomposition with 3 * complex operators and 8 +/-
@@ -682,7 +682,6 @@ public final class FFT {
i += jmax << 1;
}
-
}
private void bitreversal(double[] data) {
@@ -743,6 +742,5 @@ public final class FFT {
data[n] = data[m];
data[m] = tempi;
}
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java
index 54307f238a4..77fea07e31e 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java
@@ -25,10 +25,11 @@
package com.sun.media.sound;
-import javax.sound.midi.*;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.ShortMessage;
/**
- * an optimized ShortMessage that does not need an array
+ * an optimized ShortMessage that does not need an array.
*
* @author Florian Bomers
*/
@@ -51,6 +52,7 @@ final class FastShortMessage extends ShortMessage {
return packedMsg;
}
+ @Override
public byte[] getMessage() {
int length = 0;
try {
@@ -73,6 +75,7 @@ final class FastShortMessage extends ShortMessage {
return returnedArray;
}
+ @Override
public int getLength() {
try {
return getDataLength(packedMsg & 0xFF) + 1;
@@ -82,6 +85,7 @@ final class FastShortMessage extends ShortMessage {
return 0;
}
+ @Override
public void setMessage(int status) throws InvalidMidiDataException {
// check for valid values
int dataLength = getDataLength(status); // can throw InvalidMidiDataException
@@ -91,35 +95,39 @@ final class FastShortMessage extends ShortMessage {
packedMsg = (packedMsg & 0xFFFF00) | (status & 0xFF);
}
-
+ @Override
public void setMessage(int status, int data1, int data2) throws InvalidMidiDataException {
getDataLength(status); // can throw InvalidMidiDataException
packedMsg = (status & 0xFF) | ((data1 & 0xFF) << 8) | ((data2 & 0xFF) << 16);
}
-
+ @Override
public void setMessage(int command, int channel, int data1, int data2) throws InvalidMidiDataException {
getDataLength(command); // can throw InvalidMidiDataException
packedMsg = (command & 0xF0) | (channel & 0x0F) | ((data1 & 0xFF) << 8) | ((data2 & 0xFF) << 16);
}
-
+ @Override
public int getChannel() {
return packedMsg & 0x0F;
}
+ @Override
public int getCommand() {
return packedMsg & 0xF0;
}
+ @Override
public int getData1() {
return (packedMsg & 0xFF00) >> 8;
}
+ @Override
public int getData2() {
return (packedMsg & 0xFF0000) >> 16;
}
+ @Override
public int getStatus() {
return packedMsg & 0xFF;
}
@@ -129,6 +137,7 @@ final class FastShortMessage extends ShortMessage {
* as this object.
* @return a clone of this instance.
*/
+ @Override
public Object clone() {
try {
return new FastShortMessage(packedMsg);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java
index 8b847eb2f2b..f137e81e2a0 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java
@@ -25,10 +25,11 @@
package com.sun.media.sound;
-import javax.sound.midi.*;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.SysexMessage;
/**
- * optimized FastSysexMessage that doesn't copy the array upon instantiation
+ * optimized FastSysexMessage that doesn't copy the array upon instantiation.
*
* @author Florian Bomers
*/
@@ -51,6 +52,7 @@ final class FastSysexMessage extends SysexMessage {
// overwrite this method so that the original data array,
// which is shared among all transmitters, cannot be modified
+ @Override
public void setMessage(byte[] data, int length) throws InvalidMidiDataException {
if ((data.length == 0) || (((data[0] & 0xFF) != 0xF0) && ((data[0] & 0xFF) != 0xF7))) {
super.setMessage(data, data.length); // will throw Exception
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java
index ed43640f287..b61f27bcaa2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java
index 4fcc46c4131..7aa76bc9e26 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java
index a5f024a2592..db1a769fbd2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java
@@ -69,11 +69,12 @@ public final class JARSoundbankReader extends SoundbankReader {
return ok;
}
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
if (!isZIP(url))
return null;
- ArrayList soundbanks = new ArrayList();
+ ArrayList soundbanks = new ArrayList<>();
URLClassLoader ucl = URLClassLoader.newInstance(new URL[]{url});
InputStream stream = ucl.getResourceAsStream(
"META-INF/services/javax.sound.midi.Soundbank");
@@ -114,12 +115,14 @@ public final class JARSoundbankReader extends SoundbankReader {
return sbk;
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
Objects.requireNonNull(stream);
return null;
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
return getSoundbank(file.toURI().toURL());
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java
index be36779345a..c70c9800cca 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java
@@ -136,7 +136,6 @@ public final class JDK13Services {
return value;
}
-
/** Obtain the instance name part of a default provider property.
@param typeClass The type of the default provider property. This
should be one of Receiver.class, Transmitter.class, Sequencer.class,
@@ -158,7 +157,6 @@ public final class JDK13Services {
return value;
}
-
/** Obtain the value of a default provider property.
@param typeClass The type of the default provider property. This
should be one of Receiver.class, Transmitter.class, Sequencer.class,
@@ -190,7 +188,6 @@ public final class JDK13Services {
return value;
}
-
/** Obtain a properties bundle containing property values from the
properties file. If the properties file could not be loaded,
the properties bundle is empty.
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
index d59118889c2..e1de7a4587d 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
@@ -26,19 +26,17 @@
package com.sun.media.sound;
import java.io.BufferedInputStream;
-import java.io.InputStream;
import java.io.File;
import java.io.FileInputStream;
-
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.ServiceLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
import javax.sound.sampled.AudioPermission;
/** Managing security in the Java Sound implementation.
@@ -64,7 +62,6 @@ final class JSSecurityManager {
return (System.getSecurityManager() != null);
}
-
static void checkRecordPermission() throws SecurityException {
if(Printer.trace) Printer.trace("JSSecurityManager.checkRecordPermission()");
SecurityManager sm = System.getSecurityManager();
@@ -90,6 +87,7 @@ final class JSSecurityManager {
try {
// invoke the privileged action using 1.2 security
PrivilegedAction action = new PrivilegedAction() {
+ @Override
public Void run() {
loadPropertiesImpl(properties, filename);
return null;
@@ -108,7 +106,6 @@ final class JSSecurityManager {
}
}
-
private static void loadPropertiesImpl(Properties properties,
String filename) {
if(Printer.trace)Printer.trace(">> JSSecurityManager: loadPropertiesImpl()");
@@ -176,6 +173,7 @@ final class JSSecurityManager {
// the iterator's hasNext() method looks through classpath for
// the provider class names, so it requires read permissions
PrivilegedAction hasNextAction = new PrivilegedAction() {
+ @Override
public Boolean run() {
return ps.hasNext();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
index ca9ac9c9122..28f26796169 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
@@ -25,30 +25,29 @@
package com.sun.media.sound;
-import java.io.IOException;
-import java.io.InputStream;
+import java.applet.AudioClip;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
-import java.applet.AudioClip;
+import java.io.IOException;
+import java.io.InputStream;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.Clip;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.DataLine;
-import javax.sound.sampled.SourceDataLine;
-import javax.sound.sampled.LineEvent;
-import javax.sound.sampled.LineListener;
-import javax.sound.sampled.UnsupportedAudioFileException;
-
-import javax.sound.midi.MidiSystem;
-import javax.sound.midi.MidiFileFormat;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MetaEventListener;
import javax.sound.midi.MetaMessage;
+import javax.sound.midi.MidiFileFormat;
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.MidiUnavailableException;
-import javax.sound.midi.MetaEventListener;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.DataLine;
+import javax.sound.sampled.LineEvent;
+import javax.sound.sampled.LineListener;
+import javax.sound.sampled.SourceDataLine;
+import javax.sound.sampled.UnsupportedAudioFileException;
/**
* Java Sound audio clip;
@@ -56,7 +55,6 @@ import javax.sound.midi.MetaEventListener;
* @author Arthur van Hoff, Kara Kytle, Jan Borgersen
* @author Florian Bomers
*/
-
public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
private static final boolean DEBUG = false;
@@ -126,12 +124,12 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
}
}
-
+ @Override
public synchronized void play() {
startImpl(false);
}
-
+ @Override
public synchronized void loop() {
startImpl(true);
}
@@ -205,6 +203,7 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
}
}
+ @Override
public synchronized void stop() {
if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip->stop()");
@@ -248,13 +247,15 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
// Event handlers (for debugging)
+ @Override
public synchronized void update(LineEvent event) {
if (DEBUG || Printer.debug) Printer.debug("line event received: "+event);
}
// handle MIDI track end meta events for looping
- public synchronized void meta( MetaMessage message ) {
+ @Override
+ public synchronized void meta(MetaMessage message) {
if (DEBUG || Printer.debug)Printer.debug("META EVENT RECEIVED!!!!! ");
@@ -269,12 +270,12 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
}
}
-
+ @Override
public String toString() {
return getClass().toString();
}
-
+ @Override
protected void finalize() {
if (clip != null) {
@@ -326,8 +327,6 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
return true;
}
-
-
private void readStream(AudioInputStream as, long byteLen) throws IOException {
// arrays "only" max. 2GB
int intLen;
@@ -371,7 +370,6 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
loadedAudioByteLength = totalBytesRead;
}
-
// METHODS FOR CREATING THE DEVICE
private boolean createClip() {
@@ -464,7 +462,6 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
return true;
}
-
/*
* private inner class representing a ByteArrayOutputStream
* which allows retrieval of the internal array
@@ -479,5 +476,4 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
}
} // class DirectBAOS
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java
index fb200208c86..1386e0df7b9 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java
@@ -22,10 +22,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
-import javax.sound.midi.*;
-
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDeviceReceiver;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.Receiver;
/**
* Helper class which allows to convert {@code Receiver}
@@ -55,15 +58,18 @@ public final class MidiDeviceReceiverEnvelope implements MidiDeviceReceiver {
}
// Receiver implementation
+ @Override
public void close() {
receiver.close();
}
+ @Override
public void send(MidiMessage message, long timeStamp) {
receiver.send(message, timeStamp);
}
// MidiDeviceReceiver implementation
+ @Override
public MidiDevice getMidiDevice() {
return device;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java
index eca630a6c8c..8cd063c8f09 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java
@@ -22,10 +22,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
-import javax.sound.midi.*;
-
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDeviceTransmitter;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
/**
* Helper class which allows to convert {@code Transmitter}
@@ -55,20 +58,23 @@ public final class MidiDeviceTransmitterEnvelope implements MidiDeviceTransmitte
}
// Transmitter implementation
+ @Override
public void setReceiver(Receiver receiver) {
transmitter.setReceiver(receiver);
}
+ @Override
public Receiver getReceiver() {
return transmitter.getReceiver();
}
+ @Override
public void close() {
transmitter.close();
}
-
// MidiDeviceReceiver implementation
+ @Override
public MidiDevice getMidiDevice() {
return device;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java
index be8480dcd57..e12264382d5 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java
@@ -25,9 +25,8 @@
package com.sun.media.sound;
-import javax.sound.midi.*;
-
-
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Transmitter;
/**
* MidiInDevice class representing functionality of MidiIn devices.
@@ -40,18 +39,14 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
private volatile Thread midiInThread;
- // CONSTRUCTOR
-
MidiInDevice(AbstractMidiDeviceProvider.Info info) {
super(info);
if(Printer.trace) Printer.trace("MidiInDevice CONSTRUCTOR");
}
-
- // IMPLEMENTATION OF ABSTRACT MIDI DEVICE METHODS
-
// $$kk: 06.24.99: i have this both opening and starting the midi in device.
// may want to separate these??
+ @Override
protected synchronized void implOpen() throws MidiUnavailableException {
if (Printer.trace) Printer.trace("> MidiInDevice: implOpen()");
@@ -75,9 +70,9 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
if (Printer.trace) Printer.trace("< MidiInDevice: implOpen() completed");
}
-
// $$kk: 06.24.99: i have this both stopping and closing the midi in device.
// may want to separate these??
+ @Override
protected synchronized void implClose() {
if (Printer.trace) Printer.trace("> MidiInDevice: implClose()");
long oldId = id;
@@ -98,7 +93,7 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
if (Printer.trace) Printer.trace("< MidiInDevice: implClose() completed");
}
-
+ @Override
public long getMicrosecondPosition() {
long timestamp = -1;
if (isOpen()) {
@@ -107,22 +102,21 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
return timestamp;
}
-
// OVERRIDES OF ABSTRACT MIDI DEVICE METHODS
-
+ @Override
protected boolean hasTransmitters() {
return true;
}
-
+ @Override
protected Transmitter createTransmitter() {
return new MidiInTransmitter();
}
/**
* An own class to distinguish the class name from
- * the transmitter of other devices
+ * the transmitter of other devices.
*/
private final class MidiInTransmitter extends BasicTransmitter {
private MidiInTransmitter() {
@@ -130,8 +124,7 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
}
}
- // RUNNABLE METHOD
-
+ @Override
public void run() {
// while the device is started, keep trying to get messages.
// this thread returns from native code whenever stop() or close() is called
@@ -149,9 +142,6 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
midiInThread = null;
}
-
- // CALLBACKS FROM NATIVE
-
/**
* Callback from native code when a short MIDI event is received from hardware.
* @param packedMsg: status | data1 << 8 | data2 << 8
@@ -179,8 +169,6 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
getTransmitterList().sendMessage(data, timeStamp);
}
- // NATIVE METHODS
-
private native long nOpen(int index) throws MidiUnavailableException;
private native void nClose(long id);
@@ -190,6 +178,4 @@ final class MidiInDevice extends AbstractMidiDevice implements Runnable {
// go into native code and get messages. May be blocking
private native void nGetMessages(long id);
-
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
index 5044dfeaa17..cdadfd5df06 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java
@@ -27,7 +27,6 @@ package com.sun.media.sound;
import javax.sound.midi.MidiDevice;
-
/**
* MIDI input device provider.
*
@@ -44,16 +43,12 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
private static final boolean enabled;
- // STATIC
-
static {
// initialize
Platform.initialize();
enabled = Platform.isMidiIOEnabled();
}
- // CONSTRUCTOR
-
/**
* Required public no-arg constructor.
*/
@@ -63,6 +58,7 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
// implementation of abstract methods in AbstractMidiDeviceProvider
+ @Override
AbstractMidiDeviceProvider.Info createInfo(int index) {
if (!enabled) {
return null;
@@ -70,6 +66,7 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
return new MidiInDeviceInfo(index, MidiInDeviceProvider.class);
}
+ @Override
MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) {
if (enabled && (info instanceof MidiInDeviceInfo)) {
return new MidiInDevice(info);
@@ -77,6 +74,7 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
return null;
}
+ @Override
int getNumDevices() {
if (!enabled) {
if (Printer.debug)Printer.debug("MidiInDevice not enabled, returning 0 devices");
@@ -87,14 +85,15 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
return numDevices;
}
+ @Override
MidiDevice[] getDeviceCache() { return devices; }
+ @Override
void setDeviceCache(MidiDevice[] devices) { MidiInDeviceProvider.devices = devices; }
+ @Override
Info[] getInfoCache() { return infos; }
+ @Override
void setInfoCache(Info[] infos) { MidiInDeviceProvider.infos = infos; }
-
- // INNER CLASSES
-
/**
* Info class for MidiInDevices. Adds the
* provider's Class to keep the provider class from being
@@ -115,9 +114,6 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
} // class MidiInDeviceInfo
-
- // NATIVE METHODS
-
private static native int nGetNumDevices();
private static native String nGetName(int index);
private static native String nGetVendor(int index);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java
index 4559c9b59e9..991c4324a52 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java
@@ -25,9 +25,10 @@
package com.sun.media.sound;
-import javax.sound.midi.*;
-
-
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.ShortMessage;
/**
* MidiOutDevice class representing functionality of MidiOut devices.
@@ -38,16 +39,12 @@ import javax.sound.midi.*;
*/
final class MidiOutDevice extends AbstractMidiDevice {
- // CONSTRUCTOR
-
MidiOutDevice(AbstractMidiDeviceProvider.Info info) {
super(info);
if(Printer.trace) Printer.trace("MidiOutDevice CONSTRUCTOR");
}
-
- // IMPLEMENTATION OF ABSTRACT MIDI DEVICE METHODS
-
+ @Override
protected synchronized void implOpen() throws MidiUnavailableException {
if (Printer.trace) Printer.trace("> MidiOutDevice: implOpen()");
int index = ((AbstractMidiDeviceProvider.Info)getDeviceInfo()).getIndex();
@@ -58,7 +55,7 @@ final class MidiOutDevice extends AbstractMidiDevice {
if (Printer.trace) Printer.trace("< MidiOutDevice: implOpen(): completed.");
}
-
+ @Override
protected synchronized void implClose() {
if (Printer.trace) Printer.trace("> MidiOutDevice: implClose()");
// prevent further action
@@ -72,7 +69,7 @@ final class MidiOutDevice extends AbstractMidiDevice {
if (Printer.trace) Printer.trace("< MidiOutDevice: implClose(): completed");
}
-
+ @Override
public long getMicrosecondPosition() {
long timestamp = -1;
if (isOpen()) {
@@ -81,28 +78,23 @@ final class MidiOutDevice extends AbstractMidiDevice {
return timestamp;
}
-
-
- // OVERRIDES OF ABSTRACT MIDI DEVICE METHODS
-
/** Returns if this device supports Receivers.
This implementation always returns true.
@return true, if the device supports Receivers, false otherwise.
*/
+ @Override
protected boolean hasReceivers() {
return true;
}
-
+ @Override
protected Receiver createReceiver() {
return new MidiOutReceiver();
}
-
- // INNER CLASSES
-
final class MidiOutReceiver extends AbstractReceiver {
+ @Override
void implSend(final MidiMessage message, final long timeStamp) {
final int length = message.getLength();
final int status = message.getStatus();
@@ -159,13 +151,8 @@ final class MidiOutDevice extends AbstractMidiDevice {
nSendShortMessage(id, packedMsg, timeStamp);
}
}
-
-
} // class MidiOutReceiver
-
- // NATIVE METHODS
-
private native long nOpen(int index) throws MidiUnavailableException;
private native void nClose(long id);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
index dd0894aaf02..51ddc9d0e20 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java
@@ -27,7 +27,6 @@ package com.sun.media.sound;
import javax.sound.midi.MidiDevice;
-
/**
* MIDI output device provider.
*
@@ -44,16 +43,12 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
private static final boolean enabled;
- // STATIC
-
static {
// initialize
Platform.initialize();
enabled = Platform.isMidiIOEnabled();
}
- // CONSTRUCTOR
-
/**
* Required public no-arg constructor.
*/
@@ -61,8 +56,7 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
if (Printer.trace) Printer.trace("MidiOutDeviceProvider: constructor");
}
- // implementation of abstract methods in AbstractMidiDeviceProvider
-
+ @Override
AbstractMidiDeviceProvider.Info createInfo(int index) {
if (!enabled) {
return null;
@@ -70,6 +64,7 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
return new MidiOutDeviceInfo(index, MidiOutDeviceProvider.class);
}
+ @Override
MidiDevice createDevice(AbstractMidiDeviceProvider.Info info) {
if (enabled && (info instanceof MidiOutDeviceInfo)) {
return new MidiOutDevice(info);
@@ -77,6 +72,7 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
return null;
}
+ @Override
int getNumDevices() {
if (!enabled) {
if (Printer.debug)Printer.debug("MidiOutDevice not enabled, returning 0 devices");
@@ -85,14 +81,15 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
return nGetNumDevices();
}
+ @Override
MidiDevice[] getDeviceCache() { return devices; }
+ @Override
void setDeviceCache(MidiDevice[] devices) { MidiOutDeviceProvider.devices = devices; }
+ @Override
Info[] getInfoCache() { return infos; }
+ @Override
void setInfoCache(Info[] infos) { MidiOutDeviceProvider.infos = infos; }
-
- // INNER CLASSES
-
/**
* Info class for MidiOutDevices. Adds the
* provider's Class to keep the provider class from being
@@ -113,9 +110,6 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
} // class MidiOutDeviceInfo
-
- // NATIVE METHODS
-
private static native int nGetNumDevices();
private static native String nGetName(int index);
private static native String nGetVendor(int index);
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java
index b68750ad416..97bfa2f5937 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java
@@ -77,7 +77,6 @@ public final class MidiUtils {
return ((msg[1] & 0xFF) == META_END_OF_TRACK_TYPE) && (msg[2] == 0);
}
-
/** return if the given message is a meta tempo message */
public static boolean isMetaTempo(MidiMessage midiMsg) {
// first check if it is a META message at all
@@ -91,7 +90,6 @@ public final class MidiUtils {
return ((msg[1] & 0xFF) == META_TEMPO_TYPE) && (msg[2] == 3);
}
-
/** parses this message for a META tempo message and returns
* the tempo in MPQ, or -1 if this isn't a tempo message
*/
@@ -111,7 +109,6 @@ public final class MidiUtils {
return tempo;
}
-
/**
* converts
* 1 - MPQ-Tempo to BPM tempo
@@ -124,7 +121,6 @@ public final class MidiUtils {
return ((double) 60000000l) / tempo;
}
-
/**
* convert tick to microsecond with given tempo.
* Does not take tempo changes into account.
@@ -145,7 +141,6 @@ public final class MidiUtils {
return (long) ((((double)us) * resolution) / tempoMPQ);
}
-
/**
* Given a tick, convert to microsecond
* @param cache tempo info and current tempo
@@ -246,7 +241,6 @@ public final class MidiUtils {
return tick;
}
-
/**
* Binary search for the event indexes of the track
*
@@ -283,7 +277,6 @@ public final class MidiUtils {
return ret;
}
-
public static final class TempoCache {
long[] ticks;
int[] tempos; // in MPQ
@@ -310,7 +303,6 @@ public final class MidiUtils {
refresh(seq);
}
-
public synchronized void refresh(Sequence seq) {
ArrayList list = new ArrayList<>();
Track[] tracks = seq.getTracks();
@@ -373,6 +365,5 @@ public final class MidiUtils {
}
return tempos[tempos.length - 1];
}
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java
index a6f9a608767..1ad53ff6cd5 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -32,95 +33,123 @@ package com.sun.media.sound;
*/
public abstract class ModelAbstractChannelMixer implements ModelChannelMixer {
+ @Override
public abstract boolean process(float[][] buffer, int offset, int len);
+ @Override
public abstract void stop();
+ @Override
public void allNotesOff() {
}
+ @Override
public void allSoundOff() {
}
+ @Override
public void controlChange(int controller, int value) {
}
+ @Override
public int getChannelPressure() {
return 0;
}
+ @Override
public int getController(int controller) {
return 0;
}
+ @Override
public boolean getMono() {
return false;
}
+ @Override
public boolean getMute() {
return false;
}
+ @Override
public boolean getOmni() {
return false;
}
+ @Override
public int getPitchBend() {
return 0;
}
+ @Override
public int getPolyPressure(int noteNumber) {
return 0;
}
+ @Override
public int getProgram() {
return 0;
}
+ @Override
public boolean getSolo() {
return false;
}
+ @Override
public boolean localControl(boolean on) {
return false;
}
+ @Override
public void noteOff(int noteNumber) {
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
}
+ @Override
public void programChange(int program) {
}
+ @Override
public void programChange(int bank, int program) {
}
+ @Override
public void resetAllControllers() {
}
+ @Override
public void setChannelPressure(int pressure) {
}
+ @Override
public void setMono(boolean on) {
}
+ @Override
public void setMute(boolean mute) {
}
+ @Override
public void setOmni(boolean on) {
}
+ @Override
public void setPitchBend(int bend) {
}
+ @Override
public void setPolyPressure(int noteNumber, int pressure) {
}
+ @Override
public void setSolo(boolean soloState) {
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java
index 1c8f1413ac7..0bbb5466cb8 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java
@@ -22,9 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
+
import javax.sound.midi.Instrument;
import javax.sound.midi.MidiChannel;
import javax.sound.midi.Patch;
@@ -51,15 +53,18 @@ public abstract class ModelAbstractOscillator
public void init() {
}
+ @Override
public void close() throws IOException {
}
+ @Override
public void noteOff(int velocity) {
on = false;
}
+ @Override
public void noteOn(MidiChannel channel, VoiceStatus voice, int noteNumber,
- int velocity) {
+ int velocity) {
this.channel = channel;
this.voice = voice;
this.noteNumber = noteNumber;
@@ -67,6 +72,7 @@ public abstract class ModelAbstractOscillator
on = true;
}
+ @Override
public int read(float[][] buffer, int offset, int len) throws IOException {
return -1;
}
@@ -91,6 +97,7 @@ public abstract class ModelAbstractOscillator
return on;
}
+ @Override
public void setPitch(float pitch) {
this.pitch = pitch;
}
@@ -107,14 +114,17 @@ public abstract class ModelAbstractOscillator
return samplerate;
}
+ @Override
public float getAttenuation() {
return 0;
}
+ @Override
public int getChannels() {
return 1;
}
+ @Override
public String getName() {
return getClass().getName();
}
@@ -123,6 +133,7 @@ public abstract class ModelAbstractOscillator
return new Patch(0, 0);
}
+ @Override
public ModelOscillatorStream open(float samplerate) {
ModelAbstractOscillator oscs;
try {
@@ -162,10 +173,12 @@ public abstract class ModelAbstractOscillator
return sbk;
}
+ @Override
public String getDescription() {
return getName();
}
+ @Override
public Instrument getInstrument(Patch patch) {
Instrument ins = getInstrument();
Patch p = ins.getPatch();
@@ -182,18 +195,22 @@ public abstract class ModelAbstractOscillator
return ins;
}
+ @Override
public Instrument[] getInstruments() {
return new Instrument[]{getInstrument()};
}
+ @Override
public SoundbankResource[] getResources() {
return new SoundbankResource[0];
}
+ @Override
public String getVendor() {
return null;
}
+ @Override
public String getVersion() {
return null;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java
index 9ba89f20491..028efffbd12 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.ByteArrayInputStream;
@@ -60,12 +61,14 @@ public final class ModelByteBuffer {
left = capacity();
}
+ @Override
public int available() throws IOException {
if (left > Integer.MAX_VALUE)
return Integer.MAX_VALUE;
return (int)left;
}
+ @Override
public synchronized void mark(int readlimit) {
try {
mark = raf.getFilePointer();
@@ -75,15 +78,18 @@ public final class ModelByteBuffer {
}
}
+ @Override
public boolean markSupported() {
return true;
}
+ @Override
public synchronized void reset() throws IOException {
raf.seek(mark);
left = markleft;
}
+ @Override
public long skip(long n) throws IOException {
if( n < 0)
return 0;
@@ -95,6 +101,7 @@ public final class ModelByteBuffer {
return n;
}
+ @Override
public int read(byte b[], int off, int len) throws IOException {
if (len > left)
len = (int)left;
@@ -107,6 +114,7 @@ public final class ModelByteBuffer {
return len;
}
+ @Override
public int read(byte[] b) throws IOException {
int len = b.length;
if (len > left)
@@ -120,6 +128,7 @@ public final class ModelByteBuffer {
return len;
}
+ @Override
public int read() throws IOException {
if (left == 0)
return -1;
@@ -130,6 +139,7 @@ public final class ModelByteBuffer {
return b;
}
+ @Override
public void close() throws IOException {
raf.close();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
index 33515f400d8..45fa2954211 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java
@@ -22,14 +22,16 @@
* 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.io.InputStream;
+
import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioFormat.Encoding;
/**
* Wavetable oscillator for pre-loaded data.
@@ -52,6 +54,7 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
bigendian = format.isBigEndian();
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int avail = available();
if (avail <= 0)
@@ -82,6 +85,7 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
return len;
}
+ @Override
public long skip(long n) throws IOException {
int avail = available();
if (avail <= 0)
@@ -93,10 +97,12 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
return super.skip(n);
}
+ @Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b, 0, 1);
@@ -105,19 +111,23 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
return 0 & 0xFF;
}
+ @Override
public boolean markSupported() {
return true;
}
+ @Override
public int available() throws IOException {
return (int)buffer.capacity() + (int)buffer8.capacity() - pos - pos2;
}
+ @Override
public synchronized void mark(int readlimit) {
markpos = pos;
markpos2 = pos2;
}
+ @Override
public synchronized void reset() throws IOException {
pos = markpos;
pos2 = markpos2;
@@ -189,6 +199,7 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
return format;
}
+ @Override
public AudioFloatInputStream openStream() {
if (buffer == null)
return null;
@@ -230,16 +241,19 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
(int)buffer.arrayOffset(), (int)buffer.capacity());
}
+ @Override
public int getChannels() {
return getFormat().getChannels();
}
+ @Override
public ModelOscillatorStream open(float samplerate) {
// ModelWavetableOscillator doesn't support ModelOscillatorStream
return null;
}
// attenuation is in cB
+ @Override
public float getAttenuation() {
return attenuation;
}
@@ -248,6 +262,7 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
this.attenuation = attenuation;
}
+ @Override
public float getLoopLength() {
return loopLength;
}
@@ -256,6 +271,7 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
this.loopLength = loopLength;
}
+ @Override
public float getLoopStart() {
return loopStart;
}
@@ -268,10 +284,12 @@ public final class ModelByteBufferWavetable implements ModelWavetable {
this.loopType = loopType;
}
+ @Override
public int getLoopType() {
return loopType;
}
+ @Override
public float getPitchcorrection() {
return pitchcorrection;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java
index 4be6448f2a9..4058df93807 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.MidiChannel;
@@ -42,9 +43,9 @@ import javax.sound.midi.MidiChannel;
public interface ModelChannelMixer extends MidiChannel {
// Used to process input audio from voices mix.
- public boolean process(float[][] buffer, int offset, int len);
+ boolean process(float[][] buffer, int offset, int len);
// Is used to trigger that this mixer is not be used
// and it should fade out.
- public void stop();
+ void stop();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java
index 4b10cfad0a1..d4e6159e019 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Arrays;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java
index f1fe44e5c66..d3d0c1a8438 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java
index fa5543a835b..a6be739c01a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -32,5 +33,5 @@ package com.sun.media.sound;
*/
public interface ModelDirectedPlayer {
- public void play(int performerIndex, ModelConnectionBlock[] connectionBlocks);
+ void play(int performerIndex, ModelConnectionBlock[] connectionBlocks);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java
index fb452e453c8..a595de94a8a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -38,9 +39,9 @@ package com.sun.media.sound;
*/
public interface ModelDirector {
- public void noteOn(int noteNumber, int velocity);
+ void noteOn(int noteNumber, int velocity);
- public void noteOff(int noteNumber, int velocity);
+ void noteOff(int noteNumber, int velocity);
- public void close();
+ void close();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java
index 2e07fa13efc..6f0445f7fc3 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -134,6 +135,7 @@ public final class ModelIdentifier {
this.variable = variable;
}
+ @Override
public int hashCode() {
int hashcode = instance;
if(object != null) hashcode |= object.hashCode();
@@ -141,6 +143,7 @@ public final class ModelIdentifier {
return hashcode;
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof ModelIdentifier))
return false;
@@ -159,6 +162,7 @@ public final class ModelIdentifier {
return true;
}
+ @Override
public String toString() {
if (variable == null) {
return object + "[" + instance + "]";
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java
index 27e82c9fa6e..5ea60d25f71 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.Instrument;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
index 3eb68d9ea24..016bd24490c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java
@@ -22,9 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Comparator;
+
import javax.sound.midi.Instrument;
import javax.sound.midi.Patch;
@@ -36,6 +38,7 @@ import javax.sound.midi.Patch;
*/
public final class ModelInstrumentComparator implements Comparator {
+ @Override
public int compare(Instrument arg0, Instrument arg1) {
Patch p0 = arg0.getPatch();
Patch p1 = arg1.getPatch();
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java
index ed0e978a869..66bf61d25f2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.MidiChannel;
@@ -42,21 +43,25 @@ public final class ModelMappedInstrument extends ModelInstrument {
this.ins = ins;
}
+ @Override
public Object getData() {
return ins.getData();
}
+ @Override
public ModelPerformer[] getPerformers() {
return ins.getPerformers();
}
+ @Override
public ModelDirector getDirector(ModelPerformer[] performers,
- MidiChannel channel, ModelDirectedPlayer player) {
+ MidiChannel channel, ModelDirectedPlayer player) {
return ins.getDirector(performers, channel, player);
}
+ @Override
public ModelChannelMixer getChannelMixer(MidiChannel channel,
- AudioFormat format) {
+ AudioFormat format) {
return ins.getChannelMixer(channel, format);
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java
index a00409c3712..569b74d2820 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -32,13 +33,13 @@ package com.sun.media.sound;
*/
public interface ModelOscillator {
- public int getChannels();
+ int getChannels();
/**
* Attenuation is in cB.
* @return
*/
- public float getAttenuation();
+ float getAttenuation();
- public ModelOscillatorStream open(float samplerate);
+ ModelOscillatorStream open(float samplerate);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java
index 762905dec64..86f266f2167 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java
@@ -22,9 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
+
import javax.sound.midi.MidiChannel;
import javax.sound.midi.VoiceStatus;
@@ -35,14 +37,14 @@ import javax.sound.midi.VoiceStatus;
*/
public interface ModelOscillatorStream {
- public void setPitch(float pitch); // Pitch is in cents!
+ void setPitch(float pitch); // Pitch is in cents!
- public void noteOn(MidiChannel channel, VoiceStatus voice, int noteNumber,
- int velocity);
+ void noteOn(MidiChannel channel, VoiceStatus voice, int noteNumber,
+ int velocity);
- public void noteOff(int velocity);
+ void noteOff(int velocity);
- public int read(float[][] buffer, int offset, int len) throws IOException;
+ int read(float[][] buffer, int offset, int len) throws IOException;
- public void close() throws IOException;
+ void close() throws IOException;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java
index d8cfc611c86..9c0c187cc78 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.Patch;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java
index 661070c0d74..aed637900ef 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -35,9 +36,9 @@ import java.util.List;
*/
public final class ModelPerformer {
- private final List oscillators = new ArrayList();
- private List connectionBlocks
- = new ArrayList();
+ private final List oscillators = new ArrayList<>();
+ private List connectionBlocks = new ArrayList<>();
+
private int keyFrom = 0;
private int keyTo = 127;
private int velFrom = 0;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java
index f64f9c8b364..28a9461284c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java
index 115f28a6fad..a13cac95640 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Arrays;
@@ -52,9 +53,11 @@ public final class ModelStandardDirector implements ModelDirector {
}
}
+ @Override
public void close() {
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
if (!noteOffUsed)
return;
@@ -70,6 +73,7 @@ public final class ModelStandardDirector implements ModelDirector {
}
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
if (!noteOnUsed)
return;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
index a0c2aff39dd..f6b9908e9d4 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Arrays;
@@ -156,9 +157,11 @@ public final class ModelStandardIndexedDirector implements ModelDirector {
}
}
+ @Override
public void close() {
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
if (!noteOffUsed)
return;
@@ -172,6 +175,7 @@ public final class ModelStandardIndexedDirector implements ModelDirector {
}
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
if (!noteOnUsed)
return;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java
index c3e7fcb9b9b..ee24134585d 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -73,6 +74,7 @@ public final class ModelStandardTransform implements ModelTransform {
this.transform = transform;
}
+ @Override
public double transform(double value) {
double s;
double a;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java
index cbe0adb97b5..0512fcd2be4 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,5 +32,5 @@ package com.sun.media.sound;
*/
public interface ModelTransform {
- public abstract double transform(double value);
+ double transform(double value);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java
index 2884181bbf9..165bc6105a1 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,19 +32,19 @@ package com.sun.media.sound;
*/
public interface ModelWavetable extends ModelOscillator {
- public static final int LOOP_TYPE_OFF = 0;
- public static final int LOOP_TYPE_FORWARD = 1;
- public static final int LOOP_TYPE_RELEASE = 2;
- public static final int LOOP_TYPE_PINGPONG = 4;
- public static final int LOOP_TYPE_REVERSE = 8;
+ int LOOP_TYPE_OFF = 0;
+ int LOOP_TYPE_FORWARD = 1;
+ int LOOP_TYPE_RELEASE = 2;
+ int LOOP_TYPE_PINGPONG = 4;
+ int LOOP_TYPE_REVERSE = 8;
- public AudioFloatInputStream openStream();
+ AudioFloatInputStream openStream();
- public float getLoopLength();
+ float getLoopLength();
- public float getLoopStart();
+ float getLoopStart();
- public int getLoopType();
+ int getLoopType();
- public float getPitchcorrection();
+ float getPitchcorrection();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
index 5ba0558099d..edb26d5c9a5 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java
@@ -40,7 +40,6 @@ import javax.sound.sampled.AudioSystem;
*/
public final class PCMtoPCMCodec extends SunCodec {
-
private static final AudioFormat.Encoding[] inputEncodings = {
AudioFormat.Encoding.PCM_SIGNED,
AudioFormat.Encoding.PCM_UNSIGNED,
@@ -59,8 +58,7 @@ public final class PCMtoPCMCodec extends SunCodec {
super( inputEncodings, outputEncodings);
}
- // NEW CODE
-
+ @Override
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
final int sampleSize = sourceFormat.getSampleSizeInBits();
@@ -88,9 +86,7 @@ public final class PCMtoPCMCodec extends SunCodec {
return new AudioFormat.Encoding[0];
}
-
- /**
- */
+ @Override
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
Objects.requireNonNull(targetEncoding);
@@ -113,9 +109,7 @@ public final class PCMtoPCMCodec extends SunCodec {
return formatArray;
}
-
- /**
- */
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) {
if( isConversionSupported(targetEncoding, sourceStream.getFormat()) ) {
@@ -136,9 +130,8 @@ public final class PCMtoPCMCodec extends SunCodec {
}
}
- /**
- * use old code
- */
+
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream){
if (!isConversionSupported(targetFormat, sourceStream.getFormat()))
throw new IllegalArgumentException("Unsupported conversion: "
@@ -147,11 +140,6 @@ public final class PCMtoPCMCodec extends SunCodec {
return getConvertedStream( targetFormat, sourceStream );
}
-
-
-
- // OLD CODE
-
/**
* Opens the codec with the specified parameters.
* @param stream stream from which data to be processed should be read
@@ -160,7 +148,6 @@ public final class PCMtoPCMCodec extends SunCodec {
* @throws IllegalArgumentException if the format combination supplied is
* not supported.
*/
- /* public AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {*/
private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {
AudioInputStream cs = null;
@@ -172,13 +159,11 @@ public final class PCMtoPCMCodec extends SunCodec {
cs = stream;
} else {
- cs = (AudioInputStream) (new PCMtoPCMCodecStream(stream, outputFormat));
+ cs = new PCMtoPCMCodecStream(stream, outputFormat);
}
return cs;
}
-
-
/**
* Obtains the set of output formats supported by the codec
* given a particular input format.
@@ -186,7 +171,6 @@ public final class PCMtoPCMCodec extends SunCodec {
* returns an array of length 0.
* @return array of supported output formats.
*/
- /* public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
Vector formats = new Vector<>();
@@ -350,7 +334,6 @@ public final class PCMtoPCMCodec extends SunCodec {
return formatArray;
}
-
class PCMtoPCMCodecStream extends AudioInputStream {
private final int PCM_SWITCH_SIGNED_8BIT = 1;
@@ -460,7 +443,7 @@ public final class PCMtoPCMCodec extends SunCodec {
* Note that this only works for sign conversions.
* Other conversions require a read of at least 2 bytes.
*/
-
+ @Override
public int read() throws IOException {
// $$jb: do we want to implement this function?
@@ -489,12 +472,13 @@ public final class PCMtoPCMCodec extends SunCodec {
}
}
-
+ @Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
@@ -589,9 +573,5 @@ public final class PCMtoPCMCodec extends SunCodec {
}
}
}
-
-
-
} // end class PCMtoPCMCodecStream
-
} // end class PCMtoPCMCodec
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java
index 09ece592c93..3b24ceb679a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java
@@ -29,8 +29,6 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.StringTokenizer;
-
-
/**
* Audio configuration class for exposing attributes specific to the platform or system.
*
@@ -39,9 +37,6 @@ import java.util.StringTokenizer;
*/
final class Platform {
-
- // STATIC FINAL CHARACTERISTICS
-
// native library we need to load
private static final String libNameMain = "jsound";
private static final String libNameALSA = "jsoundalsa";
@@ -74,37 +69,26 @@ final class Platform {
readProperties();
}
-
/**
* Private constructor.
*/
private Platform() {
}
-
- // METHODS FOR INTERNAL IMPLEMENTATION USE
-
-
/**
* Dummy method for forcing initialization.
*/
static void initialize() {
-
if(Printer.trace)Printer.trace("Platform: initialize()");
}
-
/**
* Determine whether the system is big-endian.
*/
static boolean isBigEndian() {
-
return bigEndian;
}
-
- // PRIVATE METHODS
-
/**
* Load the native library or libraries.
*/
@@ -147,7 +131,6 @@ final class Platform {
}
}
-
static boolean isMidiIOEnabled() {
return isFeatureLibLoaded(FEATURE_MIDIIO);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java
index 8bf34bd8fdf..e4b795abdf2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java
@@ -27,14 +27,13 @@ package com.sun.media.sound;
import java.util.Vector;
+import javax.sound.sampled.BooleanControl;
+import javax.sound.sampled.CompoundControl;
import javax.sound.sampled.Control;
+import javax.sound.sampled.FloatControl;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Port;
-import javax.sound.sampled.BooleanControl;
-import javax.sound.sampled.CompoundControl;
-import javax.sound.sampled.FloatControl;
-
/**
* A Mixer which only provides Ports.
@@ -43,7 +42,6 @@ import javax.sound.sampled.FloatControl;
*/
final class PortMixer extends AbstractMixer {
- // CONSTANTS
private static final int SRC_UNKNOWN = 0x01;
private static final int SRC_MICROPHONE = 0x02;
private static final int SRC_LINE_IN = 0x03;
@@ -56,15 +54,13 @@ final class PortMixer extends AbstractMixer {
private static final int DST_LINE_OUT = 0x0400;
private static final int DST_MASK = 0xFF00;
- // INSTANCE VARIABLES
- private Port.Info[] portInfos;
+ private final Port.Info[] portInfos;
// cache of instantiated ports
private PortMixerPort[] ports;
// instance ID of the native implementation
private long id = 0;
- // CONSTRUCTOR
PortMixer(PortMixerProvider.PortMixerInfo portMixerInfo) {
// pass in Line.Info, mixer, controls
super(portMixerInfo, // Mixer.Info
@@ -121,9 +117,7 @@ final class PortMixer extends AbstractMixer {
if (Printer.trace) Printer.trace("<< PortMixer: constructor completed");
}
-
- // ABSTRACT MIXER: ABSTRACT METHOD IMPLEMENTATIONS
-
+ @Override
public Line getLine(Line.Info info) throws LineUnavailableException {
Line.Info fullInfo = getLineInfo(info);
@@ -137,7 +131,7 @@ final class PortMixer extends AbstractMixer {
throw new IllegalArgumentException("Line unsupported: " + info);
}
-
+ @Override
public int getMaxLines(Line.Info info) {
Line.Info fullInfo = getLineInfo(info);
@@ -153,7 +147,7 @@ final class PortMixer extends AbstractMixer {
return 0;
}
-
+ @Override
protected void implOpen() throws LineUnavailableException {
if (Printer.trace) Printer.trace(">> PortMixer: implOpen (id="+id+")");
@@ -163,6 +157,7 @@ final class PortMixer extends AbstractMixer {
if (Printer.trace) Printer.trace("<< PortMixer: implOpen succeeded.");
}
+ @Override
protected void implClose() {
if (Printer.trace) Printer.trace(">> PortMixer: implClose");
@@ -181,11 +176,11 @@ final class PortMixer extends AbstractMixer {
if (Printer.trace) Printer.trace("<< PortMixer: implClose succeeded");
}
+ @Override
protected void implStart() {}
+ @Override
protected void implStop() {}
- // IMPLEMENTATION HELPERS
-
private Port.Info getPortInfo(int portIndex, int type) {
switch (type) {
case SRC_UNKNOWN: return new PortInfo(nGetPortName(getID(), portIndex), true);
@@ -223,8 +218,6 @@ final class PortMixer extends AbstractMixer {
return id;
}
- // INNER CLASSES
-
/**
* Private inner class representing a Port for the PortMixer.
*/
@@ -234,7 +227,6 @@ final class PortMixer extends AbstractMixer {
private final int portIndex;
private long id;
- // CONSTRUCTOR
private PortMixerPort(Port.Info info,
PortMixer mixer,
int portIndex) {
@@ -243,11 +235,6 @@ final class PortMixer extends AbstractMixer {
this.portIndex = portIndex;
}
-
- // ABSTRACT METHOD IMPLEMENTATIONS
-
- // ABSTRACT LINE
-
void implOpen() throws LineUnavailableException {
if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
long newID = ((PortMixer) mixer).getID();
@@ -286,7 +273,6 @@ final class PortMixer extends AbstractMixer {
controls = new Control[0];
}
-
void implClose() {
if (Printer.trace) Printer.trace(">> PortMixerPort: implClose()");
// get rid of controls
@@ -294,9 +280,8 @@ final class PortMixer extends AbstractMixer {
if (Printer.trace) Printer.trace("<< PortMixerPort: implClose() succeeded");
}
- // METHOD OVERRIDES
-
// this is very similar to open(AudioFormat, int) in AbstractDataLine...
+ @Override
public void open() throws LineUnavailableException {
synchronized (mixer) {
// if the line is not currently open, try to open it with this format and buffer size
@@ -321,6 +306,7 @@ final class PortMixer extends AbstractMixer {
}
// this is very similar to close() in AbstractDataLine...
+ @Override
public void close() {
synchronized (mixer) {
if (isOpen()) {
@@ -342,7 +328,7 @@ final class PortMixer extends AbstractMixer {
} // class PortMixerPort
/**
- * Private inner class representing a BooleanControl for PortMixerPort
+ * Private inner class representing a BooleanControl for PortMixerPort.
*/
private static final class BoolCtrl extends BooleanControl {
// the handle to the native control function
@@ -360,7 +346,6 @@ final class PortMixer extends AbstractMixer {
return new BCT(name);
}
-
private BoolCtrl(long controlID, String name) {
this(controlID, createType(name));
}
@@ -370,12 +355,14 @@ final class PortMixer extends AbstractMixer {
this.controlID = controlID;
}
+ @Override
public void setValue(boolean value) {
if (!closed) {
nControlSetIntValue(controlID, value?1:0);
}
}
+ @Override
public boolean getValue() {
if (!closed) {
// never use any cached values
@@ -386,7 +373,7 @@ final class PortMixer extends AbstractMixer {
}
/**
- * inner class for custom types
+ * inner class for custom types.
*/
private static final class BCT extends BooleanControl.Type {
private BCT(String name) {
@@ -396,7 +383,7 @@ final class PortMixer extends AbstractMixer {
}
/**
- * Private inner class representing a CompoundControl for PortMixerPort
+ * Private inner class representing a CompoundControl for PortMixerPort.
*/
private static final class CompCtrl extends CompoundControl {
private CompCtrl(String name, Control[] controls) {
@@ -404,7 +391,7 @@ final class PortMixer extends AbstractMixer {
}
/**
- * inner class for custom compound control types
+ * inner class for custom compound control types.
*/
private static final class CCT extends CompoundControl.Type {
private CCT(String name) {
@@ -414,7 +401,7 @@ final class PortMixer extends AbstractMixer {
}
/**
- * Private inner class representing a BooleanControl for PortMixerPort
+ * Private inner class representing a BooleanControl for PortMixerPort.
*/
private static final class FloatCtrl extends FloatControl {
// the handle to the native control function
@@ -446,12 +433,14 @@ final class PortMixer extends AbstractMixer {
this.controlID = controlID;
}
+ @Override
public void setValue(float value) {
if (!closed) {
nControlSetFloatValue(controlID, value);
}
}
+ @Override
public float getValue() {
if (!closed) {
// never use any cached values
@@ -462,7 +451,7 @@ final class PortMixer extends AbstractMixer {
}
/**
- * inner class for custom types
+ * inner class for custom types.
*/
private static final class FCT extends FloatControl.Type {
private FCT(String name) {
@@ -472,7 +461,7 @@ final class PortMixer extends AbstractMixer {
}
/**
- * Private inner class representing a port info
+ * Private inner class representing a port info.
*/
private static final class PortInfo extends Port.Info {
private PortInfo(String name, boolean isSource) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java
index ce7f3596a48..a6e3275a41a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java
@@ -28,7 +28,6 @@ package com.sun.media.sound;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
-
/**
* Port provider.
*
@@ -36,8 +35,6 @@ import javax.sound.sampled.spi.MixerProvider;
*/
public final class PortMixerProvider extends MixerProvider {
- // STATIC VARIABLES
-
/**
* Set of info objects for all port input devices on the system.
*/
@@ -48,18 +45,11 @@ public final class PortMixerProvider extends MixerProvider {
*/
private static PortMixer[] devices;
-
- // STATIC
-
static {
// initialize
Platform.initialize();
}
-
- // CONSTRUCTOR
-
-
/**
* Required public no-arg constructor.
*/
@@ -93,6 +83,7 @@ public final class PortMixerProvider extends MixerProvider {
}
}
+ @Override
public Mixer.Info[] getMixerInfo() {
synchronized (PortMixerProvider.class) {
Mixer.Info[] localArray = new Mixer.Info[infos.length];
@@ -101,6 +92,7 @@ public final class PortMixerProvider extends MixerProvider {
}
}
+ @Override
public Mixer getMixer(Mixer.Info info) {
synchronized (PortMixerProvider.class) {
for (int i = 0; i < infos.length; i++) {
@@ -113,7 +105,6 @@ public final class PortMixerProvider extends MixerProvider {
String.format("Mixer %s not supported by this provider", info));
}
-
private static Mixer getDevice(PortMixerInfo info) {
int index = info.getIndex();
if (devices[index] == null) {
@@ -122,9 +113,6 @@ public final class PortMixerProvider extends MixerProvider {
return devices[index];
}
- // INNER CLASSES
-
-
/**
* Info class for PortMixers. Adds an index value for
* making native references to a particular device.
@@ -144,7 +132,6 @@ public final class PortMixerProvider extends MixerProvider {
} // class PortMixerInfo
- // NATIVE METHODS
private static native int nGetNumDevices();
private static native PortMixerInfo nNewPortMixerInfo(int mixerIndex);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
index 195ceedde08..7ece702f026 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
index 7b8d755509f..defa2418e77 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java
index 255c42099ec..3da63707788 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.EOFException;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java
index a417d6a16dc..805fd2d0c7f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.File;
@@ -39,21 +40,21 @@ public final class RIFFWriter extends OutputStream {
private interface RandomAccessWriter {
- public void seek(long chunksizepointer) throws IOException;
+ void seek(long chunksizepointer) throws IOException;
- public long getPointer() throws IOException;
+ long getPointer() throws IOException;
- public void close() throws IOException;
+ void close() throws IOException;
- public void write(int b) throws IOException;
+ void write(int b) throws IOException;
- public void write(byte[] b, int off, int len) throws IOException;
+ void write(byte[] b, int off, int len) throws IOException;
- public void write(byte[] bytes) throws IOException;
+ void write(byte[] bytes) throws IOException;
- public long length() throws IOException;
+ long length() throws IOException;
- public void setLength(long i) throws IOException;
+ void setLength(long i) throws IOException;
}
private static class RandomAccessFileWriter implements RandomAccessWriter {
@@ -68,34 +69,42 @@ public final class RIFFWriter extends OutputStream {
this.raf = new RandomAccessFile(name, "rw");
}
+ @Override
public void seek(long chunksizepointer) throws IOException {
raf.seek(chunksizepointer);
}
+ @Override
public long getPointer() throws IOException {
return raf.getFilePointer();
}
+ @Override
public void close() throws IOException {
raf.close();
}
+ @Override
public void write(int b) throws IOException {
raf.write(b);
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
raf.write(b, off, len);
}
+ @Override
public void write(byte[] bytes) throws IOException {
raf.write(bytes);
}
+ @Override
public long length() throws IOException {
return raf.length();
}
+ @Override
public void setLength(long i) throws IOException {
raf.setLength(i);
}
@@ -113,19 +122,23 @@ public final class RIFFWriter extends OutputStream {
this.stream = stream;
}
+ @Override
public void seek(long chunksizepointer) throws IOException {
pos = (int) chunksizepointer;
}
+ @Override
public long getPointer() throws IOException {
return pos;
}
+ @Override
public void close() throws IOException {
stream.write(buff, 0, length);
stream.close();
}
+ @Override
public void write(int b) throws IOException {
if (s == null)
s = new byte[1];
@@ -133,6 +146,7 @@ public final class RIFFWriter extends OutputStream {
write(s, 0, 1);
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
int newsize = pos + len;
if (newsize > length)
@@ -143,14 +157,17 @@ public final class RIFFWriter extends OutputStream {
}
}
+ @Override
public void write(byte[] bytes) throws IOException {
write(bytes, 0, bytes.length);
}
+ @Override
public long length() throws IOException {
return length;
}
+ @Override
public void setLength(long i) throws IOException {
length = (int) i;
if (length > buff.length) {
@@ -223,6 +240,7 @@ public final class RIFFWriter extends OutputStream {
return writeoverride;
}
+ @Override
public void close() throws IOException {
if (!open)
return;
@@ -245,6 +263,7 @@ public final class RIFFWriter extends OutputStream {
raf = null;
}
+ @Override
public void write(int b) throws IOException {
if (!writeoverride) {
if (chunktype != 2) {
@@ -259,6 +278,7 @@ public final class RIFFWriter extends OutputStream {
raf.write(b);
}
+ @Override
public void write(byte b[], int off, int len) throws IOException {
if (!writeoverride) {
if (chunktype != 2) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java
index fcb2a7af6fe..b0ae55001c3 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java
@@ -27,14 +27,27 @@ package com.sun.media.sound;
import java.io.IOException;
import java.io.InputStream;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
-import javax.sound.midi.*;
-
+import javax.sound.midi.ControllerEventListener;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MetaEventListener;
+import javax.sound.midi.MetaMessage;
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiEvent;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Sequencer;
+import javax.sound.midi.ShortMessage;
+import javax.sound.midi.Synthesizer;
+import javax.sound.midi.Track;
+import javax.sound.midi.Transmitter;
/**
* A Real Time Sequencer
@@ -48,8 +61,6 @@ import javax.sound.midi.*;
final class RealTimeSequencer extends AbstractMidiDevice
implements Sequencer, AutoConnectSequencer {
- // STATIC VARIABLES
-
/** debugging flags */
private static final boolean DEBUG_PUMP = false;
private static final boolean DEBUG_PUMP_ALL = false;
@@ -73,7 +84,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
private static final Sequencer.SyncMode masterSyncMode = Sequencer.SyncMode.INTERNAL_CLOCK;
private static final Sequencer.SyncMode slaveSyncMode = Sequencer.SyncMode.NO_SYNC;
-
/**
* Sequence on which this sequencer is operating.
*/
@@ -87,14 +97,12 @@ final class RealTimeSequencer extends AbstractMidiDevice
*/
private double cacheTempoMPQ = -1;
-
/**
* cache value for tempo factor until sequence is set
* -1 means not set.
*/
private float cacheTempoFactor = -1;
-
/** if a particular track is muted */
private boolean[] trackMuted = null;
/** if a particular track is solo */
@@ -108,47 +116,48 @@ final class RealTimeSequencer extends AbstractMidiDevice
*/
private volatile boolean running;
-
- /** the thread for pushing out the MIDI messages */
+ /**
+ * the thread for pushing out the MIDI messages.
+ */
private PlayThread playThread;
-
/**
- * True if we are recording
+ * True if we are recording.
*/
private volatile boolean recording;
-
/**
- * List of tracks to which we're recording
+ * List of tracks to which we're recording.
*/
private final List recordingTracks = new ArrayList<>();
-
private long loopStart = 0;
private long loopEnd = -1;
private int loopCount = 0;
-
/**
- * Meta event listeners
+ * Meta event listeners.
*/
private final ArrayList metaEventListeners = new ArrayList<>();
-
/**
- * Control change listeners
+ * Control change listeners.
*/
private final ArrayList controllerEventListeners = new ArrayList<>();
-
- /** automatic connection support */
+ /**
+ * automatic connection support.
+ */
private boolean autoConnect = false;
- /** if we need to autoconnect at next open */
+ /**
+ * if we need to autoconnect at next open.
+ */
private boolean doAutoConnectAtNextOpen = false;
- /** the receiver that this device is auto-connected to */
+ /**
+ * the receiver that this device is auto-connected to.
+ */
Receiver autoConnectedReceiver = null;
@@ -161,9 +170,9 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (Printer.trace) Printer.trace("<< RealTimeSequencer CONSTRUCTOR completed");
}
-
/* ****************************** SEQUENCER METHODS ******************** */
+ @Override
public synchronized void setSequence(Sequence sequence)
throws InvalidMidiDataException {
@@ -211,7 +220,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (Printer.trace) Printer.trace("<< RealTimeSequencer: setSequence(" + sequence +") completed");
}
-
+ @Override
public synchronized void setSequence(InputStream stream) throws IOException, InvalidMidiDataException {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: setSequence(" + stream +")");
@@ -229,12 +238,12 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
-
+ @Override
public Sequence getSequence() {
return sequence;
}
-
+ @Override
public synchronized void start() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: start()");
@@ -259,7 +268,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (Printer.trace) Printer.trace("<< RealTimeSequencer: start() completed");
}
-
+ @Override
public synchronized void stop() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: stop()");
@@ -280,12 +289,12 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (Printer.trace) Printer.trace("<< RealTimeSequencer: stop() completed");
}
-
+ @Override
public boolean isRunning() {
return running;
}
-
+ @Override
public void startRecording() {
if (!isOpen()) {
throw new IllegalStateException("Sequencer not open");
@@ -295,7 +304,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
recording = true;
}
-
+ @Override
public void stopRecording() {
if (!isOpen()) {
throw new IllegalStateException("Sequencer not open");
@@ -303,12 +312,12 @@ final class RealTimeSequencer extends AbstractMidiDevice
recording = false;
}
-
+ @Override
public boolean isRecording() {
return recording;
}
-
+ @Override
public void recordEnable(Track track, int channel) {
if (!findTrack(track)) {
throw new IllegalArgumentException("Track does not exist in the current sequence");
@@ -325,7 +334,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
-
+ @Override
public void recordDisable(Track track) {
synchronized(recordingTracks) {
RecordingTrack rc = RecordingTrack.get(recordingTracks, track);
@@ -336,7 +345,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
-
private boolean findTrack(Track track) {
boolean found = false;
if (sequence != null) {
@@ -351,14 +359,14 @@ final class RealTimeSequencer extends AbstractMidiDevice
return found;
}
-
+ @Override
public float getTempoInBPM() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoInBPM() ");
return (float) MidiUtils.convertTempo(getTempoInMPQ());
}
-
+ @Override
public void setTempoInBPM(float bpm) {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: setTempoInBPM() ");
if (bpm <= 0) {
@@ -369,7 +377,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
setTempoInMPQ((float) MidiUtils.convertTempo((double) bpm));
}
-
+ @Override
public float getTempoInMPQ() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoInMPQ() ");
@@ -389,7 +397,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
return getDataPump().getTempoMPQ();
}
-
+ @Override
public void setTempoInMPQ(float mpq) {
if (mpq <= 0) {
// should throw IllegalArgumentException
@@ -410,7 +418,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public void setTempoFactor(float factor) {
if (factor <= 0) {
// should throw IllegalArgumentException
@@ -428,7 +436,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public float getTempoFactor() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoFactor() ");
@@ -441,7 +449,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
return getDataPump().getTempoFactor();
}
-
+ @Override
public long getTickLength() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTickLength() ");
@@ -452,7 +460,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
return sequence.getTickLength();
}
-
+ @Override
public synchronized long getTickPosition() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTickPosition() ");
@@ -463,7 +471,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
return getDataPump().getTickPos();
}
-
+ @Override
public synchronized void setTickPosition(long tick) {
if (tick < 0) {
// should throw IllegalArgumentException
@@ -486,7 +494,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public long getMicrosecondLength() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getMicrosecondLength() ");
@@ -497,7 +505,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
return sequence.getMicrosecondLength();
}
-
+ @Override
public long getMicrosecondPosition() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getMicrosecondPosition() ");
@@ -509,7 +517,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public void setMicrosecondPosition(long microseconds) {
if (microseconds < 0) {
// should throw IllegalArgumentException
@@ -534,34 +542,34 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public void setMasterSyncMode(Sequencer.SyncMode sync) {
// not supported
}
-
+ @Override
public Sequencer.SyncMode getMasterSyncMode() {
return masterSyncMode;
}
-
+ @Override
public Sequencer.SyncMode[] getMasterSyncModes() {
Sequencer.SyncMode[] returnedModes = new Sequencer.SyncMode[masterSyncModes.length];
System.arraycopy(masterSyncModes, 0, returnedModes, 0, masterSyncModes.length);
return returnedModes;
}
-
+ @Override
public void setSlaveSyncMode(Sequencer.SyncMode sync) {
// not supported
}
-
+ @Override
public Sequencer.SyncMode getSlaveSyncMode() {
return slaveSyncMode;
}
-
+ @Override
public Sequencer.SyncMode[] getSlaveSyncModes() {
Sequencer.SyncMode[] returnedModes = new Sequencer.SyncMode[slaveSyncModes.length];
System.arraycopy(slaveSyncModes, 0, returnedModes, 0, slaveSyncModes.length);
@@ -577,8 +585,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
return 0;
}
-
-
+ @Override
public synchronized void setTrackMute(int track, boolean mute) {
int trackCount = getTrackCount();
if (track < 0 || track >= getTrackCount()) return;
@@ -589,14 +596,14 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public synchronized boolean getTrackMute(int track) {
if (track < 0 || track >= getTrackCount()) return false;
if (trackMuted == null || trackMuted.length <= track) return false;
return trackMuted[track];
}
-
+ @Override
public synchronized void setTrackSolo(int track, boolean solo) {
int trackCount = getTrackCount();
if (track < 0 || track >= getTrackCount()) return;
@@ -607,14 +614,14 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public synchronized boolean getTrackSolo(int track) {
if (track < 0 || track >= getTrackCount()) return false;
if (trackSolo == null || trackSolo.length <= track) return false;
return trackSolo[track];
}
-
+ @Override
public boolean addMetaEventListener(MetaEventListener listener) {
synchronized(metaEventListeners) {
if (! metaEventListeners.contains(listener)) {
@@ -625,7 +632,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public void removeMetaEventListener(MetaEventListener listener) {
synchronized(metaEventListeners) {
int index = metaEventListeners.indexOf(listener);
@@ -635,7 +642,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public int[] addControllerEventListener(ControllerEventListener listener, int[] controllers) {
synchronized(controllerEventListeners) {
@@ -663,7 +670,7 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
+ @Override
public int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers) {
synchronized(controllerEventListeners) {
ControllerListElement cve = null;
@@ -690,9 +697,9 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
////////////////// LOOPING (added in 1.5) ///////////////////////
+ @Override
public void setLoopStartPoint(long tick) {
if ((tick > getTickLength())
|| ((loopEnd != -1) && (tick > loopEnd))
@@ -702,10 +709,12 @@ final class RealTimeSequencer extends AbstractMidiDevice
loopStart = tick;
}
+ @Override
public long getLoopStartPoint() {
return loopStart;
}
+ @Override
public void setLoopEndPoint(long tick) {
if ((tick > getTickLength())
|| ((loopStart > tick) && (tick != -1))
@@ -715,10 +724,12 @@ final class RealTimeSequencer extends AbstractMidiDevice
loopEnd = tick;
}
+ @Override
public long getLoopEndPoint() {
return loopEnd;
}
+ @Override
public void setLoopCount(int count) {
if (count != LOOP_CONTINUOUSLY
&& count < 0) {
@@ -730,15 +741,14 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
+ @Override
public int getLoopCount() {
return loopCount;
}
-
/* *********************************** play control ************************* */
- /*
- */
+ @Override
protected void implOpen() throws MidiUnavailableException {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: implOpen()");
@@ -820,14 +830,15 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
- /** populate the caches with the current values */
+ /**
+ * populate the caches with the current values.
+ */
private synchronized void setCaches() {
cacheTempoFactor = getTempoFactor();
cacheTempoMPQ = getTempoInMPQ();
}
-
-
+ @Override
protected synchronized void implClose() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: implClose() ");
@@ -882,7 +893,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (Printer.trace) Printer.trace("<< RealTimeSequencer: implStart() completed");
}
-
void implStop() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStop()");
@@ -953,8 +963,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
getEventDispatcher().sendAudioEvents(message, sendToListeners);
}
-
-
private boolean needCaching() {
return !isOpen() || (sequence == null) || (playThread == null);
}
@@ -988,42 +996,39 @@ final class RealTimeSequencer extends AbstractMidiDevice
return array;
}
-
// OVERRIDES OF ABSTRACT MIDI DEVICE METHODS
+ @Override
protected boolean hasReceivers() {
return true;
}
// for recording
+ @Override
protected Receiver createReceiver() throws MidiUnavailableException {
return new SequencerReceiver();
}
-
+ @Override
protected boolean hasTransmitters() {
return true;
}
-
+ @Override
protected Transmitter createTransmitter() throws MidiUnavailableException {
return new SequencerTransmitter();
}
-
// interface AutoConnectSequencer
+ @Override
public void setAutoConnect(Receiver autoConnectedReceiver) {
this.autoConnect = (autoConnectedReceiver != null);
this.autoConnectedReceiver = autoConnectedReceiver;
}
-
-
- // INNER CLASSES
-
/**
* An own class to distinguish the class name from
- * the transmitter of other devices
+ * the transmitter of other devices.
*/
private class SequencerTransmitter extends BasicTransmitter {
private SequencerTransmitter() {
@@ -1031,9 +1036,9 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
final class SequencerReceiver extends AbstractReceiver {
+ @Override
void implSend(MidiMessage message, long timeStamp) {
if (recording) {
long tickPos = 0;
@@ -1080,7 +1085,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
private static class RealTimeSequencerInfo extends MidiDevice.Info {
private static final String name = "Real Time Sequencer";
@@ -1093,7 +1097,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
} // class Info
-
private class ControllerListElement {
// $$jb: using an array for controllers b/c its
@@ -1202,7 +1205,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
} // class ControllerListElement
-
static class RecordingTrack {
private final Track track;
@@ -1244,7 +1246,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
final class PlayThread implements Runnable {
private Thread thread;
private final Object lock = new Object();
@@ -1351,13 +1352,13 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
/**
* Main process loop driving the media flow.
*
* Make sure to NOT synchronize on RealTimeSequencer
* anywhere here (even implicit). That is a sure deadlock!
*/
+ @Override
public void run() {
while (!interrupted) {
@@ -1409,10 +1410,9 @@ final class RealTimeSequencer extends AbstractMidiDevice
}
}
-
/**
* class that does the actual dispatching of events,
- * used to be in native in MMAPI
+ * used to be in native in MMAPI.
*/
private class DataPump {
private float currTempo; // MPQ tempo
@@ -1434,7 +1434,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
//private sun.misc.Perf perf = sun.misc.Perf.getPerf();
//private long perfFreq = perf.highResFrequency();
-
DataPump() {
init();
}
@@ -1516,8 +1515,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
trackDisabled = newDisabled;
}
-
-
synchronized void setSequence(Sequence seq) {
if (seq == null) {
init();
@@ -1568,7 +1565,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (DEBUG_PUMP) Printer.println(" noteOff: sent "+done+" messages.");
}
-
private boolean[] makeDisabledArray() {
if (tracks == null) {
return null;
@@ -1656,11 +1652,10 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (DEBUG_PUMP) Printer.println(" sendNoteOffIfOn: sent "+done+" messages.");
}
-
/**
* Runtime application of mute/solo:
* if a track is muted that was previously playing, send
- * note off events for all currently playing notes
+ * note off events for all currently playing notes.
*/
private void applyDisabledTracks(boolean[] oldDisabled, boolean[] newDisabled) {
byte[][] tempArray = null;
@@ -1781,8 +1776,9 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (DEBUG_PUMP) Printer.println(" chaseTrackEvents track "+trackNum+": sent "+numControllersSent+" controllers.");
}
-
- /** chase controllers and program for all tracks */
+ /**
+ * chase controllers and program for all tracks.
+ */
synchronized void chaseEvents(long startTick, long endTick) {
if (DEBUG_PUMP) Printer.println(">> chaseEvents from tick "+startTick+".."+(endTick-1));
byte[][] tempArray = new byte[128][16];
@@ -1797,7 +1793,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
if (DEBUG_PUMP) Printer.println("<< chaseEvents");
}
-
// playback related methods (pumping)
private long getCurrentTimeMillis() {
@@ -1900,7 +1895,6 @@ final class RealTimeSequencer extends AbstractMidiDevice
return changesPending;
}
-
/** the main pump method
* @return true if end of sequence is reached
*/
@@ -2078,7 +2072,5 @@ final class RealTimeSequencer extends AbstractMidiDevice
return EOM;
}
-
} // class DataPump
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java
index b06d6dbc0ca..99dbbd69ab5 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java
@@ -29,8 +29,6 @@ import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Receiver;
import javax.sound.midi.Transmitter;
-
-
/** MidiDevice that can use reference counting for open/close.
* This interface is intended to be used by MidiSystem.getTransmitter() and
* MidiSystem.getReceiver().
@@ -42,11 +40,11 @@ public interface ReferenceCountingDevice {
* This method is similar to MidiDevice.getReceiver(). However, by calling this one,
* the device is opened implicitly. This is needed by MidiSystem.getReceiver().
*/
- public Receiver getReceiverReferenceCounting() throws MidiUnavailableException;
+ Receiver getReceiverReferenceCounting() throws MidiUnavailableException;
/** Retrieve a Transmitter that opens the device implicitly.
* This method is similar to MidiDevice.getTransmitter(). However, by calling this one,
* the device is opened implicitly. This is needed by MidiSystem.getTransmitter().
*/
- public Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException;
+ Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java
index 22ed404ddf8..f59828b9408 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java
index 580882ba765..137dd1a5875 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -45,8 +46,7 @@ public final class SF2Instrument extends ModelInstrument {
long genre = 0;
long morphology = 0;
SF2GlobalRegion globalregion = null;
- List regions
- = new ArrayList();
+ List regions = new ArrayList<>();
public SF2Instrument() {
super(null, null, null, null);
@@ -56,6 +56,7 @@ public final class SF2Instrument extends ModelInstrument {
super(soundbank, null, null, null);
}
+ @Override
public String getName() {
return name;
}
@@ -64,6 +65,7 @@ public final class SF2Instrument extends ModelInstrument {
this.name = name;
}
+ @Override
public Patch getPatch() {
if (bank == 128)
return new ModelPatch(0, preset, true);
@@ -81,6 +83,7 @@ public final class SF2Instrument extends ModelInstrument {
}
}
+ @Override
public Object getData() {
return null;
}
@@ -121,6 +124,7 @@ public final class SF2Instrument extends ModelInstrument {
globalregion = zone;
}
+ @Override
public String toString() {
if (bank == 128)
return "Drumkit: " + name + " preset #" + preset;
@@ -129,6 +133,7 @@ public final class SF2Instrument extends ModelInstrument {
+ " preset #" + preset;
}
+ @Override
public ModelPerformer[] getPerformers() {
int performercount = 0;
for (SF2InstrumentRegion presetzone : regions)
@@ -138,7 +143,7 @@ public final class SF2Instrument extends ModelInstrument {
SF2GlobalRegion presetglobal = globalregion;
for (SF2InstrumentRegion presetzone : regions) {
- Map pgenerators = new HashMap();
+ Map pgenerators = new HashMap<>();
pgenerators.putAll(presetzone.getGenerators());
if (presetglobal != null)
pgenerators.putAll(presetglobal.getGenerators());
@@ -267,7 +272,7 @@ public final class SF2Instrument extends ModelInstrument {
if (buff24 != null)
osc.set8BitExtensionBuffer(buff24);
- Map generators = new HashMap();
+ Map generators = new HashMap<>();
if (layerglobal != null)
generators.putAll(layerglobal.getGenerators());
generators.putAll(layerzone.getGenerators());
@@ -608,6 +613,7 @@ public final class SF2Instrument extends ModelInstrument {
new ModelConnectionBlock(
new ModelSource(ModelSource.SOURCE_NOTEON_VELOCITY,
new ModelTransform() {
+ @Override
public double transform(double value) {
if (value < 0.5)
return 1 - value * 2;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
index 87a62c42e05..e966a295314 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java
index e0bc76a4f9d..455bae429b8 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java
@@ -38,7 +38,7 @@ public final class SF2Layer extends SoundbankResource {
String name = "";
SF2GlobalRegion globalregion = null;
- List regions = new ArrayList();
+ List regions = new ArrayList<>();
public SF2Layer(SF2Soundbank soundBank) {
super(soundBank, null, null);
@@ -48,10 +48,12 @@ public final class SF2Layer extends SoundbankResource {
super(null, null, null);
}
+ @Override
public Object getData() {
return null;
}
+ @Override
public String getName() {
return name;
}
@@ -72,6 +74,7 @@ public final class SF2Layer extends SoundbankResource {
globalregion = zone;
}
+ @Override
public String toString() {
return "Layer: " + name;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java
index 8833e384c3e..39044e59534 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java
index 11930714219..4acf6851bf0 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java
index 264c3f9038c..8b9bec95de2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -97,8 +98,8 @@ public class SF2Region {
public static final int GENERATOR_OVERRIDINGROOTKEY = 58;
public static final int GENERATOR_UNUSED5 = 59;
public static final int GENERATOR_ENDOPR = 60;
- protected Map generators = new HashMap();
- protected List modulators = new ArrayList();
+ protected Map generators = new HashMap<>();
+ protected List modulators = new ArrayList<>();
public Map getGenerators() {
return generators;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java
index 4a2f0fc58d7..c0d97c173c9 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.InputStream;
@@ -57,6 +58,7 @@ public final class SF2Sample extends SoundbankResource {
super(null, null, AudioInputStream.class);
}
+ @Override
public Object getData() {
AudioFormat format = getFormat();
@@ -146,6 +148,7 @@ public final class SF2Sample extends SoundbankResource {
}
*/
+ @Override
public String getName() {
return name;
}
@@ -210,6 +213,7 @@ public final class SF2Sample extends SoundbankResource {
this.startLoop = startLoop;
}
+ @Override
public String toString() {
return "Sample: " + name;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java
index d45d50162bb..7025a83bd81 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.File;
@@ -81,9 +82,9 @@ public final class SF2Soundbank implements Soundbank {
private ModelByteBuffer sampleData24 = null;
private File sampleFile = null;
private boolean largeFormat = false;
- private final List instruments = new ArrayList();
- private final List layers = new ArrayList();
- private final List samples = new ArrayList();
+ private final List instruments = new ArrayList<>();
+ private final List layers = new ArrayList<>();
+ private final List samples = new ArrayList<>();
public SF2Soundbank() {
}
@@ -224,19 +225,15 @@ public final class SF2Soundbank implements Soundbank {
private void readPdtaChunk(RIFFReader riff) throws IOException {
- List presets = new ArrayList();
- List presets_bagNdx = new ArrayList();
- List presets_splits_gen
- = new ArrayList();
- List presets_splits_mod
- = new ArrayList();
+ List presets = new ArrayList<>();
+ List presets_bagNdx = new ArrayList<>();
+ List presets_splits_gen = new ArrayList<>();
+ List presets_splits_mod = new ArrayList<>();
- List instruments = new ArrayList();
- List instruments_bagNdx = new ArrayList();
- List instruments_splits_gen
- = new ArrayList();
- List instruments_splits_mod
- = new ArrayList();
+ List instruments = new ArrayList<>();
+ List instruments_bagNdx = new ArrayList<>();
+ List instruments_splits_gen = new ArrayList<>();
+ List instruments_splits_mod = new ArrayList<>();
while (riff.hasNextChunk()) {
RIFFReader chunk = riff.nextChunk();
@@ -830,18 +827,22 @@ public final class SF2Soundbank implements Soundbank {
}
+ @Override
public String getName() {
return name;
}
+ @Override
public String getVersion() {
return major + "." + minor;
}
+ @Override
public String getVendor() {
return engineers;
}
+ @Override
public String getDescription() {
return comments;
}
@@ -858,6 +859,7 @@ public final class SF2Soundbank implements Soundbank {
comments = s;
}
+ @Override
public SoundbankResource[] getResources() {
SoundbankResource[] resources
= new SoundbankResource[layers.size() + samples.size()];
@@ -869,6 +871,7 @@ public final class SF2Soundbank implements Soundbank {
return resources;
}
+ @Override
public SF2Instrument[] getInstruments() {
SF2Instrument[] inslist_array
= instruments.toArray(new SF2Instrument[instruments.size()]);
@@ -884,6 +887,7 @@ public final class SF2Soundbank implements Soundbank {
return samples.toArray(new SF2Sample[samples.size()]);
}
+ @Override
public Instrument getInstrument(Patch patch) {
int program = patch.getProgram();
int bank = patch.getBank();
@@ -972,11 +976,11 @@ public final class SF2Soundbank implements Soundbank {
public void removeResource(SoundbankResource resource) {
if (resource instanceof SF2Instrument)
- instruments.remove((SF2Instrument)resource);
+ instruments.remove(resource);
if (resource instanceof SF2Layer)
- layers.remove((SF2Layer)resource);
+ layers.remove(resource);
if (resource instanceof SF2Sample)
- samples.remove((SF2Sample)resource);
+ samples.remove(resource);
}
public void addInstrument(SF2Instrument resource) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java
index a61094fb4df..312c16904e4 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java
@@ -22,12 +22,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.Soundbank;
import javax.sound.midi.spi.SoundbankReader;
@@ -40,6 +42,7 @@ import javax.sound.midi.spi.SoundbankReader;
*/
public final class SF2SoundbankReader extends SoundbankReader {
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
try {
@@ -51,6 +54,7 @@ public final class SF2SoundbankReader extends SoundbankReader {
}
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
try {
@@ -62,6 +66,7 @@ public final class SF2SoundbankReader extends SoundbankReader {
}
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
try {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java
index af4a35ef9ff..682a267745f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java
@@ -22,10 +22,12 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
import java.util.List;
+
import javax.sound.midi.Patch;
/**
@@ -48,8 +50,7 @@ public class SimpleInstrument extends ModelInstrument {
protected int bank = 0;
protected boolean percussion = false;
protected String name = "";
- protected List parts
- = new ArrayList();
+ protected List parts = new ArrayList<>();
public SimpleInstrument() {
super(null, null, null, null);
@@ -121,6 +122,7 @@ public class SimpleInstrument extends ModelInstrument {
add(ins.getPerformers());
}
+ @Override
public ModelPerformer[] getPerformers() {
int percount = 0;
@@ -166,10 +168,12 @@ public class SimpleInstrument extends ModelInstrument {
return performers;
}
+ @Override
public Object getData() {
return null;
}
+ @Override
public String getName() {
return this.name;
}
@@ -178,6 +182,7 @@ public class SimpleInstrument extends ModelInstrument {
this.name = name;
}
+ @Override
public ModelPatch getPatch() {
return new ModelPatch(bank, preset, percussion);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java
index d922633bc10..fab639cde3b 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -44,21 +45,25 @@ public class SimpleSoundbank implements Soundbank {
String version = "";
String vendor = "";
String description = "";
- List resources = new ArrayList();
- List instruments = new ArrayList();
+ List resources = new ArrayList<>();
+ List instruments = new ArrayList<>();
+ @Override
public String getName() {
return name;
}
+ @Override
public String getVersion() {
return version;
}
+ @Override
public String getVendor() {
return vendor;
}
+ @Override
public String getDescription() {
return description;
}
@@ -79,10 +84,12 @@ public class SimpleSoundbank implements Soundbank {
this.version = version;
}
+ @Override
public SoundbankResource[] getResources() {
return resources.toArray(new SoundbankResource[resources.size()]);
}
+ @Override
public Instrument[] getInstruments() {
Instrument[] inslist_array
= instruments.toArray(new Instrument[resources.size()]);
@@ -90,6 +97,7 @@ public class SimpleSoundbank implements Soundbank {
return inslist_array;
}
+ @Override
public Instrument getInstrument(Patch patch) {
int program = patch.getProgram();
int bank = patch.getBank();
@@ -120,7 +128,7 @@ public class SimpleSoundbank implements Soundbank {
public void removeResource(SoundbankResource resource) {
if (resource instanceof Instrument)
- instruments.remove((Instrument) resource);
+ instruments.remove(resource);
else
resources.remove(resource);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java
index 45c83553457..ef9eac6dd03 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -74,14 +75,17 @@ public abstract class SoftAbstractResampler implements SoftResampler {
ibuffer_order = true;
}
+ @Override
public void noteOn(MidiChannel channel, VoiceStatus voice,
- int noteNumber, int velocity) {
+ int noteNumber, int velocity) {
}
+ @Override
public void noteOff(int velocity) {
noteOff_flag = true;
}
+ @Override
public void open(ModelWavetable osc, float outputsamplerate)
throws IOException {
@@ -135,6 +139,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
nextBuffer();
}
+ @Override
public void setPitch(float pitch) {
/*
this.pitch = (float) Math.pow(2f,
@@ -254,6 +259,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
}
}
+ @Override
public int read(float[][] buffer, int offset, int len)
throws IOException {
@@ -373,6 +379,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
return len;
}
+ @Override
public void close() throws IOException {
stream.close();
}
@@ -384,6 +391,7 @@ public abstract class SoftAbstractResampler implements SoftResampler {
float in_end, float[] pitch, float pitchstep, float[] out,
int[] out_offset, int out_end);
+ @Override
public final SoftResamplerStreamer openStreamer() {
return new ModelAbstractResamplerStream();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java
index 45b2d0f1d9c..5e8e7e1b8fa 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Arrays;
@@ -123,6 +124,5 @@ public final class SoftAudioBuffer {
}
}
}
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java
index 6b6fdde9caf..4a10b03efed 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,18 +32,17 @@ package com.sun.media.sound;
*/
public interface SoftAudioProcessor {
- public void globalParameterControlChange(int[] slothpath, long param,
- long value);
+ void globalParameterControlChange(int[] slothpath, long param, long value);
- public void init(float samplerate, float controlrate);
+ void init(float samplerate, float controlrate);
- public void setInput(int pin, SoftAudioBuffer input);
+ void setInput(int pin, SoftAudioBuffer input);
- public void setOutput(int pin, SoftAudioBuffer output);
+ void setOutput(int pin, SoftAudioBuffer output);
- public void setMixMode(boolean mix);
+ void setMixMode(boolean mix);
- public void processAudio();
+ void processAudio();
- public void processControlLogic();
+ void processControlLogic();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java
index 3a5e6d9dc1b..4f9c9f21c5c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -70,6 +71,7 @@ public final class SoftAudioPusher implements Runnable {
}
}
+ @Override
public void run() {
byte[] buffer = SoftAudioPusher.this.buffer;
AudioInputStream ais = SoftAudioPusher.this.ais;
@@ -87,6 +89,5 @@ public final class SoftAudioPusher implements Runnable {
active = false;
//e.printStackTrace();
}
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java
index 667b9cc3741..4f7fad6bacc 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -41,7 +42,7 @@ import javax.sound.midi.Patch;
*/
public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
- private static boolean[] dontResetControls = new boolean[128];
+ private static final boolean[] dontResetControls = new boolean[128];
static {
for (int i = 0; i < dontResetControls.length; i++)
dontResetControls[i] = false;
@@ -99,18 +100,18 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
private boolean solo = false;
private boolean solomute = false;
private final Object control_mutex;
- private int channel;
- private SoftVoice[] voices;
+ private final int channel;
+ private final SoftVoice[] voices;
private int bank;
private int program;
- private SoftSynthesizer synthesizer;
- private SoftMainMixer mainmixer;
- private int[] polypressure = new int[128];
+ private final SoftSynthesizer synthesizer;
+ private final SoftMainMixer mainmixer;
+ private final int[] polypressure = new int[128];
private int channelpressure = 0;
- private int[] controller = new int[128];
+ private final int[] controller = new int[128];
private int pitchbend;
- private double[] co_midi_pitch = new double[1];
- private double[] co_midi_channel_pressure = new double[1];
+ private final double[] co_midi_pitch = new double[1];
+ private final double[] co_midi_channel_pressure = new double[1];
SoftTuning tuning = new SoftTuning();
int tuning_bank = 0;
int tuning_program = 0;
@@ -132,6 +133,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
double[] channel_pressure = co_midi_channel_pressure;
double[] poly_pressure = new double[1];
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -145,26 +147,28 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
- private SoftControl[] co_midi = new SoftControl[128];
+ private final SoftControl[] co_midi = new SoftControl[128];
{
for (int i = 0; i < co_midi.length; i++) {
co_midi[i] = new MidiControlObject();
}
}
- private double[][] co_midi_cc_cc = new double[128][1];
- private SoftControl co_midi_cc = new SoftControl() {
+ private final double[][] co_midi_cc_cc = new double[128][1];
+ private final SoftControl co_midi_cc = new SoftControl() {
double[][] cc = co_midi_cc_cc;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
return cc[Integer.parseInt(name)];
}
};
- Map co_midi_rpn_rpn_i = new HashMap();
- Map co_midi_rpn_rpn = new HashMap();
- private SoftControl co_midi_rpn = new SoftControl() {
+ Map co_midi_rpn_rpn_i = new HashMap<>();
+ Map co_midi_rpn_rpn = new HashMap<>();
+ private final SoftControl co_midi_rpn = new SoftControl() {
Map rpn = co_midi_rpn_rpn;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -177,10 +181,11 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
return v;
}
};
- Map co_midi_nrpn_nrpn_i = new HashMap();
- Map co_midi_nrpn_nrpn = new HashMap();
- private SoftControl co_midi_nrpn = new SoftControl() {
+ Map co_midi_nrpn_nrpn_i = new HashMap<>();
+ Map co_midi_nrpn_nrpn = new HashMap<>();
+ private final SoftControl co_midi_nrpn = new SoftControl() {
Map nrpn = co_midi_nrpn_nrpn;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -407,6 +412,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
noteOn(noteNumber, velocity, 0);
}
@@ -544,6 +550,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
noteNumber = restrict7Bit(noteNumber);
velocity = restrict7Bit(velocity);
@@ -616,7 +623,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
- private int[] lastVelocity = new int[128];
+ private final int[] lastVelocity = new int[128];
private int prevVoiceID;
private boolean firstVoice = true;
private int voiceNo = 0;
@@ -625,6 +632,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
private int play_delay = 0;
private boolean play_releasetriggered = false;
+ @Override
public void play(int performerIndex, ModelConnectionBlock[] connectionBlocks) {
int noteNumber = play_noteNumber;
@@ -657,11 +665,13 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
connectionBlocks, current_mixer, releasetriggered);
}
+ @Override
public void noteOff(int noteNumber) {
if(noteNumber < 0 || noteNumber > 127) return;
noteOff_internal(noteNumber, 64);
}
+ @Override
public void setPolyPressure(int noteNumber, int pressure) {
noteNumber = restrict7Bit(noteNumber);
pressure = restrict7Bit(pressure);
@@ -680,12 +690,14 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public int getPolyPressure(int noteNumber) {
synchronized (control_mutex) {
return polypressure[noteNumber];
}
}
+ @Override
public void setChannelPressure(int pressure) {
pressure = restrict7Bit(pressure);
if (current_mixer != null)
@@ -701,6 +713,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public int getChannelPressure() {
synchronized (control_mutex) {
return channelpressure;
@@ -823,7 +836,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
05 LFO Amplitude Depth | 00H..7FH | 0..100 percent | 0
*/
- List conns = new ArrayList();
+ List conns = new ArrayList<>();
for (int i = 0; i < destination.length; i++) {
int d = destination[i];
@@ -869,6 +882,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
final double scale = (r / 64.0);
ModelTransform mt = new ModelTransform() {
double s = scale;
+ @Override
public double transform(double value) {
if (s < 1)
value = s + (value * (1.0 - s));
@@ -923,6 +937,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
ModelTransform mt = new ModelTransform() {
double s = scale;
+ @Override
public double transform(double value) {
return -((5.0 / 12.0) / Math.log(10))
* Math.log(1 - value * s);
@@ -1055,6 +1070,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
return (int)(keybasedcontroller_value[noteNumber][controller] * 128);
}
+ @Override
public void controlChange(int controller, int value) {
controller = restrict7Bit(controller);
value = restrict7Bit(value);
@@ -1241,6 +1257,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public int getController(int controller) {
synchronized (control_mutex) {
// Should only return lower 7 bits,
@@ -1259,10 +1276,12 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public void programChange(int program) {
programChange(bank, program);
}
+ @Override
public void programChange(int bank, int program) {
bank = restrict14Bit(bank);
program = restrict7Bit(program);
@@ -1277,12 +1296,14 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public int getProgram() {
synchronized (control_mutex) {
return program;
}
}
+ @Override
public void setPitchBend(int bend) {
bend = restrict14Bit(bend);
if (current_mixer != null)
@@ -1297,6 +1318,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public int getPitchBend() {
synchronized (control_mutex) {
return pitchbend;
@@ -1398,6 +1420,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
voices[i].rpnChange(controller, val_i[0]);
}
+ @Override
public void resetAllControllers() {
resetAllControllers(false);
}
@@ -1463,6 +1486,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public void allNotesOff() {
if (current_mixer != null)
current_mixer.allNotesOff();
@@ -1475,6 +1499,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public void allSoundOff() {
if (current_mixer != null)
current_mixer.allSoundOff();
@@ -1485,10 +1510,12 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public boolean localControl(boolean on) {
return false;
}
+ @Override
public void setMono(boolean on) {
if (current_mixer != null)
current_mixer.setMono(on);
@@ -1498,12 +1525,14 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public boolean getMono() {
synchronized (control_mutex) {
return mono;
}
}
+ @Override
public void setOmni(boolean on) {
if (current_mixer != null)
current_mixer.setOmni(on);
@@ -1511,10 +1540,12 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
// Omni is not supported by GM2
}
+ @Override
public boolean getOmni() {
return false;
}
+ @Override
public void setMute(boolean mute) {
if (current_mixer != null)
current_mixer.setMute(mute);
@@ -1526,12 +1557,14 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public boolean getMute() {
synchronized (control_mutex) {
return mute;
}
}
+ @Override
public void setSolo(boolean soloState) {
if (current_mixer != null)
current_mixer.setSolo(soloState);
@@ -1571,6 +1604,7 @@ public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
}
}
+ @Override
public boolean getSolo() {
synchronized (control_mutex) {
return solo;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java
index d5d8726fee9..ddadffb9766 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.MidiChannel;
@@ -44,156 +45,182 @@ public final class SoftChannelProxy implements MidiChannel {
this.channel = channel;
}
+ @Override
public void allNotesOff() {
if (channel == null)
return;
channel.allNotesOff();
}
+ @Override
public void allSoundOff() {
if (channel == null)
return;
channel.allSoundOff();
}
+ @Override
public void controlChange(int controller, int value) {
if (channel == null)
return;
channel.controlChange(controller, value);
}
+ @Override
public int getChannelPressure() {
if (channel == null)
return 0;
return channel.getChannelPressure();
}
+ @Override
public int getController(int controller) {
if (channel == null)
return 0;
return channel.getController(controller);
}
+ @Override
public boolean getMono() {
if (channel == null)
return false;
return channel.getMono();
}
+ @Override
public boolean getMute() {
if (channel == null)
return false;
return channel.getMute();
}
+ @Override
public boolean getOmni() {
if (channel == null)
return false;
return channel.getOmni();
}
+ @Override
public int getPitchBend() {
if (channel == null)
return 8192;
return channel.getPitchBend();
}
+ @Override
public int getPolyPressure(int noteNumber) {
if (channel == null)
return 0;
return channel.getPolyPressure(noteNumber);
}
+ @Override
public int getProgram() {
if (channel == null)
return 0;
return channel.getProgram();
}
+ @Override
public boolean getSolo() {
if (channel == null)
return false;
return channel.getSolo();
}
+ @Override
public boolean localControl(boolean on) {
if (channel == null)
return false;
return channel.localControl(on);
}
+ @Override
public void noteOff(int noteNumber) {
if (channel == null)
return;
channel.noteOff(noteNumber);
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
if (channel == null)
return;
channel.noteOff(noteNumber, velocity);
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
if (channel == null)
return;
channel.noteOn(noteNumber, velocity);
}
+ @Override
public void programChange(int program) {
if (channel == null)
return;
channel.programChange(program);
}
+ @Override
public void programChange(int bank, int program) {
if (channel == null)
return;
channel.programChange(bank, program);
}
+ @Override
public void resetAllControllers() {
if (channel == null)
return;
channel.resetAllControllers();
}
+ @Override
public void setChannelPressure(int pressure) {
if (channel == null)
return;
channel.setChannelPressure(pressure);
}
+ @Override
public void setMono(boolean on) {
if (channel == null)
return;
channel.setMono(on);
}
+ @Override
public void setMute(boolean mute) {
if (channel == null)
return;
channel.setMute(mute);
}
+ @Override
public void setOmni(boolean on) {
if (channel == null)
return;
channel.setOmni(on);
}
+ @Override
public void setPitchBend(int bend) {
if (channel == null)
return;
channel.setPitchBend(bend);
}
+ @Override
public void setPolyPressure(int noteNumber, int pressure) {
if (channel == null)
return;
channel.setPolyPressure(noteNumber, pressure);
}
+ @Override
public void setSolo(boolean soloState) {
if (channel == null)
return;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java
index 81b0e8209c7..ff78bea9c65 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Arrays;
@@ -190,6 +191,7 @@ public final class SoftChorus implements SoftAudioProcessor {
private float dirty_vdelay1R_reverbsendgain;
private float controlrate;
+ @Override
public void init(float samplerate, float controlrate) {
this.controlrate = controlrate;
vdelay1L = new LFODelay(samplerate, controlrate);
@@ -202,8 +204,9 @@ public final class SoftChorus implements SoftAudioProcessor {
globalParameterControlChange(new int[]{0x01 * 128 + 0x02}, 0, 2);
}
+ @Override
public void globalParameterControlChange(int[] slothpath, long param,
- long value) {
+ long value) {
if (slothpath.length == 1) {
if (slothpath[0] == 0x01 * 128 + 0x02) {
if (param == 0) { // Chorus Type
@@ -271,6 +274,7 @@ public final class SoftChorus implements SoftAudioProcessor {
}
}
+ @Override
public void processControlLogic() {
if (dirty) {
dirty = false;
@@ -286,6 +290,7 @@ public final class SoftChorus implements SoftAudioProcessor {
}
double silentcounter = 1000;
+ @Override
public void processAudio() {
if (inputA.isSilent()) {
@@ -317,15 +322,18 @@ public final class SoftChorus implements SoftAudioProcessor {
}
}
+ @Override
public void setInput(int pin, SoftAudioBuffer input) {
if (pin == 0)
inputA = input;
}
+ @Override
public void setMixMode(boolean mix) {
this.mix = mix;
}
+ @Override
public void setOutput(int pin, SoftAudioBuffer output) {
if (pin == 0)
left = output;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java
index e36295742c8..7f376c9e790 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -32,5 +33,5 @@ package com.sun.media.sound;
*/
public interface SoftControl {
- public double[] get(int instance, String name);
+ double[] get(int instance, String name);
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java
index 4eeb817fc3d..e7fe033429f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,13 +32,15 @@ package com.sun.media.sound;
*/
public final class SoftCubicResampler extends SoftAbstractResampler {
+ @Override
public int getPadding() {
return 3;
}
+ @Override
public void interpolate(float[] in, float[] in_offset, float in_end,
- float[] startpitch, float pitchstep, float[] out, int[] out_offset,
- int out_end) {
+ float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+ int out_end) {
float pitch = startpitch[0];
float ix = in_offset[0];
int ox = out_offset[0];
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
index cf4d2894431..e2e2df6499a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -61,6 +62,7 @@ public final class SoftEnvelopeGenerator implements SoftProcess {
private final double[][] decay2 = new double[max_count][1];
private double control_time = 0;
+ @Override
public void reset() {
for (int i = 0; i < used_count; i++) {
stage[i] = 0;
@@ -80,11 +82,13 @@ public final class SoftEnvelopeGenerator implements SoftProcess {
used_count = 0;
}
+ @Override
public void init(SoftSynthesizer synth) {
control_time = 1.0 / synth.getControlRate();
processControlLogic();
}
+ @Override
public double[] get(int instance, String name) {
if (instance >= used_count)
used_count = instance + 1;
@@ -118,6 +122,7 @@ public final class SoftEnvelopeGenerator implements SoftProcess {
return null;
}
+ @Override
@SuppressWarnings("fallthrough")
public void processControlLogic() {
for (int i = 0; i < used_count; i++) {
@@ -295,6 +300,5 @@ public final class SoftEnvelopeGenerator implements SoftProcess {
break;
}
}
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java
index 98b4c7af9df..ecfb3654972 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java
index 009867ca09b..b838ce6bcfb 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.Instrument;
@@ -72,6 +73,7 @@ public final class SoftInstrument extends Instrument {
return ins;
}
+ @Override
public Object getData() {
return data;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java
index 61cdf7cdf25..075d2a78ef1 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java
@@ -22,14 +22,16 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+
/**
* A jitter corrector to be used with SoftAudioPusher.
*
@@ -124,6 +126,7 @@ public final class SoftJitterCorrector extends AudioInputStream {
Runnable runnable = new Runnable() {
+ @Override
public void run() {
AudioFormat format = stream.getFormat();
int bufflen = buffers[0].length;
@@ -220,6 +223,7 @@ public final class SoftJitterCorrector extends AudioInputStream {
thread.start();
}
+ @Override
public void close() throws IOException {
synchronized (this) {
active = false;
@@ -232,6 +236,7 @@ public final class SoftJitterCorrector extends AudioInputStream {
stream.close();
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
if (read(b) == -1)
@@ -244,6 +249,7 @@ public final class SoftJitterCorrector extends AudioInputStream {
bbuffer_pos = 0;
}
+ @Override
public int read(byte[] b, int off, int len) {
if (bbuffer == null)
fillBuffer();
@@ -263,6 +269,7 @@ public final class SoftJitterCorrector extends AudioInputStream {
return len;
}
+ @Override
public int available() {
return bbuffer.length - bbuffer_pos;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java
index 1d2d3619698..0d727da242d 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -69,14 +70,16 @@ public final class SoftLanczosResampler extends SoftAbstractResampler {
return w;
}
+ @Override
public int getPadding() // must be at least half of sinc_table_size
{
return sinc_table_size / 2 + 2;
}
+ @Override
public void interpolate(float[] in, float[] in_offset, float in_end,
- float[] startpitch, float pitchstep, float[] out, int[] out_offset,
- int out_end) {
+ float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+ int out_end) {
float pitch = startpitch[0];
float ix = in_offset[0];
int ox = out_offset[0];
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java
index 7c74a18e1c0..cca58814278 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -43,10 +44,12 @@ public final class SoftLimiter implements SoftAudioProcessor {
SoftAudioBuffer bufferRout;
float controlrate;
+ @Override
public void init(float samplerate, float controlrate) {
this.controlrate = controlrate;
}
+ @Override
public void setInput(int pin, SoftAudioBuffer input) {
if (pin == 0)
bufferL = input;
@@ -54,6 +57,7 @@ public final class SoftLimiter implements SoftAudioProcessor {
bufferR = input;
}
+ @Override
public void setOutput(int pin, SoftAudioBuffer output) {
if (pin == 0)
bufferLout = output;
@@ -61,16 +65,19 @@ public final class SoftLimiter implements SoftAudioProcessor {
bufferRout = output;
}
+ @Override
public void setMixMode(boolean mix) {
this.mix = mix;
}
+ @Override
public void globalParameterControlChange(int[] slothpath, long param,
- long value) {
+ long value) {
}
double silentcounter = 0;
+ @Override
public void processAudio() {
if (this.bufferL.isSilent()
&& (this.bufferR == null || this.bufferR.isSilent())) {
@@ -186,6 +193,7 @@ public final class SoftLimiter implements SoftAudioProcessor {
gain = newgain;
}
+ @Override
public void processControlLogic() {
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java
index eb2b98d3772..21aa62adbfe 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,13 +32,15 @@ package com.sun.media.sound;
*/
public final class SoftLinearResampler extends SoftAbstractResampler {
+ @Override
public int getPadding() {
return 2;
}
+ @Override
public void interpolate(float[] in, float[] in_offset, float in_end,
- float[] startpitch, float pitchstep, float[] out, int[] out_offset,
- int out_end) {
+ float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+ int out_end) {
float pitch = startpitch[0];
float ix = in_offset[0];
@@ -65,6 +68,5 @@ public final class SoftLinearResampler extends SoftAbstractResampler {
in_offset[0] = ix;
out_offset[0] = ox;
startpitch[0] = pitch;
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java
index 67f1b6b2c32..9f5f1197c55 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java
@@ -33,13 +33,15 @@ package com.sun.media.sound;
*/
public final class SoftLinearResampler2 extends SoftAbstractResampler {
+ @Override
public int getPadding() {
return 2;
}
+ @Override
public void interpolate(float[] in, float[] in_offset, float in_end,
- float[] startpitch, float pitchstep, float[] out, int[] out_offset,
- int out_end) {
+ float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+ int out_end) {
float pitch = startpitch[0];
float ix = in_offset[0];
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
index a0a8bbe1697..bba31e19999 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -52,6 +53,7 @@ public final class SoftLowFrequencyOscillator implements SoftProcess {
}
}
+ @Override
public void reset() {
for (int i = 0; i < used_count; i++) {
out[i][0] = 0;
@@ -67,6 +69,7 @@ public final class SoftLowFrequencyOscillator implements SoftProcess {
used_count = 0;
}
+ @Override
public void init(SoftSynthesizer synth) {
control_time = 1.0 / synth.getControlRate();
sin_factor = control_time * 2 * Math.PI;
@@ -78,6 +81,7 @@ public final class SoftLowFrequencyOscillator implements SoftProcess {
processControlLogic();
}
+ @Override
public void processControlLogic() {
for (int i = 0; i < used_count; i++) {
if (delay_counter[i] > 0) {
@@ -114,6 +118,7 @@ public final class SoftLowFrequencyOscillator implements SoftProcess {
}
}
+ @Override
public double[] get(int instance, String name) {
if (instance >= used_count)
used_count = instance + 1;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java
index d3f8713180c..9661fa39367 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java
@@ -22,15 +22,16 @@
* 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.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
-import java.util.Map.Entry;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.Patch;
@@ -74,26 +75,26 @@ public final class SoftMainMixer {
private long sample_pos = 0;
boolean readfully = true;
private final Object control_mutex;
- private SoftSynthesizer synth;
+ private final SoftSynthesizer synth;
private float samplerate = 44100;
private int nrofchannels = 2;
private SoftVoice[] voicestatus = null;
- private SoftAudioBuffer[] buffers;
- private SoftReverb reverb;
- private SoftAudioProcessor chorus;
- private SoftAudioProcessor agc;
+ private final SoftAudioBuffer[] buffers;
+ private final SoftReverb reverb;
+ private final SoftAudioProcessor chorus;
+ private final SoftAudioProcessor agc;
private long msec_buffer_len = 0;
private int buffer_len = 0;
- TreeMap midimessages = new TreeMap();
+ TreeMap midimessages = new TreeMap<>();
private int delay_midievent = 0;
private int max_delay_midievent = 0;
double last_volume_left = 1.0;
double last_volume_right = 1.0;
- private double[] co_master_balance = new double[1];
- private double[] co_master_volume = new double[1];
- private double[] co_master_coarse_tuning = new double[1];
- private double[] co_master_fine_tuning = new double[1];
- private AudioInputStream ais;
+ private final double[] co_master_balance = new double[1];
+ private final double[] co_master_volume = new double[1];
+ private final double[] co_master_coarse_tuning = new double[1];
+ private final double[] co_master_fine_tuning = new double[1];
+ private final AudioInputStream ais;
private Set registeredMixers = null;
private Set stoppedMixers = null;
private SoftChannelMixerContainer[] cur_registeredMixers = null;
@@ -104,6 +105,7 @@ public final class SoftMainMixer {
double[] coarse_tuning = co_master_coarse_tuning;
double[] fine_tuning = co_master_fine_tuning;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -777,13 +779,13 @@ public final class SoftMainMixer {
public void stopMixer(ModelChannelMixer mixer) {
if (stoppedMixers == null)
- stoppedMixers = new HashSet();
+ stoppedMixers = new HashSet<>();
stoppedMixers.add(mixer);
}
public void registerMixer(ModelChannelMixer mixer) {
if (registeredMixers == null)
- registeredMixers = new HashSet();
+ registeredMixers = new HashSet<>();
SoftChannelMixerContainer mixercontainer = new SoftChannelMixerContainer();
mixercontainer.buffers = new SoftAudioBuffer[6];
for (int i = 0; i < mixercontainer.buffers.length; i++) {
@@ -883,6 +885,7 @@ public final class SoftMainMixer {
bbuffer_pos = 0;
}
+ @Override
public int read(byte[] b, int off, int len) {
int bbuffer_len = bbuffer.length;
int offlen = off + len;
@@ -903,6 +906,7 @@ public final class SoftMainMixer {
return len;
}
+ @Override
public int read() throws IOException {
int ret = read(single);
if (ret == -1)
@@ -910,10 +914,12 @@ public final class SoftMainMixer {
return single[0] & 0xFF;
}
+ @Override
public int available() {
return bbuffer.length - bbuffer_pos;
}
+ @Override
public void close() {
SoftMainMixer.this.synth.close();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
index b573b16d935..2ac05a3ed57 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java
@@ -63,7 +63,7 @@ public final class SoftMidiAudioFileReader extends SunFileReader {
private AudioInputStream getAudioInputStream(final Sequence seq)
throws InvalidMidiDataException {
- AudioSynthesizer synth = (AudioSynthesizer) new SoftSynthesizer();
+ AudioSynthesizer synth = new SoftSynthesizer();
AudioInputStream stream;
Receiver recv;
try {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java
index 748b0eb3e1a..af3577493fe 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.ByteArrayOutputStream;
@@ -52,6 +53,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
private final InputStream datastream = new InputStream() {
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b);
@@ -60,6 +62,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
return b[0] & 0xFF;
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
if (_loopcount != 0) {
@@ -166,6 +169,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
super(mixer, info);
}
+ @Override
protected void processControlLogic() {
_rightgain = rightgain;
@@ -203,6 +207,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
+ @Override
protected void processAudioLogic(SoftAudioBuffer[] buffers) {
if (_active) {
float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array();
@@ -273,15 +278,18 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
}
+ @Override
public int getFrameLength() {
return bufferSize / format.getFrameSize();
}
+ @Override
public long getMicrosecondLength() {
return (long) (getFrameLength() * (1000000.0 / (double) getFormat()
.getSampleRate()));
}
+ @Override
public void loop(int count) {
LineEvent event = null;
@@ -302,8 +310,9 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
+ @Override
public void open(AudioInputStream stream) throws LineUnavailableException,
- IOException {
+ IOException {
if (isOpen()) {
throw new IllegalStateException("Clip is already open with format "
+ getFormat() + " and frame lengh of " + getFrameLength());
@@ -342,6 +351,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
+ @Override
public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
throws LineUnavailableException {
synchronized (control_mutex) {
@@ -385,6 +395,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
+ @Override
public void setFramePosition(int frames) {
synchronized (control_mutex) {
frameposition_sg = true;
@@ -392,6 +403,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
}
+ @Override
public void setLoopPoints(int start, int end) {
synchronized (control_mutex) {
if (end != -1) {
@@ -414,60 +426,73 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
}
+ @Override
public void setMicrosecondPosition(long microseconds) {
setFramePosition((int) (microseconds * (((double) getFormat()
.getSampleRate()) / 1000000.0)));
}
+ @Override
public int available() {
return 0;
}
+ @Override
public void drain() {
}
+ @Override
public void flush() {
}
+ @Override
public int getBufferSize() {
return bufferSize;
}
+ @Override
public AudioFormat getFormat() {
return format;
}
+ @Override
public int getFramePosition() {
synchronized (control_mutex) {
return frameposition;
}
}
+ @Override
public float getLevel() {
return AudioSystem.NOT_SPECIFIED;
}
+ @Override
public long getLongFramePosition() {
return getFramePosition();
}
+ @Override
public long getMicrosecondPosition() {
return (long) (getFramePosition() * (1000000.0 / (double) getFormat()
.getSampleRate()));
}
+ @Override
public boolean isActive() {
synchronized (control_mutex) {
return active;
}
}
+ @Override
public boolean isRunning() {
synchronized (control_mutex) {
return active;
}
}
+ @Override
public void start() {
LineEvent event = null;
@@ -488,6 +513,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
sendEvent(event);
}
+ @Override
public void stop() {
LineEvent event = null;
@@ -506,6 +532,7 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
sendEvent(event);
}
+ @Override
public void close() {
LineEvent event = null;
@@ -526,10 +553,12 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
}
+ @Override
public boolean isOpen() {
return open;
}
+ @Override
public void open() throws LineUnavailableException {
if (data == null) {
throw new IllegalArgumentException(
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java
index b7793062764..99962841c8f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -33,11 +34,11 @@ 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.
@@ -130,22 +131,27 @@ public abstract class SoftMixingDataLine implements DataLine {
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;
@@ -162,6 +168,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
+ @Override
public boolean markSupported() {
return ais.markSupported();
}
@@ -206,6 +213,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
@@ -255,6 +263,7 @@ public abstract class SoftMixingDataLine implements DataLine {
return len - remain * nrofchannels;
}
+ @Override
public void reset() throws IOException {
ais.reset();
if (mark_ibuffer == null)
@@ -271,6 +280,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
+ @Override
public long skip(long len) throws IOException {
if (len > 0)
return 0;
@@ -302,6 +312,7 @@ public abstract class SoftMixingDataLine implements DataLine {
-1, 0.0f, "dB", "Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
calcVolume();
@@ -314,6 +325,7 @@ public abstract class SoftMixingDataLine implements DataLine {
super(BooleanControl.Type.MUTE, false, "True", "False");
}
+ @Override
public void setValue(boolean newValue) {
super.setValue(newValue);
calcVolume();
@@ -326,6 +338,7 @@ public abstract class SoftMixingDataLine implements DataLine {
super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
}
+ @Override
public void setValue(boolean newValue) {
super.setValue(newValue);
calcVolume();
@@ -340,6 +353,7 @@ public abstract class SoftMixingDataLine implements DataLine {
0.0f, "", "Left", "Center", "Right");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
calcVolume();
@@ -354,11 +368,13 @@ public abstract class SoftMixingDataLine implements DataLine {
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();
}
@@ -372,6 +388,7 @@ public abstract class SoftMixingDataLine implements DataLine {
-1, -80f, "dB", "Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
balance_control.setValue(newValue);
@@ -386,6 +403,7 @@ public abstract class SoftMixingDataLine implements DataLine {
"Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
balance_control.setValue(newValue);
@@ -417,7 +435,7 @@ public abstract class SoftMixingDataLine implements DataLine {
float eff2gain = 0;
- List listeners = new ArrayList();
+ List listeners = new ArrayList<>();
final Object control_mutex;
@@ -476,22 +494,26 @@ public abstract class SoftMixingDataLine implements DataLine {
}
}
+ @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++) {
@@ -504,10 +526,12 @@ public abstract class SoftMixingDataLine implements DataLine {
+ 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++) {
@@ -518,5 +542,4 @@ public abstract class SoftMixingDataLine implements DataLine {
}
return false;
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
index c07bc59befa..6e91cf2995d 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -79,7 +80,7 @@ public final class SoftMixingMainMixer {
private final Object control_mutex;
- private final List openLinesList = new ArrayList();
+ private final List openLinesList = new ArrayList<>();
private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
@@ -184,6 +185,7 @@ public final class SoftMixingMainMixer {
bbuffer_pos = 0;
}
+ @Override
public int read(byte[] b, int off, int len) {
int bbuffer_len = bbuffer.length;
int offlen = off + len;
@@ -200,6 +202,7 @@ public final class SoftMixingMainMixer {
return len;
}
+ @Override
public int read() throws IOException {
int ret = read(single);
if (ret == -1)
@@ -207,10 +210,12 @@ public final class SoftMixingMainMixer {
return single[0] & 0xFF;
}
+ @Override
public int available() {
return bbuffer.length - bbuffer_pos;
}
+ @Override
public void close() {
SoftMixingMainMixer.this.mixer.close();
}
@@ -239,14 +244,12 @@ public final class SoftMixingMainMixer {
if (mixer.implicitOpen)
mixer.close();
}
-
}
public SoftMixingDataLine[] getOpenLines() {
synchronized (control_mutex) {
return openLines;
}
-
}
public void close() {
@@ -255,5 +258,4 @@ public final class SoftMixingMainMixer {
openLines[i].close();
}
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java
index 9df5641ab13..a0d824e18f6 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -29,10 +30,12 @@ import java.util.ArrayList;
import java.util.List;
import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.Control;
+import javax.sound.sampled.Control.Type;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineEvent;
@@ -40,11 +43,9 @@ import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
-import javax.sound.sampled.AudioFormat.Encoding;
-import javax.sound.sampled.Control.Type;
/**
- * Software audio mixer
+ * Software audio mixer.
*
* @author Karl Helgason
*/
@@ -88,7 +89,7 @@ public final class SoftMixingMixer implements Mixer {
private final boolean jitter_correction = false;
- private final List listeners = new ArrayList();
+ private final List listeners = new ArrayList<>();
private final javax.sound.sampled.Line.Info[] sourceLineInfo;
@@ -96,7 +97,7 @@ public final class SoftMixingMixer implements Mixer {
sourceLineInfo = new javax.sound.sampled.Line.Info[2];
- ArrayList formats = new ArrayList();
+ ArrayList formats = new ArrayList<>();
for (int channels = 1; channels <= 2; channels++) {
formats.add(new AudioFormat(Encoding.PCM_SIGNED,
AudioSystem.NOT_SPECIFIED, 8, channels, channels,
@@ -140,6 +141,7 @@ public final class SoftMixingMixer implements Mixer {
AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED);
}
+ @Override
public Line getLine(Line.Info info) throws LineUnavailableException {
if (!isLineSupported(info))
@@ -155,6 +157,7 @@ public final class SoftMixingMixer implements Mixer {
throw new IllegalArgumentException("Line unsupported: " + info);
}
+ @Override
public int getMaxLines(Line.Info info) {
if (info.getLineClass() == SourceDataLine.class)
return AudioSystem.NOT_SPECIFIED;
@@ -163,10 +166,12 @@ public final class SoftMixingMixer implements Mixer {
return 0;
}
+ @Override
public javax.sound.sampled.Mixer.Info getMixerInfo() {
return info;
}
+ @Override
public javax.sound.sampled.Line.Info[] getSourceLineInfo() {
Line.Info[] localArray = new Line.Info[sourceLineInfo.length];
System.arraycopy(sourceLineInfo, 0, localArray, 0,
@@ -174,10 +179,11 @@ public final class SoftMixingMixer implements Mixer {
return localArray;
}
+ @Override
public javax.sound.sampled.Line.Info[] getSourceLineInfo(
javax.sound.sampled.Line.Info info) {
int i;
- ArrayList infos = new ArrayList();
+ ArrayList infos = new ArrayList<>();
for (i = 0; i < sourceLineInfo.length; i++) {
if (info.matches(sourceLineInfo[i])) {
@@ -187,6 +193,7 @@ public final class SoftMixingMixer implements Mixer {
return infos.toArray(new Line.Info[infos.size()]);
}
+ @Override
public Line[] getSourceLines() {
Line[] localLines;
@@ -207,19 +214,23 @@ public final class SoftMixingMixer implements Mixer {
return localLines;
}
+ @Override
public javax.sound.sampled.Line.Info[] getTargetLineInfo() {
return new javax.sound.sampled.Line.Info[0];
}
+ @Override
public javax.sound.sampled.Line.Info[] getTargetLineInfo(
javax.sound.sampled.Line.Info info) {
return new javax.sound.sampled.Line.Info[0];
}
+ @Override
public Line[] getTargetLines() {
return new Line[0];
}
+ @Override
public boolean isLineSupported(javax.sound.sampled.Line.Info info) {
if (info != null) {
for (int i = 0; i < sourceLineInfo.length; i++) {
@@ -231,20 +242,24 @@ public final class SoftMixingMixer implements Mixer {
return false;
}
+ @Override
public boolean isSynchronizationSupported(Line[] lines, boolean maintainSync) {
return false;
}
+ @Override
public void synchronize(Line[] lines, boolean maintainSync) {
throw new IllegalArgumentException(
"Synchronization not supported by this mixer.");
}
+ @Override
public void unsynchronize(Line[] lines) {
throw new IllegalArgumentException(
"Synchronization not supported by this mixer.");
}
+ @Override
public void addLineListener(LineListener listener) {
synchronized (control_mutex) {
listeners.add(listener);
@@ -261,6 +276,7 @@ public final class SoftMixingMixer implements Mixer {
}
}
+ @Override
public void close() {
if (!isOpen())
return;
@@ -308,29 +324,35 @@ public final class SoftMixingMixer implements Mixer {
}
+ @Override
public Control getControl(Type control) {
throw new IllegalArgumentException("Unsupported control type : "
+ control);
}
+ @Override
public Control[] getControls() {
return new Control[0];
}
+ @Override
public javax.sound.sampled.Line.Info getLineInfo() {
return new Line.Info(Mixer.class);
}
+ @Override
public boolean isControlSupported(Type control) {
return false;
}
+ @Override
public boolean isOpen() {
synchronized (control_mutex) {
return open;
}
}
+ @Override
public void open() throws LineUnavailableException {
if (isOpen()) {
implicitOpen = false;
@@ -498,6 +520,7 @@ public final class SoftMixingMixer implements Mixer {
}
+ @Override
public void removeLineListener(LineListener listener) {
synchronized (control_mutex) {
listeners.remove(listener);
@@ -525,5 +548,4 @@ public final class SoftMixingMixer implements Mixer {
return null;
return mainmixer;
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
index 7b842f50495..d589bd8d470 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.sampled.Mixer;
@@ -29,7 +30,7 @@ import javax.sound.sampled.Mixer.Info;
import javax.sound.sampled.spi.MixerProvider;
/**
- * Provider for software audio mixer
+ * Provider for software audio mixer.
*
* @author Karl Helgason
*/
@@ -41,6 +42,7 @@ public final class SoftMixingMixerProvider extends MixerProvider {
static final Object mutex = new Object();
+ @Override
public Mixer getMixer(Info info) {
if (!(info == null || info == SoftMixingMixer.info)) {
throw new IllegalArgumentException("Mixer " + info.toString()
@@ -56,11 +58,10 @@ public final class SoftMixingMixerProvider extends MixerProvider {
globalmixer = new SoftMixingMixer();
return globalmixer;
}
-
}
+ @Override
public Info[] getMixerInfo() {
return new Info[] { SoftMixingMixer.info };
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
index 962b4d2537b..1f1beb6411c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -76,30 +77,37 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
this.ais = ais;
}
+ @Override
public int available() throws IOException {
return ais.available();
}
+ @Override
public void close() throws IOException {
ais.close();
}
+ @Override
public AudioFormat getFormat() {
return ais.getFormat();
}
+ @Override
public long getFrameLength() {
return ais.getFrameLength();
}
+ @Override
public void mark(int readlimit) {
ais.mark(readlimit);
}
+ @Override
public boolean markSupported() {
return ais.markSupported();
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
int avail = available();
if (len > avail) {
@@ -110,10 +118,12 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
return ais.read(b, off, len);
}
+ @Override
public void reset() throws IOException {
ais.reset();
}
+ @Override
public long skip(long len) throws IOException {
return ais.skip(len);
}
@@ -124,6 +134,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
super(mixer, info);
}
+ @Override
public int write(byte[] b, int off, int len) {
if (!isOpen())
return 0;
@@ -202,6 +213,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
private float _eff2gain;
+ @Override
protected void processControlLogic() {
_active = active;
_rightgain = rightgain;
@@ -210,6 +222,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
_eff2gain = eff2gain;
}
+ @Override
protected void processAudioLogic(SoftAudioBuffer[] buffers) {
if (_active) {
float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array();
@@ -274,10 +287,12 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
}
}
+ @Override
public void open() throws LineUnavailableException {
open(format);
}
+ @Override
public void open(AudioFormat format) throws LineUnavailableException {
if (bufferSize == -1)
bufferSize = ((int) (format.getFrameRate() / 2))
@@ -285,6 +300,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
open(format, bufferSize);
}
+ @Override
public void open(AudioFormat format, int bufferSize)
throws LineUnavailableException {
@@ -323,6 +339,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
InputStream cycling_inputstream = new InputStream() {
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b);
@@ -331,12 +348,14 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
return b[0] & 0xFF;
}
+ @Override
public int available() throws IOException {
synchronized (cycling_buffer) {
return cycling_avail;
}
}
+ @Override
public int read(byte[] b, int off, int len)
throws IOException {
@@ -387,12 +406,14 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
}
+ @Override
public int available() {
synchronized (cycling_buffer) {
return cycling_buffer.length - cycling_avail;
}
}
+ @Override
public void drain() {
while (true) {
int avail;
@@ -409,6 +430,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
}
}
+ @Override
public void flush() {
synchronized (cycling_buffer) {
cycling_read_pos = 0;
@@ -417,49 +439,58 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
}
}
+ @Override
public int getBufferSize() {
synchronized (control_mutex) {
return bufferSize;
}
}
+ @Override
public AudioFormat getFormat() {
synchronized (control_mutex) {
return format;
}
}
+ @Override
public int getFramePosition() {
return (int) getLongFramePosition();
}
+ @Override
public float getLevel() {
return AudioSystem.NOT_SPECIFIED;
}
+ @Override
public long getLongFramePosition() {
synchronized (cycling_buffer) {
return cycling_framepos;
}
}
+ @Override
public long getMicrosecondPosition() {
return (long) (getLongFramePosition() * (1000000.0 / (double) getFormat()
.getSampleRate()));
}
+ @Override
public boolean isActive() {
synchronized (control_mutex) {
return active;
}
}
+ @Override
public boolean isRunning() {
synchronized (control_mutex) {
return active;
}
}
+ @Override
public void start() {
LineEvent event = null;
@@ -478,6 +509,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
sendEvent(event);
}
+ @Override
public void stop() {
LineEvent event = null;
@@ -495,6 +527,7 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
sendEvent(event);
}
+ @Override
public void close() {
LineEvent event = null;
@@ -516,10 +549,10 @@ public final class SoftMixingSourceDataLine extends SoftMixingDataLine
}
+ @Override
public boolean isOpen() {
synchronized (control_mutex) {
return open;
}
}
-
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java
index 5cd7c6eb92e..f9ab961e540 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.ArrayList;
@@ -92,6 +93,7 @@ public final class SoftPerformer {
ModelStandardTransform.TRANSFORM_LINEAR),
new ModelSource(new ModelIdentifier("midi_rpn", "0"),
new ModelTransform() {
+ @Override
public double transform(double value) {
int v = (int) (value * 16384.0);
int msb = v >> 7;
@@ -309,21 +311,22 @@ public final class SoftPerformer {
public ModelPerformer performer;
public ModelConnectionBlock[] connections;
public ModelOscillator[] oscillators;
- public Map midi_rpn_connections = new HashMap();
- public Map midi_nrpn_connections = new HashMap();
+ public Map midi_rpn_connections = new HashMap<>();
+ public Map midi_nrpn_connections = new HashMap<>();
public int[][] midi_ctrl_connections;
public int[][] midi_connections;
public int[] ctrl_connections;
- private List ctrl_connections_list = new ArrayList();
+ private final List ctrl_connections_list = new ArrayList<>();
private static class KeySortComparator implements Comparator {
+ @Override
public int compare(ModelSource o1, ModelSource o2) {
return o1.getIdentifier().toString().compareTo(
o2.getIdentifier().toString());
}
}
- private static KeySortComparator keySortComparator = new KeySortComparator();
+ private static final KeySortComparator keySortComparator = new KeySortComparator();
private String extractKeys(ModelConnectionBlock conn) {
StringBuilder sb = new StringBuilder();
@@ -474,9 +477,9 @@ public final class SoftPerformer {
exclusiveClass = performer.getExclusiveClass();
selfNonExclusive = performer.isSelfNonExclusive();
- Map connmap = new HashMap();
+ Map connmap = new HashMap<>();
- List performer_connections = new ArrayList();
+ List performer_connections = new ArrayList<>();
performer_connections.addAll(performer.getConnectionBlocks());
if (performer.isDefaultConnectionsEnabled()) {
@@ -649,6 +652,7 @@ public final class SoftPerformer {
new ModelSource(new ModelIdentifier("midi_cc", "77"),
new ModelTransform() {
double s = scale;
+ @Override
public double transform(double value) {
value = value * 2 - 1;
value *= 600;
@@ -687,7 +691,7 @@ public final class SoftPerformer {
connmap.put(extractKeys(connection), connection);
// seperate connection blocks : Init time, Midi Time, Midi/Control Time,
// Control Time
- List connections = new ArrayList();
+ List connections = new ArrayList<>();
midi_ctrl_connections = new int[128][];
for (int i = 0; i < midi_ctrl_connections.length; i++) {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java
index 4256eaba255..07b5e4f92e0 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,13 +32,15 @@ package com.sun.media.sound;
*/
public final class SoftPointResampler extends SoftAbstractResampler {
+ @Override
public int getPadding() {
return 100;
}
+ @Override
public void interpolate(float[] in, float[] in_offset, float in_end,
- float[] startpitch, float pitchstep, float[] out, int[] out_offset,
- int out_end) {
+ float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+ int out_end) {
float pitch = startpitch[0];
float ix = in_offset[0];
int ox = out_offset[0];
@@ -58,6 +61,5 @@ public final class SoftPointResampler extends SoftAbstractResampler {
in_offset[0] = ix;
out_offset[0] = ox;
startpitch[0] = pitch;
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java
index 1734af1e2c7..77fb6f6a56d 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java
@@ -22,20 +22,22 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
- * Control signal processor interface
+ * Control signal processor interface.
*
* @author Karl Helgason
*/
public interface SoftProcess extends SoftControl {
- public void init(SoftSynthesizer synth);
+ void init(SoftSynthesizer synth);
- public double[] get(int instance, String name);
+ @Override
+ double[] get(int instance, String name);
- public void processControlLogic();
+ void processControlLogic();
- public void reset();
+ void reset();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java
index 9a0d9c0e84a..5cf4dcaa496 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.TreeMap;
@@ -52,10 +53,12 @@ public final class SoftReceiver implements MidiDeviceReceiver {
this.midimessages = mainmixer.midimessages;
}
+ @Override
public MidiDevice getMidiDevice() {
return synth;
}
+ @Override
public void send(MidiMessage message, long timeStamp) {
synchronized (control_mutex) {
@@ -80,6 +83,7 @@ public final class SoftReceiver implements MidiDeviceReceiver {
}
}
+ @Override
public void close() {
synchronized (control_mutex) {
open = false;
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java
index 3aabefdca2d..9f56f580a7f 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -31,5 +32,5 @@ package com.sun.media.sound;
*/
public interface SoftResampler {
- public SoftResamplerStreamer openStreamer();
+ SoftResamplerStreamer openStreamer();
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java
index 28045ca07b4..b11c7294ca3 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.io.IOException;
@@ -33,6 +34,5 @@ import java.io.IOException;
*/
public interface SoftResamplerStreamer extends ModelOscillatorStream {
- public void open(ModelWavetable osc, float outputsamplerate)
- throws IOException;
+ void open(ModelWavetable osc, float outputsamplerate) throws IOException;
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java
index 3876758ad96..8a1ce4ceaf9 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import java.util.Arrays;
@@ -210,6 +211,7 @@ public final class SoftReverb implements SoftAudioProcessor {
private float samplerate;
private boolean light = true;
+ @Override
public void init(float samplerate, float controlrate) {
this.samplerate = samplerate;
@@ -260,11 +262,13 @@ public final class SoftReverb implements SoftAudioProcessor {
}
+ @Override
public void setInput(int pin, SoftAudioBuffer input) {
if (pin == 0)
inputA = input;
}
+ @Override
public void setOutput(int pin, SoftAudioBuffer output) {
if (pin == 0)
left = output;
@@ -272,12 +276,14 @@ public final class SoftReverb implements SoftAudioProcessor {
right = output;
}
+ @Override
public void setMixMode(boolean mix) {
this.mix = mix;
}
private boolean silent = true;
+ @Override
public void processAudio() {
boolean silent_input = this.inputA.isSilent();
if(!silent_input)
@@ -330,7 +336,7 @@ public final class SoftReverb implements SoftAudioProcessor {
for (int i = 4; i < combL.length-2; i+=2)
combL[i].processMix(input, pre1);
- combL[3].processReplace(input, pre2);;
+ combL[3].processReplace(input, pre2);
for (int i = 5; i < combL.length-2; i+=2)
combL[i].processMix(input, pre2);
@@ -376,11 +382,6 @@ public final class SoftReverb implements SoftAudioProcessor {
combL[i].processMix(out, left);
}
-
-
-
-
-
if (silent_input) {
silent = true;
for (int i = 0; i < numsamples; i++)
@@ -396,8 +397,9 @@ public final class SoftReverb implements SoftAudioProcessor {
}
+ @Override
public void globalParameterControlChange(int[] slothpath, long param,
- long value) {
+ long value) {
if (slothpath.length == 1) {
if (slothpath[0] == 0x01 * 128 + 0x01) {
@@ -463,6 +465,7 @@ public final class SoftReverb implements SoftAudioProcessor {
}
}
+ @Override
public void processControlLogic() {
if (dirty) {
dirty = false;
@@ -504,7 +507,6 @@ public final class SoftReverb implements SoftAudioProcessor {
combL[i].setDamp(damp);
combR[i].setDamp(damp);
}
-
}
public void setLightMode(boolean light)
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java
index f2122601c69..1a1fa9e3467 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
import javax.sound.midi.InvalidMidiDataException;
@@ -36,16 +37,19 @@ public final class SoftShortMessage extends ShortMessage {
int channel = 0;
+ @Override
public int getChannel() {
return channel;
}
+ @Override
public void setMessage(int command, int channel, int data1, int data2)
throws InvalidMidiDataException {
this.channel = channel;
super.setMessage(command, channel & 0xF, data1, data2);
}
+ @Override
public Object clone() {
SoftShortMessage clone = new SoftShortMessage();
try {
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java
index 051e44120e8..8cc75634c1b 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
@@ -76,14 +77,16 @@ public final class SoftSincResampler extends SoftAbstractResampler {
return w;
}
+ @Override
public int getPadding() // must be at least half of sinc_table_size
{
return sinc_table_size / 2 + 2;
}
+ @Override
public void interpolate(float[] in, float[] in_offset, float in_end,
- float[] startpitch, float pitchstep, float[] out, int[] out_offset,
- int out_end) {
+ float[] startpitch, float pitchstep, float[] out, int[] out_offset,
+ int out_end) {
float pitch = startpitch[0];
float ix = in_offset[0];
int ox = out_offset[0];
@@ -134,6 +137,5 @@ public final class SoftSincResampler extends SoftAbstractResampler {
in_offset[0] = ix;
out_offset[0] = ox;
startpitch[0] = pitch;
-
}
}
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
index 41b0cffa3df..75c0c57467c 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
@@ -78,16 +78,17 @@ public final class SoftSynthesizer implements AudioSynthesizer,
public SourceDataLine sourceDataLine = null;
public volatile long silent_samples = 0;
private int framesize = 0;
- private WeakReference weak_stream_link;
- private AudioFloatConverter converter;
+ private final WeakReference weak_stream_link;
+ private final AudioFloatConverter converter;
private float[] silentbuffer = null;
- private int samplesize;
+ private final int samplesize;
public void setInputStream(AudioInputStream stream)
{
this.stream = stream;
}
+ @Override
public int available() throws IOException {
AudioInputStream local_stream = stream;
if(local_stream != null)
@@ -95,6 +96,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return 0;
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
if (read(b) == -1)
@@ -102,6 +104,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return b[0] & 0xFF;
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
AudioInputStream local_stream = stream;
if(local_stream != null)
@@ -123,6 +126,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
SoftAudioPusher _pusher = pusher;
AudioInputStream _jitter_stream = jitter_stream;
SourceDataLine _sourceDataLine = sourceDataLine;
+ @Override
public void run()
{
_pusher.stop();
@@ -147,7 +151,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
public WeakAudioStream(AudioInputStream stream) {
this.stream = stream;
- weak_stream_link = new WeakReference(stream);
+ weak_stream_link = new WeakReference<>(stream);
converter = AudioFloatConverter.getConverter(stream.getFormat());
samplesize = stream.getFormat().getFrameSize() / stream.getFormat().getChannels();
framesize = stream.getFormat().getFrameSize();
@@ -158,6 +162,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return new AudioInputStream(this, stream.getFormat(), AudioSystem.NOT_SPECIFIED);
}
+ @Override
public void close() throws IOException
{
AudioInputStream astream = weak_stream_link.get();
@@ -233,14 +238,10 @@ public final class SoftSynthesizer implements AudioSynthesizer,
private SoftMainMixer mainmixer;
private SoftVoice[] voices;
- private Map tunings
- = new HashMap();
- private Map inslist
- = new HashMap();
- private Map loadedlist
- = new HashMap();
-
- private ArrayList recvslist = new ArrayList();
+ private final Map tunings = new HashMap<>();
+ private final Map inslist = new HashMap<>();
+ private final Map loadedlist = new HashMap<>();
+ private final ArrayList recvslist = new ArrayList<>();
private void getBuffers(ModelInstrument instrument,
List buffers) {
@@ -264,7 +265,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
private boolean loadSamples(List instruments) {
if (largemode)
return true;
- List buffers = new ArrayList();
+ List buffers = new ArrayList<>();
for (ModelInstrument instrument : instruments)
getBuffers(instrument, buffers);
try {
@@ -485,24 +486,28 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return tuning;
}
+ @Override
public long getLatency() {
synchronized (control_mutex) {
return latency;
}
}
+ @Override
public AudioFormat getFormat() {
synchronized (control_mutex) {
return format;
}
}
+ @Override
public int getMaxPolyphony() {
synchronized (control_mutex) {
return maxpoly;
}
}
+ @Override
public MidiChannel[] getChannels() {
synchronized (control_mutex) {
@@ -525,6 +530,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
}
}
+ @Override
public VoiceStatus[] getVoiceStatus() {
if (!isOpen()) {
VoiceStatus[] tempVoiceStatusArray
@@ -559,6 +565,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
}
}
+ @Override
public boolean isSoundbankSupported(Soundbank soundbank) {
for (Instrument ins: soundbank.getInstruments())
if (!(ins instanceof ModelInstrument))
@@ -566,16 +573,18 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return true;
}
+ @Override
public boolean loadInstrument(Instrument instrument) {
if (instrument == null || (!(instrument instanceof ModelInstrument))) {
throw new IllegalArgumentException("Unsupported instrument: " +
instrument);
}
- List instruments = new ArrayList();
+ List instruments = new ArrayList<>();
instruments.add((ModelInstrument)instrument);
return loadInstruments(instruments);
}
+ @Override
public void unloadInstrument(Instrument instrument) {
if (instrument == null || (!(instrument instanceof ModelInstrument))) {
throw new IllegalArgumentException("Unsupported instrument: " +
@@ -596,6 +605,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
}
}
+ @Override
public boolean remapInstrument(Instrument from, Instrument to) {
if (from == null)
@@ -623,15 +633,16 @@ public final class SoftSynthesizer implements AudioSynthesizer,
}
}
+ @Override
public Soundbank getDefaultSoundbank() {
synchronized (SoftSynthesizer.class) {
if (defaultSoundBank != null)
return defaultSoundBank;
- List> actions =
- new ArrayList>();
+ List> actions = new ArrayList<>();
actions.add(new PrivilegedAction() {
+ @Override
public InputStream run() {
File javahome = new File(System.getProperties()
.getProperty("java.home"));
@@ -667,6 +678,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
});
actions.add(new PrivilegedAction() {
+ @Override
public InputStream run() {
if (System.getProperties().getProperty("os.name")
.startsWith("Linux")) {
@@ -701,6 +713,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
});
actions.add(new PrivilegedAction() {
+ @Override
public InputStream run() {
if (System.getProperties().getProperty("os.name")
.startsWith("Windows")) {
@@ -718,6 +731,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
});
actions.add(new PrivilegedAction() {
+ @Override
public InputStream run() {
/*
* Try to load saved generated soundbank
@@ -798,6 +812,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return defaultSoundBank;
}
+ @Override
public Instrument[] getAvailableInstruments() {
Soundbank defsbk = getDefaultSoundbank();
if (defsbk == null)
@@ -807,6 +822,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return inslist_array;
}
+ @Override
public Instrument[] getLoadedInstruments() {
if (!isOpen())
return new Instrument[0];
@@ -820,8 +836,9 @@ public final class SoftSynthesizer implements AudioSynthesizer,
}
}
+ @Override
public boolean loadAllInstruments(Soundbank soundbank) {
- List instruments = new ArrayList();
+ List