--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractDataLine.java Mon Aug 15 20:08:55 2016 +0300
@@ -32,7 +32,6 @@
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineUnavailableException;
-
/**
* AbstractDataLine
*
@@ -147,36 +146,35 @@
}
}
-
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 @@
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 @@
// 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 @@
return microseconds;
}
-
+ @Override
public final AudioFormat getFormat() {
return format;
}
-
+ @Override
public final int getBufferSize() {
return bufferSize;
}
@@ -283,11 +283,11 @@
/**
* This implementation returns AudioSystem.NOT_SPECIFIED.
*/
+ @Override
public final float getLevel() {
return (float)AudioSystem.NOT_SPECIFIED;
}
-
// HELPER METHODS
/**
@@ -317,19 +317,12 @@
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 @@
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 @@
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 @@
if (Printer.trace) Printer.trace("< AbstractDataLine: setEOM() completed");
}
-
-
-
// OVERRIDES OF ABSTRACT LINE METHODS
/**
@@ -404,6 +387,7 @@
* 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 @@
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 @@
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();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractLine.java Mon Aug 15 20:08:55 2016 +0300
@@ -36,7 +36,6 @@
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
-
/**
* AbstractLine
*
@@ -72,19 +71,19 @@
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 @@
}
}
-
/**
* 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 @@
return returnedArray;
}
-
+ @Override
public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
@@ -135,7 +134,7 @@
return false;
}
-
+ @Override
public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
@@ -150,10 +149,8 @@
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 @@
if (Printer.trace) Printer.trace("< "+getClass().getName()+" (AbstractLine): setOpen(" + open + ") this.open: " + this.open);
}
-
/**
* Send line events.
*/
@@ -190,7 +186,6 @@
getEventDispatcher().sendAudioEvents(event, listeners);
}
-
/**
* This is an error in the API: getFramePosition
* should return a long value. At CD quality,
@@ -200,7 +195,6 @@
return (int) getLongFramePosition();
}
-
/**
* Return the frame position in a long value
* This implementation returns AudioSystem.NOT_SPECIFIED.
@@ -209,7 +203,6 @@
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 METHODS
-
+ @Override
public abstract void open() throws LineUnavailableException;
+ @Override
public abstract void close();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java Mon Aug 15 20:08:55 2016 +0300
@@ -26,10 +26,17 @@
package com.sun.media.sound;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import java.util.Collections;
-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 @@
*/
abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice {
- // STATIC VARIABLES
private static final boolean TRACE_TRANSMITTER = false;
- // INSTANCE VARIABLES
-
private ArrayList<Receiver> receiverList;
private TransmitterList transmitterList;
@@ -62,7 +66,6 @@
private final MidiDevice.Info info;
-
// DEVICE STATE
private volatile boolean open;
@@ -73,15 +76,10 @@
private List<Object> 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 @@
if(Printer.trace) Printer.trace("<< AbstractMidiDevice CONSTRUCTOR completed");
}
-
// MIDI DEVICE METHODS
+ @Override
public final MidiDevice.Info getDeviceInfo() {
return info;
}
@@ -111,6 +109,7 @@
* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
}
-
/**
* 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 @@
}
}
-
/** 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 @@
}
}
-
/** 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 @@
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 @@
return receiver;
}
-
+ @Override
@SuppressWarnings("unchecked") // Cast of result of clone
public final List<Receiver> getReceivers() {
List<Receiver> recs;
@@ -298,12 +291,12 @@
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 @@
return transmitter;
}
-
+ @Override
@SuppressWarnings("unchecked") // Cast of result of clone
public final List<Transmitter> getTransmitters() {
List<Transmitter> tras;
@@ -328,19 +321,16 @@
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 @@
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 @@
return transmitter;
}
-
/** Return the list of objects that have opened the device implicitely.
*/
private synchronized List<Object> getOpenKeepingObjects() {
@@ -381,23 +370,19 @@
return openKeepingObjects;
}
-
-
// RECEIVER HANDLING METHODS
-
/** Return the internal list of Receivers, possibly creating it first.
*/
private List<Receiver> getReceiverList() {
synchronized (traRecLock) {
if (receiverList == null) {
- receiverList = new ArrayList<Receiver>();
+ 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 @@
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 @@
throw new MidiUnavailableException("MIDI IN receiver not available");
}
-
-
// TRANSMITTER HANDLING
/** Return the internal list of Transmitters, possibly creating it first.
@@ -435,7 +417,6 @@
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 @@
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 @@
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 @@
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 @@
}
}
+ @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 @@
}
}
+ @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<Transmitter> transmitters = new ArrayList<Transmitter>();
+ private final ArrayList<Transmitter> transmitters = new ArrayList<>();
private MidiOutDevice.MidiOutReceiver midiOutReceiver;
// how many transmitters must be present for optimized
@@ -712,9 +690,8 @@
}
}
-
/**
- * 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 @@
}
}
}
-
-
} // TransmitterList
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java Mon Aug 15 20:08:55 2016 +0300
@@ -52,7 +52,6 @@
// 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 @@
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 @@
} // class Info
-
- // ABSTRACT METHODS
-
abstract int getNumDevices();
abstract MidiDevice[] getDeviceCache();
abstract void setDeviceCache(MidiDevice[] devices);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -28,9 +28,9 @@
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 @@
*/
private boolean manuallyOpened = false;
+ // STATE VARIABLES
/**
- * Supported formats for the mixer.
- */
- //$$fb DELETE
- //protected Vector formats = new Vector();
-
-
- // STATE VARIABLES
-
-
- /**
- * Source lines (ports) currently open
+ * Source lines (ports) currently open.
*/
private final Vector<Line> sourceLines = new Vector<>();
-
/**
* Target lines currently open.
*/
private final Vector<Line> targetLines = new Vector<>();
-
/**
* Constructs a new AbstractMixer.
* @param mixer the mixer with which this line is associated
@@ -124,30 +113,28 @@
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 @@
return returnedArray;
}
-
+ @Override
public final Line.Info[] getTargetLineInfo(Line.Info info) {
int i;
@@ -189,7 +176,7 @@
return returnedArray;
}
-
+ @Override
public final boolean isLineSupported(Line.Info info) {
int i;
@@ -211,9 +198,10 @@
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 @@
protected abstract void implStop();
protected abstract void implClose();
-
+ @Override
public final Line[] getSourceLines() {
Line[] localLines;
@@ -238,7 +226,7 @@
return localLines;
}
-
+ @Override
public final Line[] getTargetLines() {
Line[] localLines;
@@ -255,37 +243,37 @@
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 @@
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 @@
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 @@
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 @@
if (Printer.trace) Printer.trace("<< AbstractMixer: start(" + line + ") succeeded");
}
-
/**
* Stops the mixer if this was the last running line.
*/
@@ -492,8 +476,6 @@
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 @@
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 @@
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 @@
return targetLineInfo[i];
}
}
-
return null;
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java Mon Aug 15 20:08:55 2016 +0300
@@ -87,5 +87,4 @@
int getSsndChunkOffset() {
return getHeaderSize()-16;
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -29,7 +29,6 @@
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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AlawCodec.java Mon Aug 15 20:08:55 2016 +0300
@@ -33,7 +33,6 @@
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 @@
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 @@
super(alawEncodings, alawEncodings);
}
- // NEW CODE
-
- /**
- */
+ @Override
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
if( sourceFormat.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED )) {
@@ -117,8 +113,7 @@
}
}
- /**
- */
+ @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 @@
}
}
- /**
- */
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream){
AudioFormat sourceFormat = sourceStream.getFormat();
AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
@@ -169,9 +163,7 @@
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 @@
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 @@
* @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 @@
if( inputFormat.matches(outputFormat) ) {
cs = stream;
} else {
- cs = (AudioInputStream) (new AlawCodecStream(stream, outputFormat));
+ cs = new AlawCodecStream(stream, outputFormat);
}
return cs;
@@ -214,7 +201,6 @@
* 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 @@
* 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
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -45,6 +45,7 @@
*/
public final class AudioFileSoundbankReader extends SoundbankReader {
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
try {
@@ -59,6 +60,7 @@
}
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
stream.mark(512);
@@ -108,6 +110,7 @@
}
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java Mon Aug 15 20:08:55 2016 +0300
@@ -89,8 +89,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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++) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java Mon Aug 15 20:08:55 2016 +0300
@@ -32,9 +32,9 @@
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 @@
fsize = ((targetFormat.getSampleSizeInBits() + 7) / 8);
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b);
@@ -71,6 +72,7 @@
return b[0] & 0xFF;
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int flen = len / fsize;
@@ -83,6 +85,7 @@
return ret * fsize;
}
+ @Override
public int available() throws IOException {
int ret = stream.available();
if (ret < 0)
@@ -90,22 +93,27 @@
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 @@
.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 @@
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 @@
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 @@
}
}
+ @Override
public boolean markSupported() {
return ais.markSupported();
}
@@ -381,6 +404,7 @@
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
@@ -431,6 +455,7 @@
return len - remain * nrofchannels;
}
+ @Override
public void reset() throws IOException {
ais.reset();
if (mark_ibuffer == null)
@@ -447,6 +472,7 @@
}
+ @Override
public long skip(long len) throws IOException {
if (len < 0)
return 0;
@@ -474,8 +500,9 @@
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 @@
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 @@
.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 @@
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<AudioFormat> formats = new ArrayList<AudioFormat>();
+ ArrayList<AudioFormat> formats = new ArrayList<>();
if (targetEncoding.equals(Encoding.PCM_SIGNED))
formats.add(new AudioFormat(Encoding.PCM_SIGNED,
@@ -598,8 +630,9 @@
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 @@
return true;
}
+ @Override
public boolean isConversionSupported(Encoding targetEncoding,
- AudioFormat sourceFormat) {
+ AudioFormat sourceFormat) {
Objects.requireNonNull(targetEncoding);
if (AudioFloatConverter.getConverter(sourceFormat) == null)
return false;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
+ @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 @@
return len;
}
+ @Override
public long skip(long len) throws IOException {
if (pos >= buffer_len)
return -1;
@@ -102,21 +107,26 @@
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 @@
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 @@
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 @@
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();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
* @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 @@
* describing possible properties. This array may be an empty array if
* no properties are required.
*/
- public AudioSynthesizerPropertyInfo[] getPropertyInfo(
- Map<String, Object> info);
+ AudioSynthesizerPropertyInfo[] getPropertyInfo(Map<String, Object> info);
/**
* Opens the synthesizer and starts rendering audio into
@@ -93,7 +94,7 @@
* @see #close
* @see #isOpen
*/
- public void open(SourceDataLine line, Map<String, Object> info)
+ void open(SourceDataLine line, Map<String, Object> info)
throws MidiUnavailableException;
/**
@@ -123,6 +124,7 @@
* @see #close
* @see #isOpen
*/
- public AudioInputStream openStream(AudioFormat targetFormat,
- Map<String, Object> info) throws MidiUnavailableException;
+ AudioInputStream openStream(AudioFormat targetFormat,
+ Map<String, Object> info)
+ throws MidiUnavailableException;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoClosingClip.java Mon Aug 15 20:08:55 2016 +0300
@@ -28,7 +28,7 @@
import javax.sound.sampled.Clip;
/**
- * Interface for Clip objects that close themselves automatically
+ * Interface for Clip objects that close themselves automatically.
*
* @author Florian Bomers
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AutoConnectSequencer.java Mon Aug 15 20:08:55 2016 +0300
@@ -41,6 +41,5 @@
* needs to re-connect itself to a suitable
* device in open().
*/
- public void setAutoConnect(Receiver autoConnectReceiver);
-
+ void setAutoConnect(Receiver autoConnectReceiver);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSInstrument.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
boolean druminstrument = false;
byte[] guid = null;
DLSInfo info = new DLSInfo();
- List<DLSRegion> regions = new ArrayList<DLSRegion>();
- List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+ List<DLSRegion> regions = new ArrayList<>();
+ List<DLSModulator> modulators = new ArrayList<>();
public DLSInstrument() {
super(null, null, null, null);
@@ -62,6 +63,7 @@
return info;
}
+ @Override
public String getName() {
return info.name;
}
@@ -70,6 +72,7 @@
info.name = name;
}
+ @Override
public ModelPatch getPatch() {
return new ModelPatch(bank, preset, druminstrument);
}
@@ -86,6 +89,7 @@
}
}
+ @Override
public Object getData() {
return null;
}
@@ -98,6 +102,7 @@
return modulators;
}
+ @Override
public String toString() {
if (druminstrument)
return "Drumkit: " + info.name
@@ -362,17 +367,17 @@
return null;
}
+ @Override
public ModelPerformer[] getPerformers() {
- List<ModelPerformer> performers = new ArrayList<ModelPerformer>();
+ List<ModelPerformer> performers = new ArrayList<>();
- Map<String, DLSModulator> modmap = new HashMap<String, DLSModulator>();
+ Map<String, DLSModulator> modmap = new HashMap<>();
for (DLSModulator mod: getModulators()) {
modmap.put(mod.getSource() + "x" + mod.getControl() + "=" +
mod.getDestination(), mod);
}
- Map<String, DLSModulator> insmodmap =
- new HashMap<String, DLSModulator>();
+ Map<String, DLSModulator> insmodmap = new HashMap<>();
for (DLSRegion zone: regions) {
ModelPerformer performer = new ModelPerformer();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSModulator.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSRegion.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
public final class DLSRegion {
public static final int OPTION_SELFNONEXCLUSIVE = 0x0001;
- List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+ List<DLSModulator> modulators = new ArrayList<>();
int keyfrom;
int keyto;
int velfrom;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSample.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
return info;
}
+ @Override
public Object getData() {
AudioFormat format = getFormat();
@@ -93,6 +96,7 @@
this.data = new ModelByteBuffer(data, offset, length);
}
+ @Override
public String getName() {
return info.name;
}
@@ -109,6 +113,7 @@
this.sampleoptions = sampleOptions;
}
+ @Override
public String toString() {
return "Sample: " + info.name;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleLoop.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSampleOptions.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
short finetune;
int attenuation;
long options;
- List<DLSSampleLoop> loops = new ArrayList<DLSSampleLoop>();
+ List<DLSSampleLoop> loops = new ArrayList<>();
public int getAttenuation() {
return attenuation;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbank.java Mon Aug 15 20:08:55 2016 +0300
@@ -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.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 @@
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 @@
private final DLSInfo info = new DLSInfo();
- private final List<DLSInstrument> instruments = new ArrayList<DLSInstrument>();
- private final List<DLSSample> samples = new ArrayList<DLSSample>();
+ private final List<DLSInstrument> instruments = new ArrayList<>();
+ private final List<DLSSample> samples = new ArrayList<>();
private boolean largeFormat = false;
private File sampleFile;
@@ -300,7 +303,7 @@
DLSID uuid;
long x;
long y;
- Stack<Long> stack = new Stack<Long>();
+ Stack<Long> stack = new Stack<>();
while (riff.available() != 0) {
int opcode = riff.readUnsignedShort();
@@ -482,7 +485,7 @@
}
}
if (chunk.getType().equals("lart")) {
- List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+ List<DLSModulator> modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -498,7 +501,7 @@
}
if (chunk.getType().equals("lar2")) {
// support for DLS level 2 ART
- List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+ List<DLSModulator> modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -582,7 +585,7 @@
}
}
- private Map<DLSRegion, Long> temp_rgnassign = new HashMap<DLSRegion, Long>();
+ private Map<DLSRegion, Long> temp_rgnassign = new HashMap<>();
private boolean readRgnChunk(DLSRegion split, RIFFReader riff)
throws IOException {
@@ -591,7 +594,7 @@
String format = chunk.getFormat();
if (format.equals("LIST")) {
if (chunk.getType().equals("lart")) {
- List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+ List<DLSModulator> modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -607,7 +610,7 @@
}
if (chunk.getType().equals("lar2")) {
// support for DLS level 2 ART
- List<DLSModulator> modlist = new ArrayList<DLSModulator>();
+ List<DLSModulator> modlist = new ArrayList<>();
while (chunk.hasNextChunk()) {
RIFFReader subchunk = chunk.nextChunk();
if (chunk.getFormat().equals("cdl ")) {
@@ -902,7 +905,7 @@
RIFFWriter wvpl = writer.writeList("wvpl");
long off = wvpl.getFilePointer();
- List<Long> offsettable = new ArrayList<Long>();
+ List<Long> offsettable = new ArrayList<>();
for (DLSSample sample : samples) {
offsettable.add(Long.valueOf(wvpl.getFilePointer() - off));
writeSample(wvpl.writeList("wave"), sample);
@@ -1179,18 +1182,22 @@
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 @@
info.comments = s;
}
+ @Override
public SoundbankResource[] getResources() {
SoundbankResource[] resources = new SoundbankResource[samples.size()];
int j = 0;
@@ -1215,6 +1223,7 @@
return resources;
}
+ @Override
public DLSInstrument[] getInstruments() {
DLSInstrument[] inslist_array =
instruments.toArray(new DLSInstrument[instruments.size()]);
@@ -1226,6 +1235,7 @@
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 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) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -29,6 +29,7 @@
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 @@
*/
public final class DLSSoundbankReader extends SoundbankReader {
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
try {
@@ -52,6 +54,7 @@
}
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
try {
@@ -63,6 +66,7 @@
}
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DataPusher.java Mon Aug 15 20:08:55 2016 +0300
@@ -27,7 +27,9 @@
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 @@
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 @@
/**
* Write data to the source data line.
*/
+ @Override
public void run() {
byte[] buffer = null;
boolean useStream = (ais != null);
@@ -242,5 +244,4 @@
}
if (DEBUG || Printer.debug)Printer.debug("DataPusher:end of thread");
}
-
} // class DataPusher
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java Mon Aug 15 20:08:55 2016 +0300
@@ -29,35 +29,35 @@
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 @@
// 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 @@
throw new IllegalArgumentException("Line unsupported: " + info);
}
-
+ @Override
public int getMaxLines(Line.Info info) {
Line.Info fullInfo = getLineInfo(info);
@@ -233,26 +234,26 @@
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 @@
return null;
}
-
-
-
- // INNER CLASSES
-
-
/**
* Private inner class for the DataLine.Info objects
* adds a little magic for the isFormatSupported so
@@ -367,7 +362,7 @@
}
/**
- * 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 @@
// Guards all native calls.
protected final Object lockNative = new Object();
- // CONSTRUCTOR
protected DirectDL(DataLine.Info info,
DirectAudioDevice mixer,
AudioFormat format,
@@ -414,11 +408,7 @@
}
-
- // 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 @@
if (Printer.trace) Printer.trace("<< DirectDL: implOpen() succeeded");
}
-
+ @Override
void implStart() {
if (Printer.trace) Printer.trace(" >> DirectDL: implStart()");
@@ -570,6 +560,7 @@
if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded");
}
+ @Override
void implStop() {
if (Printer.trace) Printer.trace(">> DirectDL: implStop()");
@@ -600,6 +591,7 @@
if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded");
}
+ @Override
void implClose() {
if (Printer.trace) Printer.trace(">> DirectDL: implClose()");
@@ -625,8 +617,7 @@
if (Printer.trace) Printer.trace("<< DirectDL: implClose() succeeded");
}
- // METHOD OVERRIDES
-
+ @Override
public int available() {
if (id == 0) {
return 0;
@@ -638,7 +629,7 @@
return a;
}
-
+ @Override
public void drain() {
noService = true;
// additional safeguard against draining forever
@@ -681,6 +672,7 @@
noService = false;
}
+ @Override
public void flush() {
if (id != 0) {
// first stop ongoing read/write method
@@ -699,6 +691,7 @@
}
// replacement for getFramePosition (see AbstractDataLine)
+ @Override
public long getLongFramePosition() {
long pos;
synchronized (lockNative) {
@@ -713,7 +706,6 @@
return (pos / getFormat().getFrameSize());
}
-
/*
* write() belongs into SourceDataLine and Clip,
* so define it here and make it accessible by
@@ -786,6 +778,7 @@
}
// called from event dispatcher for lines that need servicing
+ @Override
public void checkLine() {
synchronized (lockNative) {
if (monitoring
@@ -826,7 +819,6 @@
}
}
-
/////////////////// CONTROLS /////////////////////////////
protected final class Gain extends FloatControl {
@@ -844,6 +836,7 @@
"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 @@
}
} // 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 @@
"", "Left", "Center", "Right");
}
+ @Override
public void setValue(float newValue) {
setValueImpl(newValue);
panControl.setValueImpl(newValue);
@@ -900,6 +894,7 @@
"", "Left", "Center", "Right");
}
+ @Override
public void setValue(float newValue) {
setValueImpl(newValue);
balanceControl.setValueImpl(newValue);
@@ -909,19 +904,14 @@
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 @@
}
/**
- * 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 @@
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 @@
// auto closing clip support
private boolean autoclosing = false;
- // CONSTRUCTOR
private DirectClip(DataLine.Info info,
AudioFormat format,
int bufferSize,
@@ -1041,6 +1028,7 @@
// CLIP METHODS
+ @Override
public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
throws LineUnavailableException {
@@ -1111,7 +1099,7 @@
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 @@
} // 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 @@
}
// replacement for getFramePosition (see AbstractDataLine)
+ @Override
public long getLongFramePosition() {
/* $$fb
* this would be intuitive, but the definition of getFramePosition
@@ -1243,7 +1232,7 @@
return super.getLongFramePosition();
}
-
+ @Override
public synchronized void setMicrosecondPosition(long microseconds) {
if (Printer.trace) Printer.trace("> DirectClip: setMicrosecondPosition: " + microseconds);
@@ -1253,6 +1242,7 @@
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 @@
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 @@
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 @@
super.implOpen(format, bufferSize);
}
+ @Override
void implClose() {
if (Printer.trace) Printer.trace(">> DirectClip: implClose()");
@@ -1333,13 +1321,14 @@
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 @@
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 @@
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 @@
}
}
+ @Override
protected boolean requiresServicing() {
// no need for servicing for Clips
return false;
@@ -1488,5 +1480,4 @@
private static native boolean nRequiresServicing(long id, boolean isSource);
// called in irregular intervals
private static native void nService(long id, boolean isSource);
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java Mon Aug 15 20:08:55 2016 +0300
@@ -28,7 +28,6 @@
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
-
/**
* DirectAudioDevice provider.
*
@@ -36,8 +35,6 @@
*/
public final class DirectAudioDeviceProvider extends MixerProvider {
- // STATIC VARIABLES
-
/**
* Set of info objects for all port input devices on the system.
*/
@@ -48,18 +45,11 @@
*/
private static DirectAudioDevice[] devices;
-
- // STATIC
-
static {
// initialize
Platform.initialize();
}
-
- // CONSTRUCTOR
-
-
/**
* Required public no-arg constructor.
*/
@@ -92,6 +82,7 @@
}
}
+ @Override
public Mixer.Info[] getMixerInfo() {
synchronized (DirectAudioDeviceProvider.class) {
Mixer.Info[] localArray = new Mixer.Info[infos.length];
@@ -100,7 +91,7 @@
}
}
-
+ @Override
public Mixer getMixer(Mixer.Info info) {
synchronized (DirectAudioDeviceProvider.class) {
// if the default device is asked, we provide the mixer
@@ -125,7 +116,6 @@
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 @@
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 @@
}
} // class DirectAudioDeviceInfo
- // NATIVE METHODS
private static native int nGetNumDevices();
// index: [0..nGetNumDevices()-1]
private static native DirectAudioDeviceInfo nNewDirectAudioDeviceInfo(int deviceIndex);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EmergencySoundbank.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/EventDispatcher.java Mon Aug 15 20:08:55 2016 +0300
@@ -35,8 +35,6 @@
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 @@
/**
* 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<EventInfo> 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<ClipInfo> autoClosingClips = new ArrayList<ClipInfo>();
+ private final ArrayList<ClipInfo> autoClosingClips = new ArrayList<>();
/*
* support for monitoring data lines
*/
- private final ArrayList<LineMonitor> lineMonitors = new ArrayList<LineMonitor>();
+ private final ArrayList<LineMonitor> 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 @@
}
}
-
/**
* Invoked when there is at least one event in the queue.
* Implement this as a callback to process one event.
@@ -153,7 +146,6 @@
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 @@
}
}
-
/**
* Queue the given event in the event queue.
*/
@@ -211,10 +202,10 @@
notifyAll();
}
-
/**
* A loop to dispatch events.
*/
+ @Override
public void run() {
while (true) {
@@ -226,7 +217,6 @@
}
}
-
/**
* Send audio and MIDI events.
*/
@@ -243,7 +233,6 @@
postEvent(eventInfo);
}
-
/*
* go through the list of registered auto-closing
* Clip instances and close them, if appropriate
@@ -291,7 +280,7 @@
}
/**
- * 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 @@
}
/**
- * 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 @@
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 @@
}
/**
- * 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 @@
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 @@
/**
- * Container for a clip with its expiration time
+ * Container for a clip with its expiration time.
*/
private class ClipInfo {
@@ -421,7 +407,7 @@
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 @@
/**
* 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
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FFT.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
i += jmax << 1;
}
-
}
// Perform Factor-4 Decomposition with 3 * complex operators and 8 +/-
@@ -682,7 +682,6 @@
i += jmax << 1;
}
-
}
private void bitreversal(double[] data) {
@@ -743,6 +742,5 @@
data[n] = data[m];
data[m] = tempi;
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastShortMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
return packedMsg;
}
+ @Override
public byte[] getMessage() {
int length = 0;
try {
@@ -73,6 +75,7 @@
return returnedArray;
}
+ @Override
public int getLength() {
try {
return getDataLength(packedMsg & 0xFF) + 1;
@@ -82,6 +85,7 @@
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 @@
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 @@
* as this object.
* @return a clone of this instance.
*/
+ @Override
public Object clone() {
try {
return new FastShortMessage(packedMsg);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/FastSysexMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
// 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
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidDataException.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/InvalidFormatException.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -69,11 +69,12 @@
return ok;
}
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
if (!isZIP(url))
return null;
- ArrayList<Soundbank> soundbanks = new ArrayList<Soundbank>();
+ ArrayList<Soundbank> 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 @@
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());
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java Mon Aug 15 20:08:55 2016 +0300
@@ -136,7 +136,6 @@
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 @@
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 @@
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.
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
return (System.getSecurityManager() != null);
}
-
static void checkRecordPermission() throws SecurityException {
if(Printer.trace) Printer.trace("JSSecurityManager.checkRecordPermission()");
SecurityManager sm = System.getSecurityManager();
@@ -90,6 +87,7 @@
try {
// invoke the privileged action using 1.2 security
PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
+ @Override
public Void run() {
loadPropertiesImpl(properties, filename);
return null;
@@ -108,7 +106,6 @@
}
}
-
private static void loadPropertiesImpl(Properties properties,
String filename) {
if(Printer.trace)Printer.trace(">> JSSecurityManager: loadPropertiesImpl()");
@@ -176,6 +173,7 @@
// the iterator's hasNext() method looks through classpath for
// the provider class names, so it requires read permissions
PrivilegedAction<Boolean> hasNextAction = new PrivilegedAction<Boolean>() {
+ @Override
public Boolean run() {
return ps.hasNext();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Mon Aug 15 20:08:55 2016 +0300
@@ -25,38 +25,36 @@
package com.sun.media.sound;
+import java.applet.AudioClip;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.applet.AudioClip;
+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.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
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.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.sound.midi.MidiSystem;
-import javax.sound.midi.MidiFileFormat;
-import javax.sound.midi.MetaMessage;
-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;
-
/**
* Java Sound audio clip;
*
* @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 @@
}
}
-
+ @Override
public synchronized void play() {
startImpl(false);
}
-
+ @Override
public synchronized void loop() {
startImpl(true);
}
@@ -205,6 +203,7 @@
}
}
+ @Override
public synchronized void stop() {
if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip->stop()");
@@ -248,13 +247,15 @@
// 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 @@
}
}
-
+ @Override
public String toString() {
return getClass().toString();
}
-
+ @Override
protected void finalize() {
if (clip != null) {
@@ -326,8 +327,6 @@
return true;
}
-
-
private void readStream(AudioInputStream as, long byteLen) throws IOException {
// arrays "only" max. 2GB
int intLen;
@@ -371,7 +370,6 @@
loadedAudioByteLength = totalBytesRead;
}
-
// METHODS FOR CREATING THE DEVICE
private boolean createClip() {
@@ -464,7 +462,6 @@
return true;
}
-
/*
* private inner class representing a ByteArrayOutputStream
* which allows retrieval of the internal array
@@ -479,5 +476,4 @@
}
} // class DirectBAOS
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
// 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;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
// 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;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDevice.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
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 @@
if (Printer.trace) Printer.trace("< MidiInDevice: implClose() completed");
}
-
+ @Override
public long getMicrosecondPosition() {
long timestamp = -1;
if (isOpen()) {
@@ -107,22 +102,21 @@
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 @@
}
}
- // 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 @@
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 @@
getTransmitterList().sendMessage(data, timeStamp);
}
- // NATIVE METHODS
-
private native long nOpen(int index) throws MidiUnavailableException;
private native void nClose(long id);
@@ -190,6 +178,4 @@
// go into native code and get messages. May be blocking
private native void nGetMessages(long id);
-
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiInDeviceProvider.java Mon Aug 15 20:08:55 2016 +0300
@@ -27,7 +27,6 @@
import javax.sound.midi.MidiDevice;
-
/**
* MIDI input device provider.
*
@@ -44,16 +43,12 @@
private static final boolean enabled;
- // STATIC
-
static {
// initialize
Platform.initialize();
enabled = Platform.isMidiIOEnabled();
}
- // CONSTRUCTOR
-
/**
* Required public no-arg constructor.
*/
@@ -63,6 +58,7 @@
// implementation of abstract methods in AbstractMidiDeviceProvider
+ @Override
AbstractMidiDeviceProvider.Info createInfo(int index) {
if (!enabled) {
return null;
@@ -70,6 +66,7 @@
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 @@
return null;
}
+ @Override
int getNumDevices() {
if (!enabled) {
if (Printer.debug)Printer.debug("MidiInDevice not enabled, returning 0 devices");
@@ -87,14 +85,15 @@
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 @@
} // class MidiInDeviceInfo
-
- // NATIVE METHODS
-
private static native int nGetNumDevices();
private static native String nGetName(int index);
private static native String nGetVendor(int index);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDevice.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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 @@
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 @@
if (Printer.trace) Printer.trace("< MidiOutDevice: implClose(): completed");
}
-
+ @Override
public long getMicrosecondPosition() {
long timestamp = -1;
if (isOpen()) {
@@ -81,28 +78,23 @@
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 @@
nSendShortMessage(id, packedMsg, timeStamp);
}
}
-
-
} // class MidiOutReceiver
-
- // NATIVE METHODS
-
private native long nOpen(int index) throws MidiUnavailableException;
private native void nClose(long id);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java Mon Aug 15 20:08:55 2016 +0300
@@ -27,7 +27,6 @@
import javax.sound.midi.MidiDevice;
-
/**
* MIDI output device provider.
*
@@ -44,16 +43,12 @@
private static final boolean enabled;
- // STATIC
-
static {
// initialize
Platform.initialize();
enabled = Platform.isMidiIOEnabled();
}
- // CONSTRUCTOR
-
/**
* Required public no-arg constructor.
*/
@@ -61,8 +56,7 @@
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 @@
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 @@
return null;
}
+ @Override
int getNumDevices() {
if (!enabled) {
if (Printer.debug)Printer.debug("MidiOutDevice not enabled, returning 0 devices");
@@ -85,14 +81,15 @@
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 @@
} // class MidiOutDeviceInfo
-
- // NATIVE METHODS
-
private static native int nGetNumDevices();
private static native String nGetName(int index);
private static native String nGetVendor(int index);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/MidiUtils.java Mon Aug 15 20:08:55 2016 +0300
@@ -77,7 +77,6 @@
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 @@
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 @@
return tempo;
}
-
/**
* converts<br>
* 1 - MPQ-Tempo to BPM tempo<br>
@@ -124,7 +121,6 @@
return ((double) 60000000l) / tempo;
}
-
/**
* convert tick to microsecond with given tempo.
* Does not take tempo changes into account.
@@ -145,7 +141,6 @@
return (long) ((((double)us) * resolution) / tempoMPQ);
}
-
/**
* Given a tick, convert to microsecond
* @param cache tempo info and current tempo
@@ -246,7 +241,6 @@
return tick;
}
-
/**
* Binary search for the event indexes of the track
*
@@ -283,7 +277,6 @@
return ret;
}
-
public static final class TempoCache {
long[] ticks;
int[] tempos; // in MPQ
@@ -310,7 +303,6 @@
refresh(seq);
}
-
public synchronized void refresh(Sequence seq) {
ArrayList<MidiEvent> list = new ArrayList<>();
Track[] tracks = seq.getTracks();
@@ -373,6 +365,5 @@
}
return tempos[tempos.length - 1];
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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) {
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 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 @@
on = true;
}
+ @Override
public int read(float[][] buffer, int offset, int len) throws IOException {
return -1;
}
@@ -91,6 +97,7 @@
return on;
}
+ @Override
public void setPitch(float pitch) {
this.pitch = pitch;
}
@@ -107,14 +114,17 @@
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 @@
return new Patch(0, 0);
}
+ @Override
public ModelOscillatorStream open(float samplerate) {
ModelAbstractOscillator oscs;
try {
@@ -162,10 +173,12 @@
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 @@
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;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
}
}
+ @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 @@
return n;
}
+ @Override
public int read(byte b[], int off, int len) throws IOException {
if (len > left)
len = (int)left;
@@ -107,6 +114,7 @@
return len;
}
+ @Override
public int read(byte[] b) throws IOException {
int len = b.length;
if (len > left)
@@ -120,6 +128,7 @@
return len;
}
+ @Override
public int read() throws IOException {
if (left == 0)
return -1;
@@ -130,6 +139,7 @@
return b;
}
+ @Override
public void close() throws IOException {
raf.close();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
return len;
}
+ @Override
public long skip(long n) throws IOException {
int avail = available();
if (avail <= 0)
@@ -93,10 +97,12 @@
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 @@
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 @@
return format;
}
+ @Override
public AudioFloatInputStream openStream() {
if (buffer == null)
return null;
@@ -230,16 +241,19 @@
(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 @@
this.attenuation = attenuation;
}
+ @Override
public float getLoopLength() {
return loopLength;
}
@@ -256,6 +271,7 @@
this.loopLength = loopLength;
}
+ @Override
public float getLoopStart() {
return loopStart;
}
@@ -268,10 +284,12 @@
this.loopType = loopType;
}
+ @Override
public int getLoopType() {
return loopType;
}
+ @Override
public float getPitchcorrection() {
return pitchcorrection;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelChannelMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelConnectionBlock.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDestination.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirectedPlayer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public interface ModelDirectedPlayer {
- public void play(int performerIndex, ModelConnectionBlock[] connectionBlocks);
+ void play(int performerIndex, ModelConnectionBlock[] connectionBlocks);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelDirector.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelIdentifier.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
this.variable = variable;
}
+ @Override
public int hashCode() {
int hashcode = instance;
if(object != null) hashcode |= object.hashCode();
@@ -141,6 +143,7 @@
return hashcode;
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof ModelIdentifier))
return false;
@@ -159,6 +162,7 @@
return true;
}
+ @Override
public String toString() {
if (variable == null) {
return object + "[" + instance + "]";
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrument.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelInstrumentComparator.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public final class ModelInstrumentComparator implements Comparator<Instrument> {
+ @Override
public int compare(Instrument arg0, Instrument arg1) {
Patch p0 = arg0.getPatch();
Patch p1 = arg1.getPatch();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelMappedInstrument.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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);
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillator.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelOscillatorStream.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPatch.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelPerformer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public final class ModelPerformer {
- private final List<ModelOscillator> oscillators = new ArrayList<ModelOscillator>();
- private List<ModelConnectionBlock> connectionBlocks
- = new ArrayList<ModelConnectionBlock>();
+ private final List<ModelOscillator> oscillators = new ArrayList<>();
+ private List<ModelConnectionBlock> connectionBlocks = new ArrayList<>();
+
private int keyFrom = 0;
private int keyTo = 127;
private int velFrom = 0;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelSource.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardDirector.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
}
+ @Override
public void close() {
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
if (!noteOffUsed)
return;
@@ -70,6 +73,7 @@
}
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
if (!noteOnUsed)
return;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
}
+ @Override
public void close() {
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
if (!noteOffUsed)
return;
@@ -172,6 +175,7 @@
}
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
if (!noteOnUsed)
return;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelStandardTransform.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
this.transform = transform;
}
+ @Override
public double transform(double value) {
double s;
double a;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelTransform.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public interface ModelTransform {
- public abstract double transform(double value);
+ double transform(double value);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelWavetable.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PCMtoPCMCodec.java Mon Aug 15 20:08:55 2016 +0300
@@ -40,7 +40,6 @@
*/
public final class PCMtoPCMCodec extends SunCodec {
-
private static final AudioFormat.Encoding[] inputEncodings = {
AudioFormat.Encoding.PCM_SIGNED,
AudioFormat.Encoding.PCM_UNSIGNED,
@@ -59,8 +58,7 @@
super( inputEncodings, outputEncodings);
}
- // NEW CODE
-
+ @Override
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
final int sampleSize = sourceFormat.getSampleSizeInBits();
@@ -88,9 +86,7 @@
return new AudioFormat.Encoding[0];
}
-
- /**
- */
+ @Override
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
Objects.requireNonNull(targetEncoding);
@@ -113,9 +109,7 @@
return formatArray;
}
-
- /**
- */
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) {
if( isConversionSupported(targetEncoding, sourceStream.getFormat()) ) {
@@ -136,9 +130,8 @@
}
}
- /**
- * 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 @@
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 @@
* @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 @@
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 @@
* returns an array of length 0.
* @return array of supported output formats.
*/
- /* public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
Vector<AudioFormat> formats = new Vector<>();
@@ -350,7 +334,6 @@
return formatArray;
}
-
class PCMtoPCMCodecStream extends AudioInputStream {
private final int PCM_SWITCH_SIGNED_8BIT = 1;
@@ -460,7 +443,7 @@
* 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 @@
}
}
-
+ @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 @@
}
}
}
-
-
-
} // end class PCMtoPCMCodecStream
-
} // end class PCMtoPCMCodec
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java Mon Aug 15 20:08:55 2016 +0300
@@ -29,8 +29,6 @@
import java.security.PrivilegedAction;
import java.util.StringTokenizer;
-
-
/**
* Audio configuration class for exposing attributes specific to the platform or system.
*
@@ -39,9 +37,6 @@
*/
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 @@
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 @@
}
}
-
static boolean isMidiIOEnabled() {
return isFeatureLibLoaded(FEATURE_MIDIIO);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -27,14 +27,13 @@
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 @@
*/
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 @@
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 @@
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 @@
throw new IllegalArgumentException("Line unsupported: " + info);
}
-
+ @Override
public int getMaxLines(Line.Info info) {
Line.Info fullInfo = getLineInfo(info);
@@ -153,7 +147,7 @@
return 0;
}
-
+ @Override
protected void implOpen() throws LineUnavailableException {
if (Printer.trace) Printer.trace(">> PortMixer: implOpen (id="+id+")");
@@ -163,6 +157,7 @@
if (Printer.trace) Printer.trace("<< PortMixer: implOpen succeeded.");
}
+ @Override
protected void implClose() {
if (Printer.trace) Printer.trace(">> PortMixer: implClose");
@@ -181,11 +176,11 @@
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 @@
return id;
}
- // INNER CLASSES
-
/**
* Private inner class representing a Port for the PortMixer.
*/
@@ -234,7 +227,6 @@
private final int portIndex;
private long id;
- // CONSTRUCTOR
private PortMixerPort(Port.Info info,
PortMixer mixer,
int portIndex) {
@@ -243,11 +235,6 @@
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 @@
controls = new Control[0];
}
-
void implClose() {
if (Printer.trace) Printer.trace(">> PortMixerPort: implClose()");
// get rid of controls
@@ -294,9 +280,8 @@
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 @@
}
// this is very similar to close() in AbstractDataLine...
+ @Override
public void close() {
synchronized (mixer) {
if (isOpen()) {
@@ -342,7 +328,7 @@
} // 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 @@
return new BCT(name);
}
-
private BoolCtrl(long controlID, String name) {
this(controlID, createType(name));
}
@@ -370,12 +355,14 @@
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 @@
}
/**
- * 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 @@
}
/**
- * 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 @@
}
/**
- * 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 @@
}
/**
- * 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 @@
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 @@
}
/**
- * 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 @@
}
/**
- * 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) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/PortMixerProvider.java Mon Aug 15 20:08:55 2016 +0300
@@ -28,7 +28,6 @@
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
-
/**
* Port provider.
*
@@ -36,8 +35,6 @@
*/
public final class PortMixerProvider extends MixerProvider {
- // STATIC VARIABLES
-
/**
* Set of info objects for all port input devices on the system.
*/
@@ -48,18 +45,11 @@
*/
private static PortMixer[] devices;
-
- // STATIC
-
static {
// initialize
Platform.initialize();
}
-
- // CONSTRUCTOR
-
-
/**
* Required public no-arg constructor.
*/
@@ -93,6 +83,7 @@
}
}
+ @Override
public Mixer.Info[] getMixerInfo() {
synchronized (PortMixerProvider.class) {
Mixer.Info[] localArray = new Mixer.Info[infos.length];
@@ -101,6 +92,7 @@
}
}
+ @Override
public Mixer getMixer(Mixer.Info info) {
synchronized (PortMixerProvider.class) {
for (int i = 0; i < infos.length; i++) {
@@ -113,7 +105,6 @@
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 @@
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 @@
} // class PortMixerInfo
- // NATIVE METHODS
private static native int nGetNumDevices();
private static native PortMixerInfo nNewPortMixerInfo(int mixerIndex);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidDataException.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RIFFWriter.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
}
}
+ @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 @@
return writeoverride;
}
+ @Override
public void close() throws IOException {
if (!open)
return;
@@ -245,6 +263,7 @@
raf = null;
}
+ @Override
public void write(int b) throws IOException {
if (!writeoverride) {
if (chunktype != 2) {
@@ -259,6 +278,7 @@
raf.write(b);
}
+ @Override
public void write(byte b[], int off, int len) throws IOException {
if (!writeoverride) {
if (chunktype != 2) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java Mon Aug 15 20:08:55 2016 +0300
@@ -27,14 +27,27 @@
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 @@
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 @@
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 @@
*/
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 @@
*/
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<RecordingTrack> recordingTracks = new ArrayList<>();
-
private long loopStart = 0;
private long loopEnd = -1;
private int loopCount = 0;
-
/**
- * Meta event listeners
+ * Meta event listeners.
*/
private final ArrayList<Object> metaEventListeners = new ArrayList<>();
-
/**
- * Control change listeners
+ * Control change listeners.
*/
private final ArrayList<ControllerListElement> 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 @@
if (Printer.trace) Printer.trace("<< RealTimeSequencer CONSTRUCTOR completed");
}
-
/* ****************************** SEQUENCER METHODS ******************** */
+ @Override
public synchronized void setSequence(Sequence sequence)
throws InvalidMidiDataException {
@@ -211,7 +220,7 @@
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 @@
}
-
+ @Override
public Sequence getSequence() {
return sequence;
}
-
+ @Override
public synchronized void start() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: start()");
@@ -259,7 +268,7 @@
if (Printer.trace) Printer.trace("<< RealTimeSequencer: start() completed");
}
-
+ @Override
public synchronized void stop() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: stop()");
@@ -280,12 +289,12 @@
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 @@
recording = true;
}
-
+ @Override
public void stopRecording() {
if (!isOpen()) {
throw new IllegalStateException("Sequencer not open");
@@ -303,12 +312,12 @@
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 @@
}
-
+ @Override
public void recordDisable(Track track) {
synchronized(recordingTracks) {
RecordingTrack rc = RecordingTrack.get(recordingTracks, track);
@@ -336,7 +345,6 @@
}
-
private boolean findTrack(Track track) {
boolean found = false;
if (sequence != null) {
@@ -351,14 +359,14 @@
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 @@
setTempoInMPQ((float) MidiUtils.convertTempo((double) bpm));
}
-
+ @Override
public float getTempoInMPQ() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoInMPQ() ");
@@ -389,7 +397,7 @@
return getDataPump().getTempoMPQ();
}
-
+ @Override
public void setTempoInMPQ(float mpq) {
if (mpq <= 0) {
// should throw IllegalArgumentException
@@ -410,7 +418,7 @@
}
}
-
+ @Override
public void setTempoFactor(float factor) {
if (factor <= 0) {
// should throw IllegalArgumentException
@@ -428,7 +436,7 @@
}
}
-
+ @Override
public float getTempoFactor() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTempoFactor() ");
@@ -441,7 +449,7 @@
return getDataPump().getTempoFactor();
}
-
+ @Override
public long getTickLength() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTickLength() ");
@@ -452,7 +460,7 @@
return sequence.getTickLength();
}
-
+ @Override
public synchronized long getTickPosition() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getTickPosition() ");
@@ -463,7 +471,7 @@
return getDataPump().getTickPos();
}
-
+ @Override
public synchronized void setTickPosition(long tick) {
if (tick < 0) {
// should throw IllegalArgumentException
@@ -486,7 +494,7 @@
}
}
-
+ @Override
public long getMicrosecondLength() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getMicrosecondLength() ");
@@ -497,7 +505,7 @@
return sequence.getMicrosecondLength();
}
-
+ @Override
public long getMicrosecondPosition() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: getMicrosecondPosition() ");
@@ -509,7 +517,7 @@
}
}
-
+ @Override
public void setMicrosecondPosition(long microseconds) {
if (microseconds < 0) {
// should throw IllegalArgumentException
@@ -534,34 +542,34 @@
}
}
-
+ @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 @@
return 0;
}
-
-
+ @Override
public synchronized void setTrackMute(int track, boolean mute) {
int trackCount = getTrackCount();
if (track < 0 || track >= getTrackCount()) return;
@@ -589,14 +596,14 @@
}
}
-
+ @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 @@
}
}
-
+ @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 @@
}
}
-
+ @Override
public void removeMetaEventListener(MetaEventListener listener) {
synchronized(metaEventListeners) {
int index = metaEventListeners.indexOf(listener);
@@ -635,7 +642,7 @@
}
}
-
+ @Override
public int[] addControllerEventListener(ControllerEventListener listener, int[] controllers) {
synchronized(controllerEventListeners) {
@@ -663,7 +670,7 @@
}
}
-
+ @Override
public int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers) {
synchronized(controllerEventListeners) {
ControllerListElement cve = null;
@@ -690,9 +697,9 @@
}
}
-
////////////////// LOOPING (added in 1.5) ///////////////////////
+ @Override
public void setLoopStartPoint(long tick) {
if ((tick > getTickLength())
|| ((loopEnd != -1) && (tick > loopEnd))
@@ -702,10 +709,12 @@
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 @@
loopEnd = tick;
}
+ @Override
public long getLoopEndPoint() {
return loopEnd;
}
+ @Override
public void setLoopCount(int count) {
if (count != LOOP_CONTINUOUSLY
&& count < 0) {
@@ -730,15 +741,14 @@
}
}
+ @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 @@
}
}
- /** 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 @@
if (Printer.trace) Printer.trace("<< RealTimeSequencer: implStart() completed");
}
-
void implStop() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStop()");
@@ -953,8 +963,6 @@
getEventDispatcher().sendAudioEvents(message, sendToListeners);
}
-
-
private boolean needCaching() {
return !isOpen() || (sequence == null) || (playThread == null);
}
@@ -988,42 +996,39 @@
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 SequencerReceiver extends AbstractReceiver {
+ @Override
void implSend(MidiMessage message, long timeStamp) {
if (recording) {
long tickPos = 0;
@@ -1080,7 +1085,6 @@
}
}
-
private static class RealTimeSequencerInfo extends MidiDevice.Info {
private static final String name = "Real Time Sequencer";
@@ -1093,7 +1097,6 @@
}
} // class Info
-
private class ControllerListElement {
// $$jb: using an array for controllers b/c its
@@ -1202,7 +1205,6 @@
} // class ControllerListElement
-
static class RecordingTrack {
private final Track track;
@@ -1244,7 +1246,6 @@
}
}
-
final class PlayThread implements Runnable {
private Thread thread;
private final Object lock = new Object();
@@ -1351,13 +1352,13 @@
}
}
-
/**
* 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 @@
}
}
-
/**
* 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 @@
//private sun.misc.Perf perf = sun.misc.Perf.getPerf();
//private long perfFreq = perf.highResFrequency();
-
DataPump() {
init();
}
@@ -1516,8 +1515,6 @@
trackDisabled = newDisabled;
}
-
-
synchronized void setSequence(Sequence seq) {
if (seq == null) {
init();
@@ -1568,7 +1565,6 @@
if (DEBUG_PUMP) Printer.println(" noteOff: sent "+done+" messages.");
}
-
private boolean[] makeDisabledArray() {
if (tracks == null) {
return null;
@@ -1656,11 +1652,10 @@
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 @@
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 @@
if (DEBUG_PUMP) Printer.println("<< chaseEvents");
}
-
// playback related methods (pumping)
private long getCurrentTimeMillis() {
@@ -1900,7 +1895,6 @@
return changesPending;
}
-
/** the main pump method
* @return true if end of sequence is reached
*/
@@ -2078,7 +2072,5 @@
return EOM;
}
-
} // class DataPump
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ReferenceCountingDevice.java Mon Aug 15 20:08:55 2016 +0300
@@ -29,8 +29,6 @@
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 @@
* 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;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2GlobalRegion.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Instrument.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
long genre = 0;
long morphology = 0;
SF2GlobalRegion globalregion = null;
- List<SF2InstrumentRegion> regions
- = new ArrayList<SF2InstrumentRegion>();
+ List<SF2InstrumentRegion> regions = new ArrayList<>();
public SF2Instrument() {
super(null, null, null, null);
@@ -56,6 +56,7 @@
super(soundbank, null, null, null);
}
+ @Override
public String getName() {
return name;
}
@@ -64,6 +65,7 @@
this.name = name;
}
+ @Override
public Patch getPatch() {
if (bank == 128)
return new ModelPatch(0, preset, true);
@@ -81,6 +83,7 @@
}
}
+ @Override
public Object getData() {
return null;
}
@@ -121,6 +124,7 @@
globalregion = zone;
}
+ @Override
public String toString() {
if (bank == 128)
return "Drumkit: " + name + " preset #" + preset;
@@ -129,6 +133,7 @@
+ " preset #" + preset;
}
+ @Override
public ModelPerformer[] getPerformers() {
int performercount = 0;
for (SF2InstrumentRegion presetzone : regions)
@@ -138,7 +143,7 @@
SF2GlobalRegion presetglobal = globalregion;
for (SF2InstrumentRegion presetzone : regions) {
- Map<Integer, Short> pgenerators = new HashMap<Integer, Short>();
+ Map<Integer, Short> pgenerators = new HashMap<>();
pgenerators.putAll(presetzone.getGenerators());
if (presetglobal != null)
pgenerators.putAll(presetglobal.getGenerators());
@@ -267,7 +272,7 @@
if (buff24 != null)
osc.set8BitExtensionBuffer(buff24);
- Map<Integer, Short> generators = new HashMap<Integer, Short>();
+ Map<Integer, Short> generators = new HashMap<>();
if (layerglobal != null)
generators.putAll(layerglobal.getGenerators());
generators.putAll(layerzone.getGenerators());
@@ -608,6 +613,7 @@
new ModelConnectionBlock(
new ModelSource(ModelSource.SOURCE_NOTEON_VELOCITY,
new ModelTransform() {
+ @Override
public double transform(double value) {
if (value < 0.5)
return 1 - value * 2;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2InstrumentRegion.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Layer.java Mon Aug 15 20:08:55 2016 +0300
@@ -38,7 +38,7 @@
String name = "";
SF2GlobalRegion globalregion = null;
- List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
+ List<SF2LayerRegion> regions = new ArrayList<>();
public SF2Layer(SF2Soundbank soundBank) {
super(soundBank, null, null);
@@ -48,10 +48,12 @@
super(null, null, null);
}
+ @Override
public Object getData() {
return null;
}
+ @Override
public String getName() {
return name;
}
@@ -72,6 +74,7 @@
globalregion = zone;
}
+ @Override
public String toString() {
return "Layer: " + name;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2LayerRegion.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Modulator.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Region.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 static final int GENERATOR_OVERRIDINGROOTKEY = 58;
public static final int GENERATOR_UNUSED5 = 59;
public static final int GENERATOR_ENDOPR = 60;
- protected Map<Integer, Short> generators = new HashMap<Integer, Short>();
- protected List<SF2Modulator> modulators = new ArrayList<SF2Modulator>();
+ protected Map<Integer, Short> generators = new HashMap<>();
+ protected List<SF2Modulator> modulators = new ArrayList<>();
public Map<Integer, Short> getGenerators() {
return generators;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Sample.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
super(null, null, AudioInputStream.class);
}
+ @Override
public Object getData() {
AudioFormat format = getFormat();
@@ -146,6 +148,7 @@
}
*/
+ @Override
public String getName() {
return name;
}
@@ -210,6 +213,7 @@
this.startLoop = startLoop;
}
+ @Override
public String toString() {
return "Sample: " + name;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2Soundbank.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
private ModelByteBuffer sampleData24 = null;
private File sampleFile = null;
private boolean largeFormat = false;
- private final List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
- private final List<SF2Layer> layers = new ArrayList<SF2Layer>();
- private final List<SF2Sample> samples = new ArrayList<SF2Sample>();
+ private final List<SF2Instrument> instruments = new ArrayList<>();
+ private final List<SF2Layer> layers = new ArrayList<>();
+ private final List<SF2Sample> samples = new ArrayList<>();
public SF2Soundbank() {
}
@@ -224,19 +225,15 @@
private void readPdtaChunk(RIFFReader riff) throws IOException {
- List<SF2Instrument> presets = new ArrayList<SF2Instrument>();
- List<Integer> presets_bagNdx = new ArrayList<Integer>();
- List<SF2InstrumentRegion> presets_splits_gen
- = new ArrayList<SF2InstrumentRegion>();
- List<SF2InstrumentRegion> presets_splits_mod
- = new ArrayList<SF2InstrumentRegion>();
+ List<SF2Instrument> presets = new ArrayList<>();
+ List<Integer> presets_bagNdx = new ArrayList<>();
+ List<SF2InstrumentRegion> presets_splits_gen = new ArrayList<>();
+ List<SF2InstrumentRegion> presets_splits_mod = new ArrayList<>();
- List<SF2Layer> instruments = new ArrayList<SF2Layer>();
- List<Integer> instruments_bagNdx = new ArrayList<Integer>();
- List<SF2LayerRegion> instruments_splits_gen
- = new ArrayList<SF2LayerRegion>();
- List<SF2LayerRegion> instruments_splits_mod
- = new ArrayList<SF2LayerRegion>();
+ List<SF2Layer> instruments = new ArrayList<>();
+ List<Integer> instruments_bagNdx = new ArrayList<>();
+ List<SF2LayerRegion> instruments_splits_gen = new ArrayList<>();
+ List<SF2LayerRegion> instruments_splits_mod = new ArrayList<>();
while (riff.hasNextChunk()) {
RIFFReader chunk = riff.nextChunk();
@@ -830,18 +827,22 @@
}
+ @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 @@
comments = s;
}
+ @Override
public SoundbankResource[] getResources() {
SoundbankResource[] resources
= new SoundbankResource[layers.size() + samples.size()];
@@ -869,6 +871,7 @@
return resources;
}
+ @Override
public SF2Instrument[] getInstruments() {
SF2Instrument[] inslist_array
= instruments.toArray(new SF2Instrument[instruments.size()]);
@@ -884,6 +887,7 @@
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 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) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public final class SF2SoundbankReader extends SoundbankReader {
+ @Override
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
try {
@@ -51,6 +54,7 @@
}
}
+ @Override
public Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException {
try {
@@ -62,6 +66,7 @@
}
}
+ @Override
public Soundbank getSoundbank(File file)
throws InvalidMidiDataException, IOException {
try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleInstrument.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
protected int bank = 0;
protected boolean percussion = false;
protected String name = "";
- protected List<SimpleInstrumentPart> parts
- = new ArrayList<SimpleInstrumentPart>();
+ protected List<SimpleInstrumentPart> parts = new ArrayList<>();
public SimpleInstrument() {
super(null, null, null, null);
@@ -121,6 +122,7 @@
add(ins.getPerformers());
}
+ @Override
public ModelPerformer[] getPerformers() {
int percount = 0;
@@ -166,10 +168,12 @@
return performers;
}
+ @Override
public Object getData() {
return null;
}
+ @Override
public String getName() {
return this.name;
}
@@ -178,6 +182,7 @@
this.name = name;
}
+ @Override
public ModelPatch getPatch() {
return new ModelPatch(bank, preset, percussion);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SimpleSoundbank.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
String version = "";
String vendor = "";
String description = "";
- List<SoundbankResource> resources = new ArrayList<SoundbankResource>();
- List<Instrument> instruments = new ArrayList<Instrument>();
+ List<SoundbankResource> resources = new ArrayList<>();
+ List<Instrument> 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 @@
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 @@
return inslist_array;
}
+ @Override
public Instrument getInstrument(Patch patch) {
int program = patch.getProgram();
int bank = patch.getBank();
@@ -120,7 +128,7 @@
public void removeResource(SoundbankResource resource) {
if (resource instanceof Instrument)
- instruments.remove((Instrument) resource);
+ instruments.remove(resource);
else
resources.remove(resource);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAbstractResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
nextBuffer();
}
+ @Override
public void setPitch(float pitch) {
/*
this.pitch = (float) Math.pow(2f,
@@ -254,6 +259,7 @@
}
}
+ @Override
public int read(float[][] buffer, int offset, int len)
throws IOException {
@@ -373,6 +379,7 @@
return len;
}
+ @Override
public void close() throws IOException {
stream.close();
}
@@ -384,6 +391,7 @@
float in_end, float[] pitch, float pitchstep, float[] out,
int[] out_offset, int out_end);
+ @Override
public final SoftResamplerStreamer openStreamer() {
return new ModelAbstractResamplerStream();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioBuffer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
}
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioProcessor.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
}
+ @Override
public void run() {
byte[] buffer = SoftAudioPusher.this.buffer;
AudioInputStream ais = SoftAudioPusher.this.ais;
@@ -87,6 +89,5 @@
active = false;
//e.printStackTrace();
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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 @@
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 @@
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 @@
}
}
- 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<Integer, int[]> co_midi_rpn_rpn_i = new HashMap<Integer, int[]>();
- Map<Integer, double[]> co_midi_rpn_rpn = new HashMap<Integer, double[]>();
- private SoftControl co_midi_rpn = new SoftControl() {
+ Map<Integer, int[]> co_midi_rpn_rpn_i = new HashMap<>();
+ Map<Integer, double[]> co_midi_rpn_rpn = new HashMap<>();
+ private final SoftControl co_midi_rpn = new SoftControl() {
Map<Integer, double[]> rpn = co_midi_rpn_rpn;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -177,10 +181,11 @@
return v;
}
};
- Map<Integer, int[]> co_midi_nrpn_nrpn_i = new HashMap<Integer, int[]>();
- Map<Integer, double[]> co_midi_nrpn_nrpn = new HashMap<Integer, double[]>();
- private SoftControl co_midi_nrpn = new SoftControl() {
+ Map<Integer, int[]> co_midi_nrpn_nrpn_i = new HashMap<>();
+ Map<Integer, double[]> co_midi_nrpn_nrpn = new HashMap<>();
+ private final SoftControl co_midi_nrpn = new SoftControl() {
Map<Integer, double[]> nrpn = co_midi_nrpn_nrpn;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -407,6 +412,7 @@
}
}
+ @Override
public void noteOn(int noteNumber, int velocity) {
noteOn(noteNumber, velocity, 0);
}
@@ -544,6 +550,7 @@
}
}
+ @Override
public void noteOff(int noteNumber, int velocity) {
noteNumber = restrict7Bit(noteNumber);
velocity = restrict7Bit(velocity);
@@ -616,7 +623,7 @@
}
}
- 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 @@
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 @@
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 @@
}
}
+ @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 @@
}
}
+ @Override
public int getChannelPressure() {
synchronized (control_mutex) {
return channelpressure;
@@ -823,7 +836,7 @@
05 LFO Amplitude Depth | 00H..7FH | 0..100 percent | 0
*/
- List<ModelConnectionBlock> conns = new ArrayList<ModelConnectionBlock>();
+ List<ModelConnectionBlock> conns = new ArrayList<>();
for (int i = 0; i < destination.length; i++) {
int d = destination[i];
@@ -869,6 +882,7 @@
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 @@
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 @@
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 @@
}
}
+ @Override
public int getController(int controller) {
synchronized (control_mutex) {
// Should only return lower 7 bits,
@@ -1259,10 +1276,12 @@
}
}
+ @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 @@
}
}
+ @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 @@
}
}
+ @Override
public int getPitchBend() {
synchronized (control_mutex) {
return pitchbend;
@@ -1398,6 +1420,7 @@
voices[i].rpnChange(controller, val_i[0]);
}
+ @Override
public void resetAllControllers() {
resetAllControllers(false);
}
@@ -1463,6 +1486,7 @@
}
}
+ @Override
public void allNotesOff() {
if (current_mixer != null)
current_mixer.allNotesOff();
@@ -1475,6 +1499,7 @@
}
}
+ @Override
public void allSoundOff() {
if (current_mixer != null)
current_mixer.allSoundOff();
@@ -1485,10 +1510,12 @@
}
}
+ @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 @@
}
}
+ @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 @@
// 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 @@
}
}
+ @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 @@
}
}
+ @Override
public boolean getSolo() {
synchronized (control_mutex) {
return solo;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChannelProxy.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftChorus.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
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 @@
}
}
+ @Override
public void processControlLogic() {
if (dirty) {
dirty = false;
@@ -286,6 +290,7 @@
}
double silentcounter = 1000;
+ @Override
public void processAudio() {
if (inputA.isSilent()) {
@@ -317,15 +322,18 @@
}
}
+ @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;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftControl.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public interface SoftControl {
- public double[] get(int instance, String name);
+ double[] get(int instance, String name);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftCubicResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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];
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
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 @@
return null;
}
+ @Override
@SuppressWarnings("fallthrough")
public void processControlLogic() {
for (int i = 0; i < used_count; i++) {
@@ -295,6 +300,5 @@
break;
}
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftFilter.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,6 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
/**
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftInstrument.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
return ins;
}
+ @Override
public Object getData() {
return data;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java Mon Aug 15 20:08:55 2016 +0300
@@ -22,13 +22,15 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package com.sun.media.sound;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
/**
* A jitter corrector to be used with SoftAudioPusher.
@@ -124,6 +126,7 @@
Runnable runnable = new Runnable() {
+ @Override
public void run() {
AudioFormat format = stream.getFormat();
int bufflen = buffers[0].length;
@@ -220,6 +223,7 @@
thread.start();
}
+ @Override
public void close() throws IOException {
synchronized (this) {
active = false;
@@ -232,6 +236,7 @@
stream.close();
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
if (read(b) == -1)
@@ -244,6 +249,7 @@
bbuffer_pos = 0;
}
+ @Override
public int read(byte[] b, int off, int len) {
if (bbuffer == null)
fillBuffer();
@@ -263,6 +269,7 @@
return len;
}
+ @Override
public int available() {
return bbuffer.length - bbuffer_pos;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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];
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLimiter.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
bufferR = input;
}
+ @Override
public void setOutput(int pin, SoftAudioBuffer output) {
if (pin == 0)
bufferLout = output;
@@ -61,16 +65,19 @@
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 @@
gain = newgain;
}
+ @Override
public void processControlLogic() {
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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 @@
in_offset[0] = ix;
out_offset[0] = ox;
startpitch[0] = pitch;
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java Mon Aug 15 20:08:55 2016 +0300
@@ -33,13 +33,15 @@
*/
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];
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
}
}
+ @Override
public void reset() {
for (int i = 0; i < used_count; i++) {
out[i][0] = 0;
@@ -67,6 +69,7 @@
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 @@
processControlLogic();
}
+ @Override
public void processControlLogic() {
for (int i = 0; i < used_count; i++) {
if (delay_counter[i] > 0) {
@@ -114,6 +118,7 @@
}
}
+ @Override
public double[] get(int instance, String name) {
if (instance >= used_count)
used_count = instance + 1;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMainMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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<Long, Object> midimessages = new TreeMap<Long, Object>();
+ TreeMap<Long, Object> 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<SoftChannelMixerContainer> registeredMixers = null;
private Set<ModelChannelMixer> stoppedMixers = null;
private SoftChannelMixerContainer[] cur_registeredMixers = null;
@@ -104,6 +105,7 @@
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 void stopMixer(ModelChannelMixer mixer) {
if (stoppedMixers == null)
- stoppedMixers = new HashSet<ModelChannelMixer>();
+ stoppedMixers = new HashSet<>();
stoppedMixers.add(mixer);
}
public void registerMixer(ModelChannelMixer mixer) {
if (registeredMixers == null)
- registeredMixers = new HashSet<SoftChannelMixerContainer>();
+ 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 @@
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 @@
return len;
}
+ @Override
public int read() throws IOException {
int ret = read(single);
if (ret == -1)
@@ -910,10 +914,12 @@
return single[0] & 0xFF;
}
+ @Override
public int available() {
return bbuffer.length - bbuffer_pos;
}
+ @Override
public void close() {
SoftMainMixer.this.synth.close();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -63,7 +63,7 @@
private AudioInputStream getAudioInputStream(final Sequence seq)
throws InvalidMidiDataException {
- AudioSynthesizer synth = (AudioSynthesizer) new SoftSynthesizer();
+ AudioSynthesizer synth = new SoftSynthesizer();
AudioInputStream stream;
Receiver recv;
try {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingClip.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
return b[0] & 0xFF;
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
if (_loopcount != 0) {
@@ -166,6 +169,7 @@
super(mixer, info);
}
+ @Override
protected void processControlLogic() {
_rightgain = rightgain;
@@ -203,6 +207,7 @@
}
+ @Override
protected void processAudioLogic(SoftAudioBuffer[] buffers) {
if (_active) {
float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array();
@@ -273,15 +278,18 @@
}
}
+ @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 @@
}
+ @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 @@
}
+ @Override
public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
throws LineUnavailableException {
synchronized (control_mutex) {
@@ -385,6 +395,7 @@
}
+ @Override
public void setFramePosition(int frames) {
synchronized (control_mutex) {
frameposition_sg = true;
@@ -392,6 +403,7 @@
}
}
+ @Override
public void setLoopPoints(int start, int end) {
synchronized (control_mutex) {
if (end != -1) {
@@ -414,60 +426,73 @@
}
}
+ @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 @@
sendEvent(event);
}
+ @Override
public void stop() {
LineEvent event = null;
@@ -506,6 +532,7 @@
sendEvent(event);
}
+ @Override
public void close() {
LineEvent event = null;
@@ -526,10 +553,12 @@
}
+ @Override
public boolean isOpen() {
return open;
}
+ @Override
public void open() throws LineUnavailableException {
if (data == null) {
throw new IllegalArgumentException(
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingDataLine.java Mon Aug 15 20:08:55 2016 +0300
@@ -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.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 @@
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 @@
}
}
+ @Override
public boolean markSupported() {
return ais.markSupported();
}
@@ -206,6 +213,7 @@
}
+ @Override
public int read(float[] b, int off, int len) throws IOException {
if (cbuffer == null || cbuffer[0].length < len / nrofchannels) {
@@ -255,6 +263,7 @@
return len - remain * nrofchannels;
}
+ @Override
public void reset() throws IOException {
ais.reset();
if (mark_ibuffer == null)
@@ -271,6 +280,7 @@
}
+ @Override
public long skip(long len) throws IOException {
if (len > 0)
return 0;
@@ -302,6 +312,7 @@
-1, 0.0f, "dB", "Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
calcVolume();
@@ -314,6 +325,7 @@
super(BooleanControl.Type.MUTE, false, "True", "False");
}
+ @Override
public void setValue(boolean newValue) {
super.setValue(newValue);
calcVolume();
@@ -326,6 +338,7 @@
super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
}
+ @Override
public void setValue(boolean newValue) {
super.setValue(newValue);
calcVolume();
@@ -340,6 +353,7 @@
0.0f, "", "Left", "Center", "Right");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
calcVolume();
@@ -354,11 +368,13 @@
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 @@
-1, -80f, "dB", "Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
balance_control.setValue(newValue);
@@ -386,6 +403,7 @@
"Minimum", "", "Maximum");
}
+ @Override
public void setValue(float newValue) {
super.setValue(newValue);
balance_control.setValue(newValue);
@@ -417,7 +435,7 @@
float eff2gain = 0;
- List<LineListener> listeners = new ArrayList<LineListener>();
+ List<LineListener> listeners = new ArrayList<>();
final Object control_mutex;
@@ -476,22 +494,26 @@
}
}
+ @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 @@
+ 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 @@
}
return false;
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMainMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
private final Object control_mutex;
- private final List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
+ private final List<SoftMixingDataLine> openLinesList = new ArrayList<>();
private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
@@ -184,6 +185,7 @@
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 @@
return len;
}
+ @Override
public int read() throws IOException {
int ret = read(single);
if (ret == -1)
@@ -207,10 +210,12 @@
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 @@
if (mixer.implicitOpen)
mixer.close();
}
-
}
public SoftMixingDataLine[] getOpenLines() {
synchronized (control_mutex) {
return openLines;
}
-
}
public void close() {
@@ -255,5 +258,4 @@
openLines[i].close();
}
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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.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.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 @@
private final boolean jitter_correction = false;
- private final List<LineListener> listeners = new ArrayList<LineListener>();
+ private final List<LineListener> listeners = new ArrayList<>();
private final javax.sound.sampled.Line.Info[] sourceLineInfo;
@@ -96,7 +97,7 @@
sourceLineInfo = new javax.sound.sampled.Line.Info[2];
- ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();
+ ArrayList<AudioFormat> 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 @@
AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED);
}
+ @Override
public Line getLine(Line.Info info) throws LineUnavailableException {
if (!isLineSupported(info))
@@ -155,6 +157,7 @@
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 @@
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 @@
return localArray;
}
+ @Override
public javax.sound.sampled.Line.Info[] getSourceLineInfo(
javax.sound.sampled.Line.Info info) {
int i;
- ArrayList<javax.sound.sampled.Line.Info> infos = new ArrayList<javax.sound.sampled.Line.Info>();
+ ArrayList<javax.sound.sampled.Line.Info> infos = new ArrayList<>();
for (i = 0; i < sourceLineInfo.length; i++) {
if (info.matches(sourceLineInfo[i])) {
@@ -187,6 +193,7 @@
return infos.toArray(new Line.Info[infos.size()]);
}
+ @Override
public Line[] getSourceLines() {
Line[] localLines;
@@ -207,19 +214,23 @@
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 @@
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 @@
}
}
+ @Override
public void close() {
if (!isOpen())
return;
@@ -308,29 +324,35 @@
}
+ @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 @@
}
+ @Override
public void removeLineListener(LineListener listener) {
synchronized (control_mutex) {
listeners.remove(listener);
@@ -525,5 +548,4 @@
return null;
return mainmixer;
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java Mon Aug 15 20:08:55 2016 +0300
@@ -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.spi.MixerProvider;
/**
- * Provider for software audio mixer
+ * Provider for software audio mixer.
*
* @author Karl Helgason
*/
@@ -41,6 +42,7 @@
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 @@
globalmixer = new SoftMixingMixer();
return globalmixer;
}
-
}
+ @Override
public Info[] getMixerInfo() {
return new Info[] { SoftMixingMixer.info };
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
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 @@
super(mixer, info);
}
+ @Override
public int write(byte[] b, int off, int len) {
if (!isOpen())
return 0;
@@ -202,6 +213,7 @@
private float _eff2gain;
+ @Override
protected void processControlLogic() {
_active = active;
_rightgain = rightgain;
@@ -210,6 +222,7 @@
_eff2gain = eff2gain;
}
+ @Override
protected void processAudioLogic(SoftAudioBuffer[] buffers) {
if (_active) {
float[] left = buffers[SoftMixingMainMixer.CHANNEL_LEFT].array();
@@ -274,10 +287,12 @@
}
}
+ @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 @@
open(format, bufferSize);
}
+ @Override
public void open(AudioFormat format, int bufferSize)
throws LineUnavailableException {
@@ -323,6 +339,7 @@
InputStream cycling_inputstream = new InputStream() {
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
int ret = read(b);
@@ -331,12 +348,14 @@
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 @@
}
+ @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 @@
}
}
+ @Override
public void flush() {
synchronized (cycling_buffer) {
cycling_read_pos = 0;
@@ -417,49 +439,58 @@
}
}
+ @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 @@
sendEvent(event);
}
+ @Override
public void stop() {
LineEvent event = null;
@@ -495,6 +527,7 @@
sendEvent(event);
}
+ @Override
public void close() {
LineEvent event = null;
@@ -516,10 +549,10 @@
}
+ @Override
public boolean isOpen() {
synchronized (control_mutex) {
return open;
}
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPerformer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 ModelPerformer performer;
public ModelConnectionBlock[] connections;
public ModelOscillator[] oscillators;
- public Map<Integer, int[]> midi_rpn_connections = new HashMap<Integer, int[]>();
- public Map<Integer, int[]> midi_nrpn_connections = new HashMap<Integer, int[]>();
+ public Map<Integer, int[]> midi_rpn_connections = new HashMap<>();
+ public Map<Integer, int[]> midi_nrpn_connections = new HashMap<>();
public int[][] midi_ctrl_connections;
public int[][] midi_connections;
public int[] ctrl_connections;
- private List<Integer> ctrl_connections_list = new ArrayList<Integer>();
+ private final List<Integer> ctrl_connections_list = new ArrayList<>();
private static class KeySortComparator implements Comparator<ModelSource> {
+ @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 @@
exclusiveClass = performer.getExclusiveClass();
selfNonExclusive = performer.isSelfNonExclusive();
- Map<String, ModelConnectionBlock> connmap = new HashMap<String, ModelConnectionBlock>();
+ Map<String, ModelConnectionBlock> connmap = new HashMap<>();
- List<ModelConnectionBlock> performer_connections = new ArrayList<ModelConnectionBlock>();
+ List<ModelConnectionBlock> performer_connections = new ArrayList<>();
performer_connections.addAll(performer.getConnectionBlocks());
if (performer.isDefaultConnectionsEnabled()) {
@@ -649,6 +652,7 @@
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 @@
connmap.put(extractKeys(connection), connection);
// seperate connection blocks : Init time, Midi Time, Midi/Control Time,
// Control Time
- List<ModelConnectionBlock> connections = new ArrayList<ModelConnectionBlock>();
+ List<ModelConnectionBlock> connections = new ArrayList<>();
midi_ctrl_connections = new int[128][];
for (int i = 0; i < midi_ctrl_connections.length; i++) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftPointResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
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 @@
in_offset[0] = ix;
out_offset[0] = ox;
startpitch[0] = pitch;
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftProcess.java Mon Aug 15 20:08:55 2016 +0300
@@ -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();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReceiver.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
}
}
+ @Override
public void close() {
synchronized (control_mutex) {
open = false;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public interface SoftResampler {
- public SoftResamplerStreamer openStreamer();
+ SoftResamplerStreamer openStreamer();
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftResamplerStreamer.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
*/
public interface SoftResamplerStreamer extends ModelOscillatorStream {
- public void open(ModelWavetable osc, float outputsamplerate)
- throws IOException;
+ void open(ModelWavetable osc, float outputsamplerate) throws IOException;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftReverb.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
private float samplerate;
private boolean light = true;
+ @Override
public void init(float samplerate, float controlrate) {
this.samplerate = samplerate;
@@ -260,11 +262,13 @@
}
+ @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 @@
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 @@
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 @@
combL[i].processMix(out, left);
}
-
-
-
-
-
if (silent_input) {
silent = true;
for (int i = 0; i < numsamples; i++)
@@ -396,8 +397,9 @@
}
+ @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 @@
}
}
+ @Override
public void processControlLogic() {
if (dirty) {
dirty = false;
@@ -504,7 +507,6 @@
combL[i].setDamp(damp);
combR[i].setDamp(damp);
}
-
}
public void setLightMode(boolean light)
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftShortMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSincResampler.java Mon Aug 15 20:08:55 2016 +0300
@@ -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 @@
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 @@
in_offset[0] = ix;
out_offset[0] = ox;
startpitch[0] = pitch;
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Mon Aug 15 20:08:55 2016 +0300
@@ -78,16 +78,17 @@
public SourceDataLine sourceDataLine = null;
public volatile long silent_samples = 0;
private int framesize = 0;
- private WeakReference<AudioInputStream> weak_stream_link;
- private AudioFloatConverter converter;
+ private final WeakReference<AudioInputStream> 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 @@
return 0;
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
if (read(b) == -1)
@@ -102,6 +104,7 @@
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 @@
SoftAudioPusher _pusher = pusher;
AudioInputStream _jitter_stream = jitter_stream;
SourceDataLine _sourceDataLine = sourceDataLine;
+ @Override
public void run()
{
_pusher.stop();
@@ -147,7 +151,7 @@
public WeakAudioStream(AudioInputStream stream) {
this.stream = stream;
- weak_stream_link = new WeakReference<AudioInputStream>(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 @@
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 @@
private SoftMainMixer mainmixer;
private SoftVoice[] voices;
- private Map<String, SoftTuning> tunings
- = new HashMap<String, SoftTuning>();
- private Map<String, SoftInstrument> inslist
- = new HashMap<String, SoftInstrument>();
- private Map<String, ModelInstrument> loadedlist
- = new HashMap<String, ModelInstrument>();
-
- private ArrayList<Receiver> recvslist = new ArrayList<Receiver>();
+ private final Map<String, SoftTuning> tunings = new HashMap<>();
+ private final Map<String, SoftInstrument> inslist = new HashMap<>();
+ private final Map<String, ModelInstrument> loadedlist = new HashMap<>();
+ private final ArrayList<Receiver> recvslist = new ArrayList<>();
private void getBuffers(ModelInstrument instrument,
List<ModelByteBuffer> buffers) {
@@ -264,7 +265,7 @@
private boolean loadSamples(List<ModelInstrument> instruments) {
if (largemode)
return true;
- List<ModelByteBuffer> buffers = new ArrayList<ModelByteBuffer>();
+ List<ModelByteBuffer> buffers = new ArrayList<>();
for (ModelInstrument instrument : instruments)
getBuffers(instrument, buffers);
try {
@@ -485,24 +486,28 @@
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 @@
}
}
+ @Override
public VoiceStatus[] getVoiceStatus() {
if (!isOpen()) {
VoiceStatus[] tempVoiceStatusArray
@@ -559,6 +565,7 @@
}
}
+ @Override
public boolean isSoundbankSupported(Soundbank soundbank) {
for (Instrument ins: soundbank.getInstruments())
if (!(ins instanceof ModelInstrument))
@@ -566,16 +573,18 @@
return true;
}
+ @Override
public boolean loadInstrument(Instrument instrument) {
if (instrument == null || (!(instrument instanceof ModelInstrument))) {
throw new IllegalArgumentException("Unsupported instrument: " +
instrument);
}
- List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
+ List<ModelInstrument> 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 @@
}
}
+ @Override
public boolean remapInstrument(Instrument from, Instrument to) {
if (from == null)
@@ -623,15 +633,16 @@
}
}
+ @Override
public Soundbank getDefaultSoundbank() {
synchronized (SoftSynthesizer.class) {
if (defaultSoundBank != null)
return defaultSoundBank;
- List<PrivilegedAction<InputStream>> actions =
- new ArrayList<PrivilegedAction<InputStream>>();
+ List<PrivilegedAction<InputStream>> actions = new ArrayList<>();
actions.add(new PrivilegedAction<InputStream>() {
+ @Override
public InputStream run() {
File javahome = new File(System.getProperties()
.getProperty("java.home"));
@@ -667,6 +678,7 @@
});
actions.add(new PrivilegedAction<InputStream>() {
+ @Override
public InputStream run() {
if (System.getProperties().getProperty("os.name")
.startsWith("Linux")) {
@@ -701,6 +713,7 @@
});
actions.add(new PrivilegedAction<InputStream>() {
+ @Override
public InputStream run() {
if (System.getProperties().getProperty("os.name")
.startsWith("Windows")) {
@@ -718,6 +731,7 @@
});
actions.add(new PrivilegedAction<InputStream>() {
+ @Override
public InputStream run() {
/*
* Try to load saved generated soundbank
@@ -798,6 +812,7 @@
return defaultSoundBank;
}
+ @Override
public Instrument[] getAvailableInstruments() {
Soundbank defsbk = getDefaultSoundbank();
if (defsbk == null)
@@ -807,6 +822,7 @@
return inslist_array;
}
+ @Override
public Instrument[] getLoadedInstruments() {
if (!isOpen())
return new Instrument[0];
@@ -820,8 +836,9 @@
}
}
+ @Override
public boolean loadAllInstruments(Soundbank soundbank) {
- List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
+ List<ModelInstrument> instruments = new ArrayList<>();
for (Instrument ins: soundbank.getInstruments()) {
if (ins == null || !(ins instanceof ModelInstrument)) {
throw new IllegalArgumentException(
@@ -832,6 +849,7 @@
return loadInstruments(instruments);
}
+ @Override
public void unloadAllInstruments(Soundbank soundbank) {
if (soundbank == null || !isSoundbankSupported(soundbank))
throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);
@@ -846,8 +864,9 @@
}
}
+ @Override
public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) {
- List<ModelInstrument> instruments = new ArrayList<ModelInstrument>();
+ List<ModelInstrument> instruments = new ArrayList<>();
for (Patch patch: patchList) {
Instrument ins = soundbank.getInstrument(patch);
if (ins == null || !(ins instanceof ModelInstrument)) {
@@ -859,6 +878,7 @@
return loadInstruments(instruments);
}
+ @Override
public void unloadInstruments(Soundbank soundbank, Patch[] patchList) {
if (soundbank == null || !isSoundbankSupported(soundbank))
throw new IllegalArgumentException("Unsupported soundbank: " + soundbank);
@@ -874,6 +894,7 @@
}
}
+ @Override
public MidiDevice.Info getDeviceInfo() {
return info;
}
@@ -901,9 +922,9 @@
});
}
+ @Override
public AudioSynthesizerPropertyInfo[] getPropertyInfo(Map<String, Object> info) {
- List<AudioSynthesizerPropertyInfo> list =
- new ArrayList<AudioSynthesizerPropertyInfo>();
+ List<AudioSynthesizerPropertyInfo> list = new ArrayList<>();
AudioSynthesizerPropertyInfo item;
@@ -1058,6 +1079,7 @@
return items;
}
+ @Override
public void open() throws MidiUnavailableException {
if (isOpen()) {
synchronized (control_mutex) {
@@ -1068,6 +1090,7 @@
open(null, null);
}
+ @Override
public void open(SourceDataLine line, Map<String, Object> info) throws MidiUnavailableException {
if (isOpen()) {
synchronized (control_mutex) {
@@ -1162,8 +1185,9 @@
}
}
+ @Override
public AudioInputStream openStream(AudioFormat targetFormat,
- Map<String, Object> info) throws MidiUnavailableException {
+ Map<String, Object> info) throws MidiUnavailableException {
if (isOpen())
throw new MidiUnavailableException("Synthesizer is already open");
@@ -1243,6 +1267,7 @@
}
}
+ @Override
public void close() {
if (!isOpen())
@@ -1301,12 +1326,14 @@
}
}
+ @Override
public boolean isOpen() {
synchronized (control_mutex) {
return open;
}
}
+ @Override
public long getMicrosecondPosition() {
if (!isOpen())
@@ -1317,14 +1344,17 @@
}
}
+ @Override
public int getMaxReceivers() {
return -1;
}
+ @Override
public int getMaxTransmitters() {
return 0;
}
+ @Override
public Receiver getReceiver() throws MidiUnavailableException {
synchronized (control_mutex) {
@@ -1335,25 +1365,29 @@
}
}
+ @Override
public List<Receiver> getReceivers() {
synchronized (control_mutex) {
- ArrayList<Receiver> recvs = new ArrayList<Receiver>();
+ ArrayList<Receiver> recvs = new ArrayList<>();
recvs.addAll(recvslist);
return recvs;
}
}
+ @Override
public Transmitter getTransmitter() throws MidiUnavailableException {
throw new MidiUnavailableException("No transmitter available");
}
+ @Override
public List<Transmitter> getTransmitters() {
- return new ArrayList<Transmitter>();
+ return new ArrayList<>();
}
+ @Override
public Receiver getReceiverReferenceCounting()
throws MidiUnavailableException {
@@ -1367,6 +1401,7 @@
return getReceiver();
}
+ @Override
public Transmitter getTransmitterReferenceCounting()
throws MidiUnavailableException {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftTuning.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftTuning.java Mon Aug 15 20:08:55 2016 +0300
@@ -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.UnsupportedEncodingException;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftVoice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftVoice.java Mon Aug 15 20:08:55 2016 +0300
@@ -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;
@@ -63,8 +64,7 @@
private final SoftFilter filter_right;
private final SoftProcess eg = new SoftEnvelopeGenerator();
private final SoftProcess lfo = new SoftLowFrequencyOscillator();
- Map<String, SoftControl> objects =
- new HashMap<String, SoftControl>();
+ final Map<String, SoftControl> objects = new HashMap<>();
SoftSynthesizer synthesizer;
SoftInstrument instrument;
SoftPerformer performer;
@@ -107,6 +107,7 @@
double[] keynumber = co_noteon_keynumber;
double[] velocity = co_noteon_velocity;
double[] on = co_noteon_on;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -126,12 +127,13 @@
private final double[] co_mixer_reverb = new double[1];
private final double[] co_mixer_chorus = new double[1];
private final SoftControl co_mixer = new SoftControl() {
- double[] active = co_mixer_active;
- double[] gain = co_mixer_gain;
- double[] pan = co_mixer_pan;
- double[] balance = co_mixer_balance;
- double[] reverb = co_mixer_reverb;
- double[] chorus = co_mixer_chorus;
+ final double[] active = co_mixer_active;
+ final double[] gain = co_mixer_gain;
+ final double[] pan = co_mixer_pan;
+ final double[] balance = co_mixer_balance;
+ final double[] reverb = co_mixer_reverb;
+ final double[] chorus = co_mixer_chorus;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -152,7 +154,8 @@
};
private final double[] co_osc_pitch = new double[1];
private final SoftControl co_osc = new SoftControl() {
- double[] pitch = co_osc_pitch;
+ final double[] pitch = co_osc_pitch;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -165,9 +168,10 @@
private final double[] co_filter_type = new double[1];
private final double[] co_filter_q = new double[1];
private final SoftControl co_filter = new SoftControl() {
- double[] freq = co_filter_freq;
- double[] ftype = co_filter_type;
- double[] q = co_filter_q;
+ final double[] freq = co_filter_freq;
+ final double[] ftype = co_filter_type;
+ final double[] q = co_filter_q;
+ @Override
public double[] get(int instance, String name) {
if (name == null)
return null;
@@ -913,6 +917,5 @@
if (out_mixer_end) {
stopping = true;
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -57,6 +57,7 @@
private static final int bisBufferSize = 1024; // buffer size in buffered input streams
+ @Override
public MidiFileFormat getMidiFileFormat(InputStream stream)
throws InvalidMidiDataException, IOException {
return getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, null);
@@ -143,7 +144,7 @@
return format;
}
-
+ @Override
public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException {
InputStream urlStream = url.openStream(); // throws IOException
BufferedInputStream bis = new BufferedInputStream( urlStream, bisBufferSize );
@@ -156,7 +157,7 @@
return fileFormat;
}
-
+ @Override
public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException {
FileInputStream fis = new FileInputStream(file); // throws IOException
BufferedInputStream bis = new BufferedInputStream(fis, bisBufferSize);
@@ -175,7 +176,7 @@
return fileFormat;
}
-
+ @Override
public Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException {
SMFParser smfParser = new SMFParser();
MidiFileFormat format = getMidiFileFormatFromStream(stream,
@@ -201,8 +202,7 @@
return sequence;
}
-
-
+ @Override
public Sequence getSequence(URL url) throws InvalidMidiDataException, IOException {
InputStream is = url.openStream(); // throws IOException
is = new BufferedInputStream(is, bisBufferSize);
@@ -215,7 +215,7 @@
return seq;
}
-
+ @Override
public Sequence getSequence(File file) throws InvalidMidiDataException, IOException {
InputStream is = new FileInputStream(file); // throws IOException
is = new BufferedInputStream(is, bisBufferSize);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileWriter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileWriter.java Mon Aug 15 20:08:55 2016 +0300
@@ -47,7 +47,6 @@
import javax.sound.midi.Track;
import javax.sound.midi.spi.MidiFileWriter;
-
/**
* MIDI file writer.
*
@@ -72,20 +71,15 @@
private static final int bufferSize = 16384; // buffersize for write
private DataOutputStream tddos; // data output stream for track writing
-
-
/**
- * MIDI parser types
+ * MIDI parser types.
*/
private static final int types[] = {
MIDI_TYPE_0,
MIDI_TYPE_1
};
-
- /**
- * new
- */
+ @Override
public int[] getMidiFileTypes() {
int[] localArray = new int[types.length];
System.arraycopy(types, 0, localArray, 0, types.length);
@@ -100,6 +94,7 @@
* @return array of file types. If no file types are supported,
* returns an array of length 0.
*/
+ @Override
public int[] getMidiFileTypes(Sequence sequence){
int typesArray[];
Track tracks[] = sequence.getTracks();
@@ -116,6 +111,7 @@
return typesArray;
}
+ @Override
public int write(Sequence in, int type, OutputStream out) throws IOException {
Objects.requireNonNull(out);
if (!isFileTypeSupported(type, in)) {
@@ -141,6 +137,7 @@
return (int) bytesWritten;
}
+ @Override
public int write(Sequence in, int type, File out) throws IOException {
Objects.requireNonNull(in);
FileOutputStream fos = new FileOutputStream(out); // throws IOException
@@ -151,7 +148,6 @@
//=================================================================================
-
private InputStream getFileStream(int type, Sequence sequence) throws IOException {
Track tracks[] = sequence.getTracks();
int bytesBuilt = 0;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunCodec.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunCodec.java Mon Aug 15 20:08:55 2016 +0300
@@ -55,16 +55,14 @@
this.outputEncodings = outputEncodings;
}
-
- /**
- */
+ @Override
public final AudioFormat.Encoding[] getSourceEncodings() {
AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[inputEncodings.length];
System.arraycopy(inputEncodings, 0, encodings, 0, inputEncodings.length);
return encodings;
}
- /**
- */
+
+ @Override
public final AudioFormat.Encoding[] getTargetEncodings() {
AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[outputEncodings.length];
System.arraycopy(outputEncodings, 0, encodings, 0, outputEncodings.length);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java Mon Aug 15 20:08:55 2016 +0300
@@ -39,17 +39,14 @@
*/
abstract class SunFileWriter extends AudioFileWriter {
-
// buffer size for write
protected static final int bufferSize = 16384;
// buffer size for temporary input streams
protected static final int bisBufferSize = 4096;
-
final AudioFileFormat.Type types[];
-
/**
* Constructs a new SunParser object.
*/
@@ -57,12 +54,9 @@
this.types = types;
}
-
-
// METHODS TO IMPLEMENT AudioFileWriter
- // new, 10.27.99
-
+ @Override
public final AudioFileFormat.Type[] getAudioFileTypes(){
AudioFileFormat.Type[] localArray = new AudioFileFormat.Type[types.length];
System.arraycopy(types, 0, localArray, 0, types.length);
@@ -71,7 +65,6 @@
// HELPER METHODS
-
/**
* rllong
* Protected helper method to read 64 bits and changing the order of
@@ -213,6 +206,5 @@
public boolean markSupported() {
return in.markSupported();
}
-
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java Mon Aug 15 20:08:55 2016 +0300
@@ -52,7 +52,6 @@
}
}
-
/**
* Swaps bytes.
* @throws ArrayOutOfBoundsException if len is not a multiple of 2.
@@ -68,7 +67,6 @@
}
}
-
/**
* Linear to DB scale conversion.
*/
@@ -78,7 +76,6 @@
return dB;
}
-
/**
* DB to linear scale conversion.
*/
@@ -108,7 +105,6 @@
return bytes - (bytes % blockSize);
}
-
/*
* gets the number of bytes needed to play the specified number of milliseconds
*/
@@ -188,7 +184,6 @@
}
}
-
static boolean isFullySpecifiedPCMFormat(AudioFormat format) {
if (!format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)
&& !format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
@@ -204,7 +199,6 @@
return true;
}
-
public static AudioInputStream getPCMConvertedAudioInputStream(AudioInputStream ais) {
// we can't open the device for non-PCM playback, so we have
// convert any other encodings to PCM here (at least we try!)
@@ -231,5 +225,4 @@
return ais;
}
-
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/UlawCodec.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/UlawCodec.java Mon Aug 15 20:08:55 2016 +0300
@@ -33,7 +33,6 @@
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-
/**
* U-law encodes linear data, and decodes u-law data to linear data.
*
@@ -53,7 +52,7 @@
0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF};
/**
- * Initializes the decode tables
+ * Initializes the decode tables.
*/
static {
for (int i=0;i<256;i++) {
@@ -70,7 +69,6 @@
}
}
-
/**
* Constructs a new ULAW codec object.
*/
@@ -78,8 +76,7 @@
super(ulawEncodings, ulawEncodings);
}
- /**
- */
+ @Override
public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat){
if( AudioFormat.Encoding.PCM_SIGNED.equals(sourceFormat.getEncoding()) ) {
if( sourceFormat.getSampleSizeInBits() == 16 ) {
@@ -102,9 +99,7 @@
}
}
-
- /**
- */
+ @Override
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
Objects.requireNonNull(targetEncoding);
Objects.requireNonNull(sourceFormat);
@@ -119,8 +114,7 @@
}
}
- /**
- */
+ @Override
public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream){
AudioFormat sourceFormat = sourceStream.getFormat();
AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding();
@@ -157,9 +151,7 @@
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: "
@@ -168,9 +160,6 @@
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
@@ -179,7 +168,6 @@
* @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;
@@ -188,7 +176,7 @@
if( inputFormat.matches(outputFormat) ) {
cs = stream;
} else {
- cs = (AudioInputStream) (new UlawCodecStream(stream, outputFormat));
+ cs = new UlawCodecStream(stream, outputFormat);
}
return cs;
}
@@ -200,7 +188,6 @@
* returns an array of length 0.
* @return array of supported output formats.
*/
- /* public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
Vector<AudioFormat> formats = new Vector<>();
@@ -241,14 +228,13 @@
return formatArray;
}
-
private final class UlawCodecStream extends AudioInputStream {
private static final int tempBufferSize = 64;
private byte tempBuffer [] = null;
/**
- * True to encode to u-law, false to decode to linear
+ * True to encode to u-law, false to decode to linear.
*/
boolean encode = false;
@@ -312,7 +298,6 @@
}
}
-
/*
* $$jb 2/23/99
* Used to determine segment number in uLaw encoding
@@ -328,6 +313,7 @@
* 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];
if (read(b, 0, b.length) == 1) {
@@ -336,10 +322,12 @@
return -1;
}
+ @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
if( len%frameSize != 0 ) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java Mon Aug 15 20:08:55 2016 +0300
@@ -43,7 +43,7 @@
*/
public final class WaveExtensibleFileReader extends SunFileReader {
- private static class GUID {
+ private static final class GUID {
private long i1;
private int s1;
private int s2;
@@ -222,7 +222,7 @@
if (!fmt_found || !data_found) {
throw new UnsupportedAudioFileException();
}
- Map<String, Object> p = new HashMap<String, Object>();
+ Map<String, Object> p = new HashMap<>();
String s_channelmask = decodeChannelMask(channelMask);
if (s_channelmask != null)
p.put("channelOrder", s_channelmask);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java Mon Aug 15 20:08:55 2016 +0300
@@ -46,7 +46,7 @@
//$$fb 2002-04-16: Fix for 4636355: RIFF audio headers could be _more_ spec compliant
/**
- * fmt_ chunk size in bytes
+ * fmt_ chunk size in bytes.
*/
private static final int STANDARD_FMT_CHUNK_SIZE = 16;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileWriter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileWriter.java Mon Aug 15 20:08:55 2016 +0300
@@ -80,7 +80,6 @@
return new AudioFileFormat.Type[0];
}
-
@Override
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
Objects.requireNonNull(stream);
@@ -104,7 +103,6 @@
return writeWaveFile(stream, waveFileFormat, out);
}
-
@Override
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
Objects.requireNonNull(stream);
@@ -257,7 +255,7 @@
int sampleRate = (int) audioFormat.getSampleRate();
int frameSizeInBytes = audioFormat.getFrameSize();
int frameRate = (int) audioFormat.getFrameRate();
- int avgBytesPerSec = channels * sampleSizeInBits * sampleRate / 8;;
+ int avgBytesPerSec = channels * sampleSizeInBits * sampleRate / 8;
short blockAlign = (short) ((sampleSizeInBits / 8) * channels);
int dataMagic = WaveFileFormat.DATA_MAGIC;
int dataLength = waveFileFormat.getFrameLength() * frameSizeInBytes;
@@ -347,6 +345,6 @@
waveStream = new SequenceInputStream(headerStream,
new NoCloseInputStream(codedAudioStream));
- return (InputStream)waveStream;
+ return waveStream;
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileWriter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileWriter.java Mon Aug 15 20:08:55 2016 +0300
@@ -89,7 +89,7 @@
data_chunk.close();
}
- private static class NoCloseOutputStream extends OutputStream {
+ private static final class NoCloseOutputStream extends OutputStream {
final OutputStream out;
NoCloseOutputStream(OutputStream out) {
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -195,6 +195,7 @@
*
* @return a clone of this instance
*/
+ @Override
public Object clone() {
byte[] newData = new byte[length];
System.arraycopy(data, 0, newData, 0, newData.length);
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java Mon Aug 15 20:08:55 2016 +0300
@@ -134,6 +134,7 @@
* @see #open
* @see #isOpen
*/
+ @Override
void close();
/**
@@ -252,22 +253,22 @@
/**
* The device's name.
*/
- private String name;
+ private final String name;
/**
* The name of the company who provides the device.
*/
- private String vendor;
+ private final String vendor;
/**
* A description of the device.
*/
- private String description;
+ private final String description;
/**
* Device version.
*/
- private String version;
+ private final String version;
/**
* Constructs a device info object.
@@ -294,6 +295,7 @@
* @return {@code true} if this object is the same as the {@code obj}
* argument; {@code false} otherwise
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
@@ -301,6 +303,7 @@
/**
* Finalizes the hashcode method.
*/
+ @Override
public final int hashCode() {
return super.hashCode();
}
@@ -346,6 +349,7 @@
*
* @return a description of the info object
*/
+ @Override
public final String toString() {
return name;
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java Mon Aug 15 20:08:55 2016 +0300
@@ -180,7 +180,7 @@
int resolution, int bytes,
long microseconds, Map<String, Object> properties) {
this(type, divisionType, resolution, bytes, microseconds);
- this.properties = new HashMap<String, Object>(properties);
+ this.properties = new HashMap<>(properties);
}
/**
@@ -257,7 +257,7 @@
public Map<String,Object> properties() {
Map<String,Object> ret;
if (properties == null) {
- ret = new HashMap<String,Object>(0);
+ ret = new HashMap<>(0);
} else {
ret = (Map<String,Object>) (properties.clone());
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -177,5 +177,6 @@
*
* @return a clone of this instance
*/
+ @Override
public abstract Object clone();
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java Mon Aug 15 20:08:55 2016 +0300
@@ -66,5 +66,6 @@
*
* @see javax.sound.midi.MidiSystem#getReceiver
*/
+ @Override
void close();
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java Mon Aug 15 20:08:55 2016 +0300
@@ -118,7 +118,7 @@
*
* @see #getTracks
*/
- protected Vector<Track> tracks = new Vector<Track>();
+ protected Vector<Track> tracks = new Vector<>();
/**
* Constructs a new MIDI sequence with the specified timing division type
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java Mon Aug 15 20:08:55 2016 +0300
@@ -324,6 +324,7 @@
* @return the current position in microseconds
* @see #setMicrosecondPosition
*/
+ @Override
long getMicrosecondPosition();
/**
@@ -680,7 +681,7 @@
/**
* Synchronization mode name.
*/
- private String name;
+ private final String name;
/**
* Constructs a synchronization mode.
@@ -700,6 +701,7 @@
* @return {@code true} if this object is the same as the {@code obj}
* argument, {@code false} otherwise
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
@@ -708,6 +710,7 @@
/**
* Finalizes the hashcode method.
*/
+ @Override
public final int hashCode() {
return super.hashCode();
@@ -719,6 +722,7 @@
*
* @return the name of this synchronization mode
*/
+ @Override
public final String toString() {
return name;
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -429,6 +429,7 @@
*
* @return a clone of this instance
*/
+ @Override
public Object clone() {
byte[] newData = new byte[length];
System.arraycopy(data, 0, newData, 0, newData.length);
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java Mon Aug 15 20:08:55 2016 +0300
@@ -179,6 +179,7 @@
* @param length the length of the valid message data in the array,
* including the status byte
*/
+ @Override
public void setMessage(byte[] data, int length) throws InvalidMidiDataException {
int status = (data[0] & 0xFF);
if ((status != 0xF0) && (status != 0xF7)) {
@@ -233,6 +234,7 @@
*
* @return a clone of this instance
*/
+ @Override
public Object clone() {
byte[] newData = new byte[length];
System.arraycopy(data, 0, newData, 0, newData.length);
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java Mon Aug 15 20:08:55 2016 +0300
@@ -65,12 +65,12 @@
// TODO: use arrays for faster access
// the list containing the events
- private ArrayList<MidiEvent> eventsList = new ArrayList<>();
+ private final ArrayList<MidiEvent> eventsList = new ArrayList<>();
// use a hashset to detect duplicate events in add(MidiEvent)
- private HashSet<MidiEvent> set = new HashSet<>();
+ private final HashSet<MidiEvent> set = new HashSet<>();
- private MidiEvent eotEvent;
+ private final MidiEvent eotEvent;
/**
* Package-private constructor. Constructs a new, empty Track object, which
@@ -264,6 +264,7 @@
data[2] = 0;
}
+ @Override
public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException {
throw new InvalidMidiDataException("cannot modify end of track message");
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java Mon Aug 15 20:08:55 2016 +0300
@@ -69,5 +69,6 @@
*
* @see javax.sound.midi.MidiSystem#getTransmitter
*/
+ @Override
void close();
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java Mon Aug 15 20:08:55 2016 +0300
@@ -100,22 +100,22 @@
/**
* File type.
*/
- private Type type;
+ private final Type type;
/**
* File length in bytes.
*/
- private int byteLength;
+ private final int byteLength;
/**
* Format of the audio data contained in the file.
*/
- private AudioFormat format;
+ private final AudioFormat format;
/**
* Audio data length in sample frames.
*/
- private int frameLength;
+ private final int frameLength;
/**
* The set of properties.
@@ -176,7 +176,7 @@
public AudioFileFormat(Type type, AudioFormat format,
int frameLength, Map<String, Object> properties) {
this(type,AudioSystem.NOT_SPECIFIED,format,frameLength);
- this.properties = new HashMap<String, Object>(properties);
+ this.properties = new HashMap<>(properties);
}
/**
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Mon Aug 15 20:08:55 2016 +0300
@@ -223,7 +223,7 @@
boolean bigEndian, Map<String, Object> properties) {
this(encoding, sampleRate, sampleSizeInBits, channels,
frameSize, frameRate, bigEndian);
- this.properties = new HashMap<String, Object>(properties);
+ this.properties = new HashMap<>(properties);
}
/**
@@ -592,7 +592,7 @@
/**
* Encoding name.
*/
- private String name;
+ private final String name;
/**
* Constructs a new encoding.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java Mon Aug 15 20:08:55 2016 +0300
@@ -60,7 +60,7 @@
* The {@code InputStream} from which this {@code AudioInputStream} object
* was constructed.
*/
- private InputStream stream;
+ private final InputStream stream;
/**
* The format of the audio data contained in the stream.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java Mon Aug 15 20:08:55 2016 +0300
@@ -38,7 +38,7 @@
/**
* The set of member controls.
*/
- private Control[] controls;
+ private final Control[] controls;
/**
* Constructs a new compound control object with the given parameters.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java Mon Aug 15 20:08:55 2016 +0300
@@ -84,7 +84,7 @@
/**
* Type name.
*/
- private String name;
+ private final String name;
/**
* Constructs a new control type with the name specified. The name
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/EnumControl.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/EnumControl.java Mon Aug 15 20:08:55 2016 +0300
@@ -53,7 +53,7 @@
/**
* The set of possible values.
*/
- private Object[] values;
+ private final Object[] values;
/**
* The current value.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java Mon Aug 15 20:08:55 2016 +0300
@@ -54,23 +54,23 @@
/**
* The minimum supported value.
*/
- private float minimum;
+ private final float minimum;
/**
* The maximum supported value.
*/
- private float maximum;
+ private final float maximum;
/**
* The control's precision.
*/
- private float precision;
+ private final float precision;
/**
* The smallest time increment in which a value change can be effected
* during a value shift, in microseconds.
*/
- private int updatePeriod;
+ private final int updatePeriod;
/**
* A label for the units in which the control values are expressed, such as
@@ -334,6 +334,7 @@
*
* @return a string description
*/
+ @Override
public String toString() {
return new String(getType() + " with current value: " + getValue() + " " + units +
" (range: " + minimum + " - " + maximum + ")");
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java Mon Aug 15 20:08:55 2016 +0300
@@ -169,8 +169,7 @@
/**
* Type name.
*/
- // $$kk: 03.25.99: why can't this be final??
- private /*final*/ String name;
+ private final String name;
/**
* Constructs a new event type.
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java Mon Aug 15 20:08:55 2016 +0300
@@ -56,10 +56,8 @@
*/
class Info extends Line.Info {
-
// AUDIO PORT TYPE DEFINES
-
// SOURCE PORTS
/**
@@ -78,7 +76,6 @@
*/
public static final Info COMPACT_DISC = new Info(Port.class,"COMPACT_DISC", true);
-
// TARGET PORTS
/**
@@ -97,18 +94,14 @@
*/
public static final Info LINE_OUT = new Info(Port.class,"LINE_OUT", false);
-
// FUTURE DIRECTIONS...
// telephone
// DAT
// DVD
-
- // INSTANCE VARIABLES
-
- private String name;
- private boolean isSource;
+ private final String name;
+ private final boolean isSource;
/**
* Constructs a port's info object from the information given. This
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Fri Aug 12 14:35:56 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Mon Aug 15 20:08:55 2016 +0300
@@ -139,32 +139,32 @@
/**
* Descriptive name of the reverb type.
*/
- private String name;
+ private final String name;
/**
* Early reflection delay in microseconds.
*/
- private int earlyReflectionDelay;
+ private final int earlyReflectionDelay;
/**
* Early reflection intensity.
*/
- private float earlyReflectionIntensity;
+ private final float earlyReflectionIntensity;
/**
* Late reflection delay in microseconds.
*/
- private int lateReflectionDelay;
+ private final int lateReflectionDelay;
/**
* Late reflection intensity.
*/
- private float lateReflectionIntensity;
+ private final float lateReflectionIntensity;
/**
* Total decay time.
*/
- private int decayTime;
+ private final int decayTime;
/**
* Constructs a new reverb type that has the specified reverberation