8006328: Improve robustness of sound classes
8009057: Improve MIDI event handling
Reviewed-by: amenkov, art, skoivu
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractDataLine.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractDataLine.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,15 +25,12 @@
package com.sun.media.sound;
-import java.util.Vector;
-
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Control;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.Mixer;
/**
@@ -46,13 +43,13 @@
// DEFAULTS
// default format
- protected /*final*/ AudioFormat defaultFormat;
+ private final AudioFormat defaultFormat;
// default buffer size in bytes
- protected /*final*/ int defaultBufferSize;
+ private final int defaultBufferSize;
// the lock for synchronization
- protected Object lock = new Object();
+ protected final Object lock = new Object();
// STATE
@@ -103,7 +100,7 @@
// DATA LINE METHODS
- public void open(AudioFormat format, int bufferSize) throws LineUnavailableException {
+ public final void open(AudioFormat format, int bufferSize) throws LineUnavailableException {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized (mixer) {
if (Printer.trace) Printer.trace("> AbstractDataLine.open(format, bufferSize) (class: "+getClass().getName());
@@ -152,7 +149,7 @@
}
- public void open(AudioFormat format) throws LineUnavailableException {
+ public final void open(AudioFormat format) throws LineUnavailableException {
open(format, AudioSystem.NOT_SPECIFIED);
}
@@ -181,7 +178,7 @@
}
- public void start() {
+ public final void start() {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized(mixer) {
if (Printer.trace) Printer.trace("> "+getClass().getName()+".start() - AbstractDataLine");
@@ -205,7 +202,7 @@
}
- public void stop() {
+ public final void stop() {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized(mixer) {
@@ -249,16 +246,16 @@
// in MixerSourceLine and MixerClip, and I want to touch as little
// code as possible to change isStarted() back to isRunning().
- public boolean isRunning() {
+ public final boolean isRunning() {
return started;
}
- public boolean isActive() {
+ public final boolean isActive() {
return active;
}
- public long getMicrosecondPosition() {
+ public final long getMicrosecondPosition() {
long microseconds = getLongFramePosition();
if (microseconds != AudioSystem.NOT_SPECIFIED) {
@@ -268,26 +265,26 @@
}
- public AudioFormat getFormat() {
+ public final AudioFormat getFormat() {
return format;
}
- public int getBufferSize() {
+ public final int getBufferSize() {
return bufferSize;
}
/**
* This implementation does NOT change the buffer size
*/
- public int setBufferSize(int newSize) {
+ public final int setBufferSize(int newSize) {
return getBufferSize();
}
/**
* This implementation returns AudioSystem.NOT_SPECIFIED.
*/
- public float getLevel() {
+ public final float getLevel() {
return (float)AudioSystem.NOT_SPECIFIED;
}
@@ -304,7 +301,7 @@
// it to isStartedRunning(). This is part of backing out the
// change denied in RFE 4297981.
- protected boolean isStartedRunning() {
+ final boolean isStartedRunning() {
return running;
}
@@ -312,7 +309,7 @@
* This method sets the active state and generates
* events if it changes.
*/
- protected void setActive(boolean active) {
+ final void setActive(boolean active) {
if (Printer.trace) Printer.trace("> AbstractDataLine: setActive(" + active + ")");
@@ -351,7 +348,7 @@
* This method sets the started state and generates
* events if it changes.
*/
- protected void setStarted(boolean started) {
+ final void setStarted(boolean started) {
if (Printer.trace) Printer.trace("> AbstractDataLine: setStarted(" + started + ")");
@@ -388,7 +385,7 @@
* This method generates a STOP event and sets the started state to false.
* It is here for historic reasons when an EOM event existed.
*/
- protected void setEOM() {
+ final void setEOM() {
if (Printer.trace) Printer.trace("> AbstractDataLine: setEOM()");
//$$fb 2002-04-21: sometimes, 2 STOP events are generated.
@@ -408,7 +405,7 @@
* line is open, this should return quietly because the values
* requested will match the current ones.
*/
- public void open() throws LineUnavailableException {
+ public final void open() throws LineUnavailableException {
if (Printer.trace) Printer.trace("> "+getClass().getName()+".open() - AbstractDataLine");
@@ -422,7 +419,7 @@
* 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.
*/
- public void close() {
+ public final void close() {
//$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
synchronized (mixer) {
if (Printer.trace) Printer.trace("> "+getClass().getName()+".close() - in AbstractDataLine.");
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,12 @@
package com.sun.media.sound;
+import java.util.Map;
import java.util.Vector;
+import java.util.WeakHashMap;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Control;
-import javax.sound.sampled.Mixer;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
@@ -43,28 +44,17 @@
*/
abstract class AbstractLine implements Line {
- protected Line.Info info;
+ protected final Line.Info info;
protected Control[] controls;
- protected AbstractMixer mixer;
+ AbstractMixer mixer;
private boolean open = false;
- private Vector listeners = new Vector();
+ private final Vector listeners = new Vector();
/**
- * Global event thread
+ * Contains event dispatcher per thread group.
*/
- private static final EventDispatcher eventDispatcher;
-
- static {
- // create and start the global event thread
-
- // $$kk: 12.21.98:
- // 1) probably don't want a single global event queue
- // 2) need a way to stop this thread when the engine is done
-
- eventDispatcher = new EventDispatcher();
- eventDispatcher.start();
- }
-
+ private static final Map<ThreadGroup, EventDispatcher> dispatchers =
+ new WeakHashMap<>();
/**
* Constructs a new AbstractLine.
@@ -85,18 +75,17 @@
// LINE METHODS
- public Line.Info getLineInfo() {
+ public final Line.Info getLineInfo() {
return info;
}
- public boolean isOpen() {
+ public final boolean isOpen() {
return open;
}
- public void addLineListener(LineListener listener) {
-
+ public final void addLineListener(LineListener listener) {
synchronized(listeners) {
if ( ! (listeners.contains(listener)) ) {
listeners.addElement(listener);
@@ -109,7 +98,7 @@
* Removes an audio listener.
* @param listener listener to remove
*/
- public void removeLineListener(LineListener listener) {
+ public final void removeLineListener(LineListener listener) {
listeners.removeElement(listener);
}
@@ -120,8 +109,7 @@
* array of length 0.
* @return control set
*/
- public Control[] getControls() {
-
+ public final Control[] getControls() {
Control[] returnedArray = new Control[controls.length];
for (int i = 0; i < controls.length; i++) {
@@ -132,8 +120,7 @@
}
- public boolean isControlSupported(Control.Type controlType) {
-
+ public final boolean isControlSupported(Control.Type controlType) {
// protect against a NullPointerException
if (controlType == null) {
return false;
@@ -149,8 +136,7 @@
}
- public Control getControl(Control.Type controlType) {
-
+ public final Control getControl(Control.Type controlType) {
// protect against a NullPointerException
if (controlType != null) {
@@ -172,7 +158,7 @@
* This method sets the open state and generates
* events if it changes.
*/
- protected void setOpen(boolean open) {
+ final void setOpen(boolean open) {
if (Printer.trace) Printer.trace("> "+getClass().getName()+" (AbstractLine): setOpen(" + open + ") this.open: " + this.open);
@@ -200,8 +186,8 @@
/**
* Send line events.
*/
- protected void sendEvents(LineEvent event) {
- eventDispatcher.sendAudioEvents(event, listeners);
+ final void sendEvents(LineEvent event) {
+ getEventDispatcher().sendAudioEvents(event, listeners);
}
@@ -227,12 +213,23 @@
// $$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!!
- protected AbstractMixer getMixer() {
+ final AbstractMixer getMixer() {
return mixer;
}
- protected EventDispatcher getEventDispatcher() {
- return eventDispatcher;
+ final EventDispatcher getEventDispatcher() {
+ // create and start the global event thread
+ //TODO need a way to stop this thread when the engine is done
+ final ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ synchronized (dispatchers) {
+ EventDispatcher eventDispatcher = dispatchers.get(tg);
+ if (eventDispatcher == null) {
+ eventDispatcher = new EventDispatcher();
+ dispatchers.put(tg, eventDispatcher);
+ eventDispatcher.start();
+ }
+ return eventDispatcher;
+ }
}
// ABSTRACT METHODS
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,12 +60,12 @@
// DEVICE ATTRIBUTES
- private MidiDevice.Info info;
+ private final MidiDevice.Info info;
// DEVICE STATE
- protected /*private*/ boolean open = false;
+ private boolean open = false;
private int openRefCount;
/** List of Receivers and Transmitters that opened the device implicitely.
@@ -102,7 +102,7 @@
// MIDI DEVICE METHODS
- public MidiDevice.Info getDeviceInfo() {
+ public final MidiDevice.Info getDeviceInfo() {
return info;
}
@@ -111,7 +111,7 @@
* opened the the device implicitly from closing it. The only way to close the device after
* this call is a call to close().
*/
- public void open() throws MidiUnavailableException {
+ public final void open() throws MidiUnavailableException {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: open()");
synchronized(this) {
openRefCount = -1;
@@ -159,7 +159,7 @@
}
- public void close() {
+ public final void close() {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: close()");
synchronized (this) {
doClose();
@@ -181,7 +181,7 @@
* @param object The object that might have been opening the device implicitely (for now,
* this may be a Transmitter or receiver).
*/
- public void closeInternal(Object object) {
+ public final void closeInternal(Object object) {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: closeInternal()");
synchronized(this) {
if (getOpenKeepingObjects().remove(object)) {
@@ -197,7 +197,7 @@
}
- public void doClose() {
+ public final void doClose() {
if (Printer.trace) Printer.trace("> AbstractMidiDevice: doClose()");
synchronized(this) {
if (isOpen()) {
@@ -209,7 +209,7 @@
}
- public boolean isOpen() {
+ public final boolean isOpen() {
return open;
}
@@ -329,7 +329,7 @@
// HELPER METHODS
- long getId() {
+ final long getId() {
return id;
}
@@ -339,7 +339,8 @@
/** Retrieve a Receiver and open the device implicitly.
This method is called by MidiSystem.getReceiver().
*/
- public Receiver getReceiverReferenceCounting() throws MidiUnavailableException {
+ public final Receiver getReceiverReferenceCounting()
+ throws MidiUnavailableException {
/* Keep this order of commands! If getReceiver() throws an exception,
openInternal() should not be called!
*/
@@ -355,7 +356,8 @@
/** Retrieve a Transmitter and open the device implicitly.
This method is called by MidiSystem.getTransmitter().
*/
- public Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException {
+ public final Transmitter getTransmitterReferenceCounting()
+ throws MidiUnavailableException {
/* Keep this order of commands! If getTransmitter() throws an exception,
openInternal() should not be called!
*/
@@ -422,7 +424,7 @@
/** Return the internal list of Transmitters, possibly creating it first.
*/
- protected TransmitterList getTransmitterList() {
+ final TransmitterList getTransmitterList() {
synchronized (traRecLock) {
if (transmitterList == null) {
transmitterList = new TransmitterList();
@@ -462,7 +464,7 @@
/**
* close this device if discarded by the garbage collector
*/
- protected void finalize() {
+ protected final void finalize() {
close();
}
@@ -534,7 +536,7 @@
* Also, it has some optimizations regarding sending to the Receivers,
* for known Receivers, and managing itself in the TransmitterList.
*/
- protected class BasicTransmitter implements MidiDeviceTransmitter {
+ class BasicTransmitter implements MidiDeviceTransmitter {
private Receiver receiver = null;
TransmitterList tlist = null;
@@ -546,7 +548,7 @@
this.tlist = tlist;
}
- public void setReceiver(Receiver receiver) {
+ public final void setReceiver(Receiver receiver) {
if (tlist != null && this.receiver != receiver) {
if (Printer.debug) Printer.debug("Transmitter "+toString()+": set receiver "+receiver);
tlist.receiverChanged(this, this.receiver, receiver);
@@ -554,7 +556,7 @@
}
}
- public Receiver getReceiver() {
+ public final Receiver getReceiver() {
return receiver;
}
@@ -564,7 +566,7 @@
* Therefore, subclasses that override this method must call
* 'super.close()'.
*/
- public void close() {
+ public final void close() {
AbstractMidiDevice.this.closeInternal(this);
if (tlist != null) {
tlist.receiverChanged(this, this.receiver, null);
@@ -573,7 +575,7 @@
}
}
- public MidiDevice getMidiDevice() {
+ public final MidiDevice getMidiDevice() {
return AbstractMidiDevice.this;
}
@@ -583,9 +585,9 @@
/**
* a class to manage a list of transmitters
*/
- class TransmitterList {
+ final class TransmitterList {
- private ArrayList<Transmitter> transmitters = new ArrayList<Transmitter>();
+ private final ArrayList<Transmitter> transmitters = new ArrayList<Transmitter>();
private MidiOutDevice.MidiOutReceiver midiOutReceiver;
// how many transmitters must be present for optimized
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDeviceProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
*/
public abstract class AbstractMidiDeviceProvider extends MidiDeviceProvider {
- private static boolean enabled;
+ private static final boolean enabled;
/**
* Create objects representing all MIDI output devices on the system.
@@ -52,7 +52,7 @@
}
- synchronized void readDeviceInfos() {
+ final synchronized void readDeviceInfos() {
Info[] infos = getInfoCache();
MidiDevice[] devices = getDeviceCache();
if (!enabled) {
@@ -118,7 +118,7 @@
}
- public MidiDevice.Info[] getDeviceInfo() {
+ public final MidiDevice.Info[] getDeviceInfo() {
readDeviceInfos();
Info[] infos = getInfoCache();
MidiDevice.Info[] localArray = new MidiDevice.Info[infos.length];
@@ -127,7 +127,7 @@
}
- public MidiDevice getDevice(MidiDevice.Info info) {
+ public final MidiDevice getDevice(MidiDevice.Info info) {
if (info instanceof Info) {
readDeviceInfos();
MidiDevice[] devices = getDeviceCache();
@@ -164,7 +164,7 @@
this.index = index;
}
- boolean equalStrings(Info info) {
+ final boolean equalStrings(Info info) {
return (info != null
&& getName().equals(info.getName())
&& getVendor().equals(info.getVendor())
@@ -172,11 +172,11 @@
&& getVersion().equals(info.getVersion()));
}
- int getIndex() {
+ final int getIndex() {
return index;
}
- void setIndex(int index) {
+ final void setIndex(int index) {
this.index = index;
}
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,9 @@
import java.util.Vector;
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Control;
-import javax.sound.sampled.DataLine;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.Line;
-import javax.sound.sampled.LineEvent;
-import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
/**
@@ -95,13 +90,13 @@
/**
* Source lines (ports) currently open
*/
- protected Vector sourceLines = new Vector();
+ private final Vector sourceLines = new Vector();
/**
* Target lines currently open.
*/
- protected Vector targetLines = new Vector();
+ private final Vector targetLines = new Vector();
/**
@@ -133,19 +128,19 @@
// MIXER METHODS
- public Mixer.Info getMixerInfo() {
+ public final Mixer.Info getMixerInfo() {
return mixerInfo;
}
- public Line.Info[] getSourceLineInfo() {
+ public final Line.Info[] getSourceLineInfo() {
Line.Info[] localArray = new Line.Info[sourceLineInfo.length];
System.arraycopy(sourceLineInfo, 0, localArray, 0, sourceLineInfo.length);
return localArray;
}
- public Line.Info[] getTargetLineInfo() {
+ public final Line.Info[] getTargetLineInfo() {
Line.Info[] localArray = new Line.Info[targetLineInfo.length];
System.arraycopy(targetLineInfo, 0, localArray, 0, targetLineInfo.length);
@@ -153,7 +148,7 @@
}
- public Line.Info[] getSourceLineInfo(Line.Info info) {
+ public final Line.Info[] getSourceLineInfo(Line.Info info) {
int i;
Vector vec = new Vector();
@@ -174,7 +169,7 @@
}
- public Line.Info[] getTargetLineInfo(Line.Info info) {
+ public final Line.Info[] getTargetLineInfo(Line.Info info) {
int i;
Vector vec = new Vector();
@@ -195,7 +190,7 @@
}
- public boolean isLineSupported(Line.Info info) {
+ public final boolean isLineSupported(Line.Info info) {
int i;
@@ -227,7 +222,7 @@
protected abstract void implClose();
- public Line[] getSourceLines() {
+ public final Line[] getSourceLines() {
Line[] localLines;
@@ -244,7 +239,7 @@
}
- public Line[] getTargetLines() {
+ public final Line[] getTargetLines() {
Line[] localLines;
@@ -264,7 +259,7 @@
/**
* Default implementation always throws an exception.
*/
- public void synchronize(Line[] lines, boolean maintainSync) {
+ public final void synchronize(Line[] lines, boolean maintainSync) {
throw new IllegalArgumentException("Synchronization not supported by this mixer.");
}
@@ -272,7 +267,7 @@
/**
* Default implementation always throws an exception.
*/
- public void unsynchronize(Line[] lines) {
+ public final void unsynchronize(Line[] lines) {
throw new IllegalArgumentException("Synchronization not supported by this mixer.");
}
@@ -280,7 +275,8 @@
/**
* Default implementation always returns false.
*/
- public boolean isSynchronizationSupported(Line[] lines, boolean maintainSync) {
+ public final boolean isSynchronizationSupported(Line[] lines,
+ boolean maintainSync) {
return false;
}
@@ -290,14 +286,14 @@
/**
* This implementation tries to open the mixer with its current format and buffer size settings.
*/
- public synchronized void open() throws LineUnavailableException {
+ public final synchronized void open() throws LineUnavailableException {
open(true);
}
/**
* This implementation tries to open the mixer with its current format and buffer size settings.
*/
- protected synchronized void open(boolean manual) throws LineUnavailableException {
+ final synchronized void open(boolean manual) throws LineUnavailableException {
if (Printer.trace) Printer.trace(">> AbstractMixer: open()");
if (!isOpen()) {
implOpen();
@@ -322,7 +318,7 @@
* The mixer may be opened at a format different than the line's
* format if it is a DataLine.
*/
- protected synchronized void open(Line line) throws LineUnavailableException {
+ final synchronized void open(Line line) throws LineUnavailableException {
if (Printer.trace) Printer.trace(">> AbstractMixer: open(line = " + line + ")");
@@ -367,7 +363,7 @@
* open target lines, if it exists in either.
* If the list is now empty, closes the mixer.
*/
- protected synchronized void close(Line line) {
+ final synchronized void close(Line line) {
if (Printer.trace) Printer.trace(">> AbstractMixer: close(" + line + ")");
@@ -396,7 +392,7 @@
/**
* Close all lines and then close this mixer.
*/
- public synchronized void close() {
+ public final synchronized void close() {
if (Printer.trace) Printer.trace(">> AbstractMixer: close()");
if (isOpen()) {
// close all source lines
@@ -423,7 +419,7 @@
/**
* Starts the mixer.
*/
- protected synchronized void start(Line line) {
+ final synchronized void start(Line line) {
if (Printer.trace) Printer.trace(">> AbstractMixer: start(" + line + ")");
@@ -447,7 +443,7 @@
/**
* Stops the mixer if this was the last running line.
*/
- protected synchronized void stop(Line line) {
+ final synchronized void stop(Line line) {
if (Printer.trace) Printer.trace(">> AbstractMixer: stop(" + line + ")");
@@ -501,7 +497,7 @@
* Right now this just checks whether it's supported, but should
* check whether it actually belongs to this mixer....
*/
- boolean isSourceLine(Line.Info info) {
+ final boolean isSourceLine(Line.Info info) {
for (int i = 0; i < sourceLineInfo.length; i++) {
if (info.matches(sourceLineInfo[i])) {
@@ -518,7 +514,7 @@
* Right now this just checks whether it's supported, but should
* check whether it actually belongs to this mixer....
*/
- boolean isTargetLine(Line.Info info) {
+ final boolean isTargetLine(Line.Info info) {
for (int i = 0; i < targetLineInfo.length; i++) {
if (info.matches(targetLineInfo[i])) {
@@ -535,7 +531,7 @@
* matches the one specified, or null if no matching Line.Info
* object is found.
*/
- Line.Info getLineInfo(Line.Info info) {
+ final Line.Info getLineInfo(Line.Info info) {
if (info == null) {
return null;
}
--- a/jdk/src/share/classes/com/sun/media/sound/AiffFileFormat.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AiffFileFormat.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
* @author Jan Borgersen
*/
-class AiffFileFormat extends AudioFileFormat {
+final class AiffFileFormat extends AudioFileFormat {
static final int AIFF_MAGIC = 1179603533;
@@ -62,13 +62,13 @@
//$$fb 2001-07-13: added management of header size in this class
/** header size in bytes */
- private int headerSize=AIFF_HEADERSIZE;
+ private final int headerSize=AIFF_HEADERSIZE;
/** comm chunk size in bytes, inclusive magic and length field */
- private int commChunkSize=26;
+ private final int commChunkSize=26;
/** FVER chunk size in bytes, inclusive magic and length field */
- private int fverChunkSize=0;
+ private final int fverChunkSize=0;
AiffFileFormat( AudioFileFormat aff ) {
this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() );
--- a/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,28 +25,17 @@
package com.sun.media.sound;
-import java.util.Vector;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.EOFException;
import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.FileInputStream;
-import java.io.DataOutputStream;
-import java.io.FileOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.SequenceInputStream;
import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
@@ -58,19 +47,10 @@
* @author Jan Borgersen
* @author Florian Bomers
*/
-public class AiffFileReader extends SunFileReader {
+public final class AiffFileReader extends SunFileReader {
private static final int MAX_READ_LENGTH = 8;
-
- /**
- * AIFF parser type
- */
- public static final AudioFileFormat.Type types[] = {
- AudioFileFormat.Type.AIFF
- };
-
-
/**
* Constructs a new AiffParser object.
*/
--- a/jdk/src/share/classes/com/sun/media/sound/AiffFileWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AiffFileWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,21 +50,13 @@
*
* @author Jan Borgersen
*/
-public class AiffFileWriter extends SunFileWriter {
-
- /**
- * AIFF type
- */
- private static final AudioFileFormat.Type aiffTypes[] = {
- AudioFileFormat.Type.AIFF
- };
-
+public final class AiffFileWriter extends SunFileWriter {
/**
* Constructs a new AiffFileWriter object.
*/
public AiffFileWriter() {
- super(aiffTypes);
+ super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AIFF});
}
--- a/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,12 @@
package com.sun.media.sound;
-import java.io.InputStream;
import java.io.IOException;
-
import java.util.Vector;
import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioInputStream;
/**
@@ -40,12 +38,12 @@
*
* @author Kara Kytle
*/
-public class AlawCodec extends SunCodec {
+public final class AlawCodec extends SunCodec {
/* Tables used for A-law decoding */
- final static byte ALAW_TABH[] = new byte[256];
- final static byte ALAW_TABL[] = new byte[256];
+ private static final byte[] ALAW_TABH = new byte[256];
+ private static final byte[] ALAW_TABL = new byte[256];
private static final AudioFormat.Encoding[] alawEncodings = { AudioFormat.Encoding.ALAW, AudioFormat.Encoding.PCM_SIGNED };
@@ -256,7 +254,7 @@
}
- class AlawCodecStream extends AudioInputStream {
+ final class AlawCodecStream extends AudioInputStream {
// tempBuffer required only for encoding (when encode is true)
private static final int tempBufferSize = 64;
--- a/jdk/src/share/classes/com/sun/media/sound/AuFileFormat.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AuFileFormat.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
* @author Jan Borgersen
*/
-class AuFileFormat extends AudioFileFormat {
+final class AuFileFormat extends AudioFileFormat {
// magic numbers
static final int AU_SUN_MAGIC = 0x2e736e64;
@@ -60,7 +60,7 @@
static final int AU_HEADERSIZE = 24;
- int auType;
+ private int auType;
AuFileFormat( AudioFileFormat aff ) {
--- a/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,28 +25,17 @@
package com.sun.media.sound;
-import java.util.Vector;
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.EOFException;
import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.FileInputStream;
-import java.io.DataOutputStream;
-import java.io.FileOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.SequenceInputStream;
import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
@@ -58,16 +47,7 @@
* @author Jan Borgersen
* @author Florian Bomers
*/
-public class AuFileReader extends SunFileReader {
-
- /**
- * AU reader type
- */
-
- public static final AudioFileFormat.Type types[] = {
- AudioFileFormat.Type.AU
- };
-
+public final class AuFileReader extends SunFileReader {
/**
* Constructs a new AuFileReader object.
--- a/jdk/src/share/classes/com/sun/media/sound/AuFileWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AuFileWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,28 +49,18 @@
*
* @author Jan Borgersen
*/
-public class AuFileWriter extends SunFileWriter {
+public final class AuFileWriter extends SunFileWriter {
//$$fb value for length field if length is not known
public final static int UNKNOWN_SIZE=-1;
/**
- * AU type
- */
- private static final AudioFileFormat.Type auTypes[] = {
- AudioFileFormat.Type.AU
- };
-
-
- /**
* Constructs a new AuFileWriter object.
*/
public AuFileWriter() {
- super(auTypes);
+ super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AU});
}
-
-
public AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
AudioFileFormat.Type[] filetypes = new AudioFileFormat.Type[types.length];
--- a/jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
*
* @author Karl Helgason
*/
-public class AudioFileSoundbankReader extends SoundbankReader {
+public final class AudioFileSoundbankReader extends SoundbankReader {
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
--- a/jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
private static class AudioFloatLSBFilter extends AudioFloatConverter {
- private AudioFloatConverter converter;
+ private final AudioFloatConverter converter;
final private int offset;
@@ -61,8 +61,7 @@
private byte[] mask_buffer;
- public AudioFloatLSBFilter(AudioFloatConverter converter,
- AudioFormat format) {
+ AudioFloatLSBFilter(AudioFloatConverter converter, AudioFormat format) {
int bits = format.getSampleSizeInBits();
boolean bigEndian = format.isBigEndian();
this.converter = converter;
@@ -740,7 +739,7 @@
final int xbytes;
- public AudioFloatConversion32xSL(int xbytes) {
+ AudioFloatConversion32xSL(int xbytes) {
this.xbytes = xbytes;
}
@@ -781,7 +780,7 @@
final int xbytes;
- public AudioFloatConversion32xSB(int xbytes) {
+ AudioFloatConversion32xSB(int xbytes) {
this.xbytes = xbytes;
}
@@ -823,7 +822,7 @@
final int xbytes;
- public AudioFloatConversion32xUL(int xbytes) {
+ AudioFloatConversion32xUL(int xbytes) {
this.xbytes = xbytes;
}
@@ -866,7 +865,7 @@
final int xbytes;
- public AudioFloatConversion32xUB(int xbytes) {
+ AudioFloatConversion32xUB(int xbytes) {
this.xbytes = xbytes;
}
@@ -1008,49 +1007,51 @@
private AudioFormat format;
- public AudioFormat getFormat() {
+ public final AudioFormat getFormat() {
return format;
}
public abstract float[] toFloatArray(byte[] in_buff, int in_offset,
float[] out_buff, int out_offset, int out_len);
- public float[] toFloatArray(byte[] in_buff, float[] out_buff,
+ public final float[] toFloatArray(byte[] in_buff, float[] out_buff,
int out_offset, int out_len) {
return toFloatArray(in_buff, 0, out_buff, out_offset, out_len);
}
- public float[] toFloatArray(byte[] in_buff, int in_offset,
+ public final float[] toFloatArray(byte[] in_buff, int in_offset,
float[] out_buff, int out_len) {
return toFloatArray(in_buff, in_offset, out_buff, 0, out_len);
}
- public float[] toFloatArray(byte[] in_buff, float[] out_buff, int out_len) {
+ public final float[] toFloatArray(byte[] in_buff, float[] out_buff,
+ int out_len) {
return toFloatArray(in_buff, 0, out_buff, 0, out_len);
}
- public float[] toFloatArray(byte[] in_buff, float[] out_buff) {
+ public final float[] toFloatArray(byte[] in_buff, float[] out_buff) {
return toFloatArray(in_buff, 0, out_buff, 0, out_buff.length);
}
public abstract byte[] toByteArray(float[] in_buff, int in_offset,
int in_len, byte[] out_buff, int out_offset);
- public byte[] toByteArray(float[] in_buff, int in_len, byte[] out_buff,
- int out_offset) {
+ public final byte[] toByteArray(float[] in_buff, int in_len,
+ byte[] out_buff, int out_offset) {
return toByteArray(in_buff, 0, in_len, out_buff, out_offset);
}
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff) {
+ public final byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
+ byte[] out_buff) {
return toByteArray(in_buff, in_offset, in_len, out_buff, 0);
}
- public byte[] toByteArray(float[] in_buff, int in_len, byte[] out_buff) {
+ public final byte[] toByteArray(float[] in_buff, int in_len,
+ byte[] out_buff) {
return toByteArray(in_buff, 0, in_len, out_buff, 0);
}
- public byte[] toByteArray(float[] in_buff, byte[] out_buff) {
+ public final byte[] toByteArray(float[] in_buff, byte[] out_buff) {
return toByteArray(in_buff, 0, in_buff.length, out_buff, 0);
}
}
--- a/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,19 +42,19 @@
*
* @author Karl Helgason
*/
-public class AudioFloatFormatConverter extends FormatConversionProvider {
+public final class AudioFloatFormatConverter extends FormatConversionProvider {
private static class AudioFloatFormatConverterInputStream extends
InputStream {
- private AudioFloatConverter converter;
+ private final AudioFloatConverter converter;
- private AudioFloatInputStream stream;
+ private final AudioFloatInputStream stream;
private float[] readfloatbuffer;
- private int fsize = 0;
+ private final int fsize;
- public AudioFloatFormatConverterInputStream(AudioFormat targetFormat,
+ AudioFloatFormatConverterInputStream(AudioFormat targetFormat,
AudioFloatInputStream stream) {
this.stream = stream;
converter = AudioFloatConverter.getConverter(targetFormat);
@@ -116,17 +116,17 @@
private static class AudioFloatInputStreamChannelMixer extends
AudioFloatInputStream {
- private int targetChannels;
+ private final int targetChannels;
- private int sourceChannels;
+ private final int sourceChannels;
- private AudioFloatInputStream ais;
+ private final AudioFloatInputStream ais;
- private AudioFormat targetFormat;
+ private final AudioFormat targetFormat;
private float[] conversion_buffer;
- public AudioFloatInputStreamChannelMixer(AudioFloatInputStream ais,
+ AudioFloatInputStreamChannelMixer(AudioFloatInputStream ais,
int targetChannels) {
this.sourceChannels = ais.getFormat().getChannels();
this.targetChannels = targetChannels;
@@ -226,37 +226,37 @@
private static class AudioFloatInputStreamResampler extends
AudioFloatInputStream {
- private AudioFloatInputStream ais;
+ private final AudioFloatInputStream ais;
- private AudioFormat targetFormat;
+ private final AudioFormat targetFormat;
private float[] skipbuffer;
private SoftAbstractResampler resampler;
- private float[] pitch = new float[1];
+ private final float[] pitch = new float[1];
- private float[] ibuffer2;
+ private final float[] ibuffer2;
- private float[][] ibuffer;
+ private final float[][] ibuffer;
private float ibuffer_index = 0;
private int ibuffer_len = 0;
- private int nrofchannels = 0;
+ private final int nrofchannels;
private float[][] cbuffer;
- private int buffer_len = 512;
+ private final int buffer_len = 512;
- private int pad;
+ private final int pad;
- private int pad2;
+ private final int pad2;
- private float[] ix = new float[1];
+ private final float[] ix = new float[1];
- private int[] ox = new int[1];
+ private final int[] ox = new int[1];
private float[][] mark_ibuffer = null;
@@ -264,7 +264,7 @@
private int mark_ibuffer_len = 0;
- public AudioFloatInputStreamResampler(AudioFloatInputStream ais,
+ AudioFloatInputStreamResampler(AudioFloatInputStream ais,
AudioFormat format) {
this.ais = ais;
AudioFormat sourceFormat = ais.getFormat();
@@ -468,8 +468,9 @@
}
- private Encoding[] formats = { Encoding.PCM_SIGNED, Encoding.PCM_UNSIGNED,
- Encoding.PCM_FLOAT };
+ private final Encoding[] formats = {Encoding.PCM_SIGNED,
+ Encoding.PCM_UNSIGNED,
+ Encoding.PCM_FLOAT};
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
AudioInputStream sourceStream) {
--- a/jdk/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,14 +48,14 @@
private int pos = 0;
private int markpos = 0;
- private AudioFloatConverter converter;
- private AudioFormat format;
- private byte[] buffer;
- private int buffer_offset;
- private int buffer_len;
- private int framesize_pc;
+ private final AudioFloatConverter converter;
+ private final AudioFormat format;
+ private final byte[] buffer;
+ private final int buffer_offset;
+ private final int buffer_len;
+ private final int framesize_pc;
- public BytaArrayAudioFloatInputStream(AudioFloatConverter converter,
+ BytaArrayAudioFloatInputStream(AudioFloatConverter converter,
byte[] buffer, int offset, int len) {
this.converter = converter;
this.format = converter.getFormat();
@@ -125,12 +125,12 @@
private static class DirectAudioFloatInputStream
extends AudioFloatInputStream {
- private AudioInputStream stream;
+ private final AudioInputStream stream;
private AudioFloatConverter converter;
- private int framesize_pc; // framesize / channels
+ private final int framesize_pc; // framesize / channels
private byte[] buffer;
- public DirectAudioFloatInputStream(AudioInputStream stream) {
+ DirectAudioFloatInputStream(AudioInputStream stream) {
converter = AudioFloatConverter.getConverter(stream.getFormat());
if (converter == null) {
AudioFormat format = stream.getFormat();
@@ -255,11 +255,11 @@
public abstract int read(float[] b, int off, int len) throws IOException;
- public int read(float[] b) throws IOException {
+ public final int read(float[] b) throws IOException {
return read(b, 0, b.length);
}
- public float read() throws IOException {
+ public final float read() throws IOException {
float[] b = new float[1];
int ret = read(b, 0, 1);
if (ret == -1 || ret == 0)
--- a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class AudioSynthesizerPropertyInfo {
+public final class AudioSynthesizerPropertyInfo {
/**
* Constructs a <code>AudioSynthesizerPropertyInfo</code> object with a given
--- a/jdk/src/share/classes/com/sun/media/sound/DLSInfo.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSInfo.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class DLSInfo {
+public final class DLSInfo {
/**
* (INAM) Title or subject.
--- a/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,15 +40,15 @@
*
* @author Karl Helgason
*/
-public class DLSInstrument extends ModelInstrument {
+public final class DLSInstrument extends ModelInstrument {
- protected int preset = 0;
- protected int bank = 0;
- protected boolean druminstrument = false;
- protected byte[] guid = null;
- protected DLSInfo info = new DLSInfo();
- protected List<DLSRegion> regions = new ArrayList<DLSRegion>();
- protected List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+ int preset = 0;
+ int bank = 0;
+ boolean druminstrument = false;
+ byte[] guid = null;
+ DLSInfo info = new DLSInfo();
+ List<DLSRegion> regions = new ArrayList<DLSRegion>();
+ List<DLSModulator> modulators = new ArrayList<DLSModulator>();
public DLSInstrument() {
super(null, null, null, null);
--- a/jdk/src/share/classes/com/sun/media/sound/DLSModulator.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSModulator.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
*
* @author Karl Helgason
*/
-public class DLSModulator {
+public final class DLSModulator {
// DLS1 Destinations
public static final int CONN_DST_NONE = 0x000; // 0
@@ -102,12 +102,12 @@
public static final int DST_FORMAT_CENT = 1;
public static final int DST_FORMAT_TIMECENT = 2;
public static final int DST_FORMAT_PERCENT = 3;
- protected int source;
- protected int control;
- protected int destination;
- protected int transform;
- protected int scale;
- protected int version = 1;
+ int source;
+ int control;
+ int destination;
+ int transform;
+ int scale;
+ int version = 1;
public int getControl() {
return control;
--- a/jdk/src/share/classes/com/sun/media/sound/DLSRegion.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSRegion.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,21 +36,21 @@
*
* @author Karl Helgason
*/
-public class DLSRegion {
+public final class DLSRegion {
public final static int OPTION_SELFNONEXCLUSIVE = 0x0001;
- protected List<DLSModulator> modulators = new ArrayList<DLSModulator>();
- protected int keyfrom;
- protected int keyto;
- protected int velfrom;
- protected int velto;
- protected int options;
- protected int exclusiveClass;
- protected int fusoptions;
- protected int phasegroup;
- protected long channel;
- protected DLSSample sample = null;
- protected DLSSampleOptions sampleoptions;
+ List<DLSModulator> modulators = new ArrayList<DLSModulator>();
+ int keyfrom;
+ int keyto;
+ int velfrom;
+ int velto;
+ int options;
+ int exclusiveClass;
+ int fusoptions;
+ int phasegroup;
+ long channel;
+ DLSSample sample = null;
+ DLSSampleOptions sampleoptions;
public List<DLSModulator> getModulators() {
return modulators;
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSample.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSample.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,13 +40,13 @@
*
* @author Karl Helgason
*/
-public class DLSSample extends SoundbankResource {
+public final class DLSSample extends SoundbankResource {
- protected byte[] guid = null;
- protected DLSInfo info = new DLSInfo();
- protected DLSSampleOptions sampleoptions;
- protected ModelByteBuffer data;
- protected AudioFormat format;
+ byte[] guid = null;
+ DLSInfo info = new DLSInfo();
+ DLSSampleOptions sampleoptions;
+ ModelByteBuffer data;
+ AudioFormat format;
public DLSSample(Soundbank soundBank) {
super(soundBank, null, AudioInputStream.class);
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSampleLoop.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSampleLoop.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,13 +29,13 @@
*
* @author Karl Helgason
*/
-public class DLSSampleLoop {
+public final class DLSSampleLoop {
public final static int LOOP_TYPE_FORWARD = 0;
public final static int LOOP_TYPE_RELEASE = 1;
- protected long type;
- protected long start;
- protected long length;
+ long type;
+ long start;
+ long length;
public long getLength() {
return length;
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSampleOptions.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSampleOptions.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,13 @@
*
* @author Karl Helgason
*/
-public class DLSSampleOptions {
+public final class DLSSampleOptions {
- protected int unitynote;
- protected short finetune;
- protected int attenuation;
- protected long options;
- protected List<DLSSampleLoop> loops = new ArrayList<DLSSampleLoop>();
+ int unitynote;
+ short finetune;
+ int attenuation;
+ long options;
+ List<DLSSampleLoop> loops = new ArrayList<DLSSampleLoop>();
public int getAttenuation() {
return attenuation;
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSoundbank.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSoundbank.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
*
* @author Karl Helgason
*/
-public class DLSSoundbank implements Soundbank {
+public final class DLSSoundbank implements Soundbank {
static private class DLSID {
long i1;
@@ -69,7 +69,7 @@
private DLSID() {
}
- public DLSID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
+ DLSID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
int x5, int x6, int x7, int x8) {
this.i1 = i1;
this.s1 = s1;
@@ -174,10 +174,10 @@
private long major = -1;
private long minor = -1;
- private DLSInfo info = new DLSInfo();
+ private final DLSInfo info = new DLSInfo();
- private List<DLSInstrument> instruments = new ArrayList<DLSInstrument>();
- private List<DLSSample> samples = new ArrayList<DLSSample>();
+ private final List<DLSInstrument> instruments = new ArrayList<DLSInstrument>();
+ private final List<DLSSample> samples = new ArrayList<DLSSample>();
private boolean largeFormat = false;
private File sampleFile;
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
*
* @author Karl Helgason
*/
-public class DLSSoundbankReader extends SoundbankReader {
+public final class DLSSoundbankReader extends SoundbankReader {
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
--- a/jdk/src/share/classes/com/sun/media/sound/DataPusher.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DataPusher.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,13 +37,13 @@
* @author Florian Bomers
*/
-public class DataPusher implements Runnable {
+public final class DataPusher implements Runnable {
private static final int AUTO_CLOSE_TIME = 5000;
private static final boolean DEBUG = false;
- private SourceDataLine source = null;
- private AudioFormat format = null;
+ private final SourceDataLine source;
+ private final AudioFormat format;
// stream as source data
private AudioInputStream ais = null;
--- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
*
* @author Florian Bomers
*/
-class DirectAudioDevice extends AbstractMixer {
+final class DirectAudioDevice extends AbstractMixer {
// CONSTANTS
private static final int CLIP_BUFFER_TIME = 1000; // in milliseconds
@@ -335,8 +335,8 @@
* but isFormatSupported() also returns true
* for formats with wrong endianness.
*/
- private static class DirectDLI extends DataLine.Info {
- AudioFormat[] hardwareFormats;
+ private static final class DirectDLI extends DataLine.Info {
+ final AudioFormat[] hardwareFormats;
private DirectDLI(Class clazz, AudioFormat[] formatArray,
AudioFormat[] hardwareFormatArray,
@@ -370,12 +370,12 @@
* Private inner class as base class for direct lines
*/
private static class DirectDL extends AbstractDataLine implements EventDispatcher.LineMonitor {
- protected int mixerIndex;
- protected int deviceID;
+ protected final int mixerIndex;
+ protected final int deviceID;
protected long id;
protected int waitTime;
protected volatile boolean flushing = false;
- protected boolean isSource; // true for SourceDataLine, false for TargetDataLine
+ protected final boolean isSource; // true for SourceDataLine, false for TargetDataLine
protected volatile long bytePosition;
protected volatile boolean doIO = false; // true in between start() and stop() calls
protected volatile boolean stoppedWritten = false; // true if a write occured in stopped state
@@ -387,10 +387,10 @@
protected int softwareConversionSize = 0;
protected AudioFormat hardwareFormat;
- private Gain gainControl = new Gain();
- private Mute muteControl = new Mute();
- private Balance balanceControl = new Balance();
- private Pan panControl = new Pan();
+ private final Gain gainControl = new Gain();
+ private final Mute muteControl = new Mute();
+ private final Balance balanceControl = new Balance();
+ private final Pan panControl = new Pan();
private float leftGain, rightGain;
protected volatile boolean noService = false; // do not run the nService method
@@ -829,7 +829,7 @@
/////////////////// CONTROLS /////////////////////////////
- protected class Gain extends FloatControl {
+ protected final class Gain extends FloatControl {
private float linearGain = 1.0f;
@@ -862,7 +862,7 @@
} // class Gain
- private class Mute extends BooleanControl {
+ private final class Mute extends BooleanControl {
private Mute() {
super(BooleanControl.Type.MUTE, false, "True", "False");
@@ -874,7 +874,7 @@
}
} // class Mute
- private class Balance extends FloatControl {
+ private final class Balance extends FloatControl {
private Balance() {
super(FloatControl.Type.BALANCE, -1.0f, 1.0f, (1.0f / 128.0f), -1, 0.0f,
@@ -893,7 +893,7 @@
} // class Balance
- private class Pan extends FloatControl {
+ private final class Pan extends FloatControl {
private Pan() {
super(FloatControl.Type.PAN, -1.0f, 1.0f, (1.0f / 128.0f), -1, 0.0f,
@@ -918,7 +918,8 @@
/**
* Private inner class representing a SourceDataLine
*/
- private static class DirectSDL extends DirectDL implements SourceDataLine {
+ private static final class DirectSDL extends DirectDL
+ implements SourceDataLine {
// CONSTRUCTOR
private DirectSDL(DataLine.Info info,
@@ -934,7 +935,8 @@
/**
* Private inner class representing a TargetDataLine
*/
- private static class DirectTDL extends DirectDL implements TargetDataLine {
+ private static final class DirectTDL extends DirectDL
+ implements TargetDataLine {
// CONSTRUCTOR
private DirectTDL(DataLine.Info info,
@@ -1012,7 +1014,9 @@
* Private inner class representing a Clip
* This clip is realized in software only
*/
- private static class DirectClip extends DirectDL implements Clip, Runnable, AutoClosingClip {
+ private static final class DirectClip extends DirectDL
+ implements Clip, Runnable, AutoClosingClip {
+
private Thread thread;
private byte[] audioData = null;
private int frameSize; // size of one frame in bytes
@@ -1045,7 +1049,7 @@
byte[] newData = new byte[bufferSize];
System.arraycopy(data, offset, newData, 0, bufferSize);
- open(format, data, bufferSize / format.getFrameSize());
+ open(format, newData, bufferSize / format.getFrameSize());
}
// this method does not copy the data array
@@ -1443,7 +1447,7 @@
* which allows retrieval of the internal array
*/
private static class DirectBAOS extends ByteArrayOutputStream {
- public DirectBAOS() {
+ DirectBAOS() {
super();
}
--- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDeviceProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
package com.sun.media.sound;
-import java.util.Vector;
-
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
@@ -36,7 +34,7 @@
*
* @author Florian Bomers
*/
-public class DirectAudioDeviceProvider extends MixerProvider {
+public final class DirectAudioDeviceProvider extends MixerProvider {
// STATIC VARIABLES
@@ -66,16 +64,17 @@
* Required public no-arg constructor.
*/
public DirectAudioDeviceProvider() {
- //if (Printer.trace) Printer.trace("DirectAudioDeviceProvider: constructor");
- if (Platform.isDirectAudioEnabled()) {
- init();
- } else {
- infos = new DirectAudioDeviceInfo[0];
- devices = new DirectAudioDevice[0];
+ synchronized (DirectAudioDeviceProvider.class) {
+ if (Platform.isDirectAudioEnabled()) {
+ init();
+ } else {
+ infos = new DirectAudioDeviceInfo[0];
+ devices = new DirectAudioDevice[0];
+ }
}
}
- private synchronized static void init() {
+ private static void init() {
// get the number of input devices
int numDevices = nGetNumDevices();
@@ -94,36 +93,39 @@
}
public Mixer.Info[] getMixerInfo() {
- Mixer.Info[] localArray = new Mixer.Info[infos.length];
- System.arraycopy(infos, 0, localArray, 0, infos.length);
- return localArray;
+ synchronized (DirectAudioDeviceProvider.class) {
+ Mixer.Info[] localArray = new Mixer.Info[infos.length];
+ System.arraycopy(infos, 0, localArray, 0, infos.length);
+ return localArray;
+ }
}
public Mixer getMixer(Mixer.Info info) {
- // if the default device is asked, we provide the mixer
- // with SourceDataLine's
- if (info == null) {
+ synchronized (DirectAudioDeviceProvider.class) {
+ // if the default device is asked, we provide the mixer
+ // with SourceDataLine's
+ if (info == null) {
+ for (int i = 0; i < infos.length; i++) {
+ Mixer mixer = getDevice(infos[i]);
+ if (mixer.getSourceLineInfo().length > 0) {
+ return mixer;
+ }
+ }
+ }
+ // otherwise get the first mixer that matches
+ // the requested info object
for (int i = 0; i < infos.length; i++) {
- Mixer mixer = getDevice(infos[i]);
- if (mixer.getSourceLineInfo().length > 0) {
- return mixer;
+ if (infos[i].equals(info)) {
+ return getDevice(infos[i]);
}
}
}
- // otherwise get the first mixer that matches
- // the requested info object
- for (int i = 0; i < infos.length; i++) {
- if (infos[i].equals(info)) {
- return getDevice(infos[i]);
- }
- }
-
throw new IllegalArgumentException("Mixer " + info.toString() + " not supported by this provider.");
}
- private Mixer getDevice(DirectAudioDeviceInfo info) {
+ private static Mixer getDevice(DirectAudioDeviceInfo info) {
int index = info.getIndex();
if (devices[index] == null) {
devices[index] = new DirectAudioDevice(info);
@@ -139,12 +141,12 @@
* making native references to a particular device.
* This constructor is called from native.
*/
- static class DirectAudioDeviceInfo extends Mixer.Info {
- private int index;
- private int maxSimulLines;
+ static final class DirectAudioDeviceInfo extends Mixer.Info {
+ private final int index;
+ private final int maxSimulLines;
// For ALSA, the deviceID contains the encoded card index, device index, and sub-device-index
- private int deviceID;
+ private final int deviceID;
private DirectAudioDeviceInfo(int index, int deviceID, int maxSimulLines,
String name, String vendor,
--- a/jdk/src/share/classes/com/sun/media/sound/EmergencySoundbank.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/EmergencySoundbank.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
*
* @author Karl Helgason
*/
-public class EmergencySoundbank {
+public final class EmergencySoundbank {
private final static String[] general_midi_instruments = {
"Acoustic Grand Piano",
--- a/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,20 +25,16 @@
package com.sun.media.sound;
-import java.util.EventObject;
import java.util.ArrayList;
import java.util.List;
-import javax.sound.sampled.Clip;
-import javax.sound.sampled.Line;
+import javax.sound.midi.ControllerEventListener;
+import javax.sound.midi.MetaEventListener;
+import javax.sound.midi.MetaMessage;
+import javax.sound.midi.ShortMessage;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
-import javax.sound.midi.MetaMessage;
-import javax.sound.midi.ShortMessage;
-import javax.sound.midi.MetaEventListener;
-import javax.sound.midi.ControllerEventListener;
-
/**
@@ -49,7 +45,7 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-class EventDispatcher implements Runnable {
+final class EventDispatcher implements Runnable {
/**
* time of inactivity until the auto closing clips
@@ -61,7 +57,7 @@
/**
* List of events
*/
- private ArrayList eventQueue = new ArrayList();
+ private final ArrayList eventQueue = new ArrayList();
/**
@@ -73,12 +69,12 @@
/*
* support for auto-closing Clips
*/
- private ArrayList<ClipInfo> autoClosingClips = new ArrayList<ClipInfo>();
+ private final ArrayList<ClipInfo> autoClosingClips = new ArrayList<ClipInfo>();
/*
* support for monitoring data lines
*/
- private ArrayList<LineMonitor> lineMonitors = new ArrayList<LineMonitor>();
+ private final ArrayList<LineMonitor> lineMonitors = new ArrayList<LineMonitor>();
/**
* Approximate interval between calls to LineMonitor.checkLine
@@ -105,7 +101,7 @@
* Invoked when there is at least one event in the queue.
* Implement this as a callback to process one event.
*/
- protected void processEvent(EventInfo eventInfo) {
+ void processEvent(EventInfo eventInfo) {
int count = eventInfo.getListenerCount();
// process an LineEvent
@@ -166,7 +162,7 @@
* exclusive access over the code where an event is removed from the
*queue.
*/
- protected void dispatchEvents() {
+ void dispatchEvents() {
EventInfo eventInfo = null;
@@ -388,8 +384,8 @@
*/
private class EventInfo {
- private Object event;
- private Object[] listeners;
+ private final Object event;
+ private final Object[] listeners;
/**
* Create a new instance of this event Info class
@@ -421,8 +417,8 @@
*/
private class ClipInfo {
- private AutoClosingClip clip;
- private long expiration;
+ private final AutoClosingClip clip;
+ private final long expiration;
/**
* Create a new instance of this clip Info class
--- a/jdk/src/share/classes/com/sun/media/sound/FFT.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/FFT.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,11 @@
*/
public final class FFT {
- private double[] w;
- private int fftFrameSize;
- private int sign;
- private int[] bitm_array;
- private int fftFrameSize2;
+ private final double[] w;
+ private final int fftFrameSize;
+ private final int sign;
+ private final int[] bitm_array;
+ private final int fftFrameSize2;
// Sign = -1 is FFT, 1 is IFFT (inverse FFT)
// Data = Interlaced double array to be transformed.
--- a/jdk/src/share/classes/com/sun/media/sound/FastShortMessage.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/FastShortMessage.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,13 +35,13 @@
final class FastShortMessage extends ShortMessage {
private int packedMsg;
- public FastShortMessage(int packedMsg) throws InvalidMidiDataException {
+ FastShortMessage(int packedMsg) throws InvalidMidiDataException {
this.packedMsg = packedMsg;
getDataLength(packedMsg & 0xFF); // to check for validity
}
/** Creates a FastShortMessage from this ShortMessage */
- public FastShortMessage(ShortMessage msg) {
+ FastShortMessage(ShortMessage msg) {
this.packedMsg = msg.getStatus()
| (msg.getData1() << 8)
| (msg.getData2() << 16);
--- a/jdk/src/share/classes/com/sun/media/sound/JARSoundbankReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/JARSoundbankReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,14 +36,16 @@
import javax.sound.midi.Soundbank;
import javax.sound.midi.spi.SoundbankReader;
+import sun.reflect.misc.ReflectUtil;
+
/**
- * JarSoundbankReader is used to read sounbank object from jar files.
+ * JarSoundbankReader is used to read soundbank object from jar files.
*
* @author Karl Helgason
*/
-public class JARSoundbankReader extends SoundbankReader {
+public final class JARSoundbankReader extends SoundbankReader {
- public boolean isZIP(URL url) {
+ private static boolean isZIP(URL url) {
boolean ok = false;
try {
InputStream stream = url.openStream();
@@ -81,14 +83,14 @@
while (line != null) {
if (!line.startsWith("#")) {
try {
- Class c = Class.forName(line.trim(), true, ucl);
- Object o = c.newInstance();
- if (o instanceof Soundbank) {
+ Class<?> c = Class.forName(line.trim(), false, ucl);
+ if (Soundbank.class.isAssignableFrom(c)) {
+ Object o = ReflectUtil.newInstance(c);
soundbanks.add((Soundbank) o);
}
- } catch (ClassNotFoundException e) {
- } catch (InstantiationException e) {
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException ignored) {
+ } catch (InstantiationException ignored) {
+ } catch (IllegalAccessException ignored) {
}
}
line = r.readLine();
--- a/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,6 @@
import java.util.Map;
import java.util.Properties;
-import javax.sound.sampled.spi.AudioFileReader;
-import javax.sound.sampled.spi.AudioFileWriter;
-import javax.sound.sampled.spi.FormatConversionProvider;
-import javax.sound.sampled.spi.MixerProvider;
-
-import javax.sound.midi.spi.MidiFileReader;
-import javax.sound.midi.spi.MidiFileWriter;
-import javax.sound.midi.spi.SoundbankReader;
-import javax.sound.midi.spi.MidiDeviceProvider;
-
import javax.sound.midi.Receiver;
import javax.sound.midi.Sequencer;
import javax.sound.midi.Synthesizer;
@@ -62,7 +52,7 @@
*
* @author Matthias Pfisterer
*/
-public class JDK13Services {
+public final class JDK13Services {
/** The default for the length of the period to hold the cache.
This value is given in milliseconds. It is equivalent to
@@ -80,7 +70,7 @@
Class objects of the provider type (MixerProvider, MidiDeviceProvider
...) are used as keys. The values are instances of ProviderCache.
*/
- private static Map providersCacheMap = new HashMap();
+ private static final Map providersCacheMap = new HashMap();
/** The length of the period to hold the cache.
--- a/jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
*
* @author Matthias Pfisterer
*/
-class JSSecurityManager {
+final class JSSecurityManager {
/** Prevent instantiation.
*/
@@ -73,30 +73,6 @@
}
}
-
- static void loadLibrary(final String libName) {
- try {
- if (hasSecurityManager()) {
- if(Printer.debug) Printer.debug("using security manager to load library");
- PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary(libName);
- return null;
- }
- };
- AccessController.doPrivileged(action);
- } else {
- if(Printer.debug) Printer.debug("not using security manager to load library");
- System.loadLibrary(libName);
- }
- if (Printer.debug) Printer.debug("loaded library " + libName);
- } catch (UnsatisfiedLinkError e2) {
- if (Printer.err)Printer.err("UnsatisfiedLinkError loading native library " + libName);
- throw(e2);
- }
- }
-
-
static String getProperty(final String propertyName) {
String propertyValue;
if (hasSecurityManager()) {
@@ -189,83 +165,13 @@
if(Printer.trace)Printer.trace("<< JSSecurityManager: loadPropertiesImpl() completed");
}
-
- private static ThreadGroup getTopmostThreadGroup() {
- ThreadGroup topmostThreadGroup;
- if(hasSecurityManager()) {
- try {
- // invoke the privileged action using 1.2 security
- PrivilegedAction<ThreadGroup> action = new PrivilegedAction<ThreadGroup>() {
- public ThreadGroup run() {
- try {
- return getTopmostThreadGroupImpl();
- } catch (Throwable t) {
- return null;
- }
- }
- };
- topmostThreadGroup = AccessController.doPrivileged(action);
- if(Printer.debug)Printer.debug("Got topmost thread group with JDK 1.2 security");
- } catch (Exception e) {
- if(Printer.debug)Printer.debug("Exception getting topmost thread group with JDK 1.2 security");
- // try without using JDK 1.2 security
- topmostThreadGroup = getTopmostThreadGroupImpl();
- }
- } else {
- // not JDK 1.2 security, assume we already have permission
- topmostThreadGroup = getTopmostThreadGroupImpl();
- }
- return topmostThreadGroup;
- }
-
-
- private static ThreadGroup getTopmostThreadGroupImpl() {
- if(Printer.trace)Printer.trace(">> JSSecurityManager: getTopmostThreadGroupImpl()");
- ThreadGroup g = Thread.currentThread().getThreadGroup();
- while ((g.getParent() != null) && (g.getParent().getParent() != null)) {
- g = g.getParent();
- }
- if(Printer.trace)Printer.trace("<< JSSecurityManager: getTopmostThreadGroupImpl() completed");
- return g;
- }
-
-
- /** Create a Thread in the topmost ThreadGroup.
+ /** Create a Thread in the current ThreadGroup.
*/
static Thread createThread(final Runnable runnable,
final String threadName,
final boolean isDaemon, final int priority,
final boolean doStart) {
- Thread thread = null;
- if(hasSecurityManager()) {
- PrivilegedAction<Thread> action = new PrivilegedAction<Thread>() {
- public Thread run() {
- try {
- return createThreadImpl(runnable, threadName,
- isDaemon, priority,
- doStart);
- } catch (Throwable t) {
- return null;
- }
- }
- };
- thread = AccessController.doPrivileged(action);
- if(Printer.debug) Printer.debug("created thread with JDK 1.2 security");
- } else {
- if(Printer.debug)Printer.debug("not using JDK 1.2 security");
- thread = createThreadImpl(runnable, threadName, isDaemon, priority,
- doStart);
- }
- return thread;
- }
-
-
- private static Thread createThreadImpl(Runnable runnable,
- String threadName,
- boolean isDaemon, int priority,
- boolean doStart) {
- ThreadGroup threadGroup = getTopmostThreadGroupImpl();
- Thread thread = new Thread(threadGroup, runnable);
+ Thread thread = new Thread(runnable);
if (threadName != null) {
thread.setName(threadName);
}
@@ -279,7 +185,6 @@
return thread;
}
-
static <T> List<T> getProviders(final Class<T> providerClass) {
List<T> p = new ArrayList<>();
// ServiceLoader creates "lazy" iterator instance, so it doesn't,
--- a/jdk/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,25 +28,19 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.applet.AudioClip;
-import java.lang.InterruptedException;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.Mixer;
import javax.sound.sampled.Clip;
-import javax.sound.sampled.Control;
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.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
-
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiFileFormat;
import javax.sound.midi.MetaMessage;
@@ -63,7 +57,7 @@
* @author Florian Bomers
*/
-public class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
+public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
private static final boolean DEBUG = false;
private static final int BUFFER_SIZE = 16384; // number of bytes written each time to the source data line
@@ -476,7 +470,7 @@
* which allows retrieval of the internal array
*/
private static class DirectBAOS extends ByteArrayOutputStream {
- public DirectBAOS() {
+ DirectBAOS() {
super();
}
--- a/jdk/src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiDeviceReceiverEnvelope.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
*
* @author Alex Menkov
*/
-public class MidiDeviceReceiverEnvelope implements MidiDeviceReceiver {
+public final class MidiDeviceReceiverEnvelope implements MidiDeviceReceiver {
private final MidiDevice device;
private final Receiver receiver;
--- a/jdk/src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiDeviceTransmitterEnvelope.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
*
* @author Alex Menkov
*/
-public class MidiDeviceTransmitterEnvelope implements MidiDeviceTransmitter {
+public final class MidiDeviceTransmitterEnvelope implements MidiDeviceTransmitter {
private final MidiDevice device;
private final Transmitter transmitter;
--- a/jdk/src/share/classes/com/sun/media/sound/MidiInDevice.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiInDevice.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,6 @@
package com.sun.media.sound;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.sound.midi.*;
@@ -39,7 +36,7 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-class MidiInDevice extends AbstractMidiDevice implements Runnable {
+final class MidiInDevice extends AbstractMidiDevice implements Runnable {
private Thread midiInThread = null;
@@ -127,7 +124,7 @@
* An own class to distinguish the class name from
* the transmitter of other devices
*/
- private class MidiInTransmitter extends BasicTransmitter {
+ private final class MidiInTransmitter extends BasicTransmitter {
private MidiInTransmitter() {
super();
}
--- a/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
package com.sun.media.sound;
import javax.sound.midi.MidiDevice;
-import javax.sound.midi.spi.MidiDeviceProvider;
/**
@@ -35,15 +34,15 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-public class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
+public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider {
/** Cache of info objects for all MIDI output devices on the system. */
- static Info[] infos = null;
+ private static Info[] infos = null;
/** Cache of open MIDI input devices on the system. */
- static MidiDevice[] devices = null;
+ private static MidiDevice[] devices = null;
- private static boolean enabled;
+ private static final boolean enabled;
// STATIC
@@ -106,8 +105,8 @@
* previous instance may still exist and be open / in use / etc.,
* the new instance will not reflect that state...
*/
- static class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info {
- private Class providerClass;
+ static final class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info {
+ private final Class providerClass;
private MidiInDeviceInfo(int index, Class providerClass) {
super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
--- a/jdk/src/share/classes/com/sun/media/sound/MidiOutDevice.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiOutDevice.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-class MidiOutDevice extends AbstractMidiDevice {
+final class MidiOutDevice extends AbstractMidiDevice {
// CONSTRUCTOR
@@ -101,7 +101,7 @@
// INNER CLASSES
- class MidiOutReceiver extends AbstractReceiver {
+ final class MidiOutReceiver extends AbstractReceiver {
void implSend(final MidiMessage message, final long timeStamp) {
final int length = message.getLength();
--- a/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
package com.sun.media.sound;
import javax.sound.midi.MidiDevice;
-import javax.sound.midi.spi.MidiDeviceProvider;
/**
@@ -35,15 +34,15 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-public class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
+public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider {
/** Cache of info objects for all MIDI output devices on the system. */
- static Info[] infos = null;
+ private static Info[] infos = null;
/** Cache of open MIDI output devices on the system. */
- static MidiDevice[] devices = null;
+ private static MidiDevice[] devices = null;
- private static boolean enabled;
+ private final static boolean enabled;
// STATIC
@@ -104,8 +103,8 @@
* previous instance may still exist and be open / in use / etc.,
* the new instance will not reflect that state...
*/
- static class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info {
- private Class providerClass;
+ static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info {
+ private final Class providerClass;
private MidiOutDeviceInfo(int index, Class providerClass) {
super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
--- a/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,12 +36,17 @@
*
* @author Florian Bomers
*/
-public class MidiUtils {
+public final class MidiUtils {
public final static int DEFAULT_TEMPO_MPQ = 500000; // 120bpm
public final static int META_END_OF_TRACK_TYPE = 0x2F;
public final static int META_TEMPO_TYPE = 0x51;
+ /**
+ * Suppresses default constructor, ensuring non-instantiability.
+ */
+ private MidiUtils() {
+ }
/** return true if the passed message is Meta End Of Track */
public static boolean isMetaEndOfTrack(MidiMessage midiMsg) {
@@ -262,7 +267,7 @@
}
- public static class TempoCache {
+ public static final class TempoCache {
long[] ticks;
int[] tempos; // in MPQ
// index in ticks/tempos at the snapshot
--- a/jdk/src/share/classes/com/sun/media/sound/ModelByteBuffer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelByteBuffer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
*
* @author Karl Helgason
*/
-public class ModelByteBuffer {
+public final class ModelByteBuffer {
private ModelByteBuffer root = this;
private File file;
@@ -49,12 +49,12 @@
private class RandomFileInputStream extends InputStream {
- private RandomAccessFile raf;
+ private final RandomAccessFile raf;
private long left;
private long mark = 0;
private long markleft = 0;
- public RandomFileInputStream() throws IOException {
+ RandomFileInputStream() throws IOException {
raf = new RandomAccessFile(root.file, "r");
raf.seek(root.fileoffset + arrayOffset());
left = capacity();
--- a/jdk/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,18 +36,18 @@
*
* @author Karl Helgason
*/
-public class ModelByteBufferWavetable implements ModelWavetable {
+public final class ModelByteBufferWavetable implements ModelWavetable {
private class Buffer8PlusInputStream extends InputStream {
- private boolean bigendian;
- private int framesize_pc;
+ private final boolean bigendian;
+ private final int framesize_pc;
int pos = 0;
int pos2 = 0;
int markpos = 0;
int markpos2 = 0;
- public Buffer8PlusInputStream() {
+ Buffer8PlusInputStream() {
framesize_pc = format.getFrameSize() / format.getChannels();
bigendian = format.isBigEndian();
}
@@ -127,7 +127,7 @@
private float loopStart = -1;
private float loopLength = -1;
- private ModelByteBuffer buffer;
+ private final ModelByteBuffer buffer;
private ModelByteBuffer buffer8 = null;
private AudioFormat format = null;
private float pitchcorrection = 0;
--- a/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
*
* @author Karl Helgason
*/
-public class ModelConnectionBlock {
+public final class ModelConnectionBlock {
//
// source1 * source2 * scale -> destination
--- a/jdk/src/share/classes/com/sun/media/sound/ModelDestination.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelDestination.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class ModelDestination {
+public final class ModelDestination {
public static final ModelIdentifier DESTINATION_NONE = null;
public static final ModelIdentifier DESTINATION_KEYNUMBER
--- a/jdk/src/share/classes/com/sun/media/sound/ModelIdentifier.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelIdentifier.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class ModelIdentifier {
+public final class ModelIdentifier {
/*
* Object Variable
--- a/jdk/src/share/classes/com/sun/media/sound/ModelInstrument.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelInstrument.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
}
// Get General MIDI 2 Alias patch for this instrument.
- public Patch getPatchAlias() {
+ public final Patch getPatchAlias() {
Patch patch = getPatch();
int program = patch.getProgram();
int bank = patch.getBank();
@@ -87,7 +87,7 @@
// Return name of all the keys.
// This information is generated from ModelPerformer.getName()
// returned from getPerformers().
- public String[] getKeys() {
+ public final String[] getKeys() {
String[] keys = new String[128];
for (ModelPerformer performer : getPerformers()) {
for (int k = performer.getKeyFrom(); k <= performer.getKeyTo(); k++) {
@@ -104,7 +104,7 @@
// Return what channels this instrument will probably response
// on General MIDI synthesizer.
- public boolean[] getChannels() {
+ public final boolean[] getChannels() {
boolean percussion = false;
if (getPatch() instanceof ModelPatch)
percussion = ((ModelPatch)getPatch()).isPercussion();
--- a/jdk/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
*
* @author Karl Helgason
*/
-public class ModelInstrumentComparator implements Comparator<Instrument> {
+public final class ModelInstrumentComparator implements Comparator<Instrument> {
public int compare(Instrument arg0, Instrument arg1) {
Patch p0 = arg0.getPatch();
--- a/jdk/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,9 +33,9 @@
*
* @author Karl Helgason
*/
-public class ModelMappedInstrument extends ModelInstrument {
+public final class ModelMappedInstrument extends ModelInstrument {
- private ModelInstrument ins;
+ private final ModelInstrument ins;
public ModelMappedInstrument(ModelInstrument ins, Patch patch) {
super(ins.getSoundbank(), patch, ins.getName(), ins.getDataClass());
--- a/jdk/src/share/classes/com/sun/media/sound/ModelPatch.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelPatch.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
*
* @author Karl Helgason
*/
-public class ModelPatch extends Patch {
+public final class ModelPatch extends Patch {
private boolean percussion = false;
--- a/jdk/src/share/classes/com/sun/media/sound/ModelPerformer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelPerformer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,9 +33,9 @@
*
* @author Karl Helgason
*/
-public class ModelPerformer {
+public final class ModelPerformer {
- private List<ModelOscillator> oscillators = new ArrayList<ModelOscillator>();
+ private final List<ModelOscillator> oscillators = new ArrayList<ModelOscillator>();
private List<ModelConnectionBlock> connectionBlocks
= new ArrayList<ModelConnectionBlock>();
private int keyFrom = 0;
--- a/jdk/src/share/classes/com/sun/media/sound/ModelSource.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelSource.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class ModelSource {
+public final class ModelSource {
public static final ModelIdentifier SOURCE_NONE = null;
public static final ModelIdentifier SOURCE_NOTEON_KEYNUMBER =
--- a/jdk/src/share/classes/com/sun/media/sound/ModelStandardDirector.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelStandardDirector.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class ModelStandardDirector implements ModelDirector {
+public final class ModelStandardDirector implements ModelDirector {
ModelPerformer[] performers;
ModelDirectedPlayer player;
--- a/jdk/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelStandardIndexedDirector.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class ModelStandardIndexedDirector implements ModelDirector {
+public final class ModelStandardIndexedDirector implements ModelDirector {
ModelPerformer[] performers;
ModelDirectedPlayer player;
--- a/jdk/src/share/classes/com/sun/media/sound/ModelStandardTransform.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelStandardTransform.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
*
* @author Karl Helgason
*/
-public class ModelStandardTransform implements ModelTransform {
+public final class ModelStandardTransform implements ModelTransform {
public static final boolean DIRECTION_MIN2MAX = false;
public static final boolean DIRECTION_MAX2MIN = true;
--- a/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,12 @@
package com.sun.media.sound;
-import java.io.InputStream;
import java.io.IOException;
-
import java.util.Vector;
import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.AudioInputStream;
/**
@@ -40,7 +38,7 @@
*
* @author Jan Borgersen
*/
-public class PCMtoPCMCodec extends SunCodec {
+public final class PCMtoPCMCodec extends SunCodec {
private static final AudioFormat.Encoding[] inputEncodings = {
@@ -356,7 +354,7 @@
private final int PCM_UNSIGNED_BE2SIGNED_LE = 7;
private final int PCM_SIGNED_BE2UNSIGNED_LE = 8;
- private int sampleSizeInBytes = 0;
+ private final int sampleSizeInBytes;
private int conversionType = 0;
--- a/jdk/src/share/classes/com/sun/media/sound/Platform.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/Platform.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
package com.sun.media.sound;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.StringTokenizer;
@@ -35,7 +37,7 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-class Platform {
+final class Platform {
// STATIC FINAL CHARACTERISTICS
@@ -157,7 +159,13 @@
try {
// load the main library
- JSSecurityManager.loadLibrary(libNameMain);
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
+ public Void run() {
+ System.loadLibrary(libNameMain);
+ return null;
+ }
+ });
// just for the heck of it...
loadedLibs |= LIB_MAIN;
} catch (SecurityException e) {
@@ -171,9 +179,16 @@
// the string is the libraries, separated by white space
StringTokenizer st = new StringTokenizer(extraLibs);
while (st.hasMoreTokens()) {
- String lib = st.nextToken();
+ final String lib = st.nextToken();
try {
- JSSecurityManager.loadLibrary(lib);
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
+ public Void run() {
+ System.loadLibrary(lib);
+ return null;
+ }
+ });
+
if (lib.equals(libNameALSA)) {
loadedLibs |= LIB_ALSA;
if (Printer.debug) Printer.debug("Loaded ALSA lib successfully.");
--- a/jdk/src/share/classes/com/sun/media/sound/PortMixer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/PortMixer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
*
* @author Florian Bomers
*/
-class PortMixer extends AbstractMixer {
+final class PortMixer extends AbstractMixer {
// CONSTANTS
private static final int SRC_UNKNOWN = 0x01;
@@ -228,8 +228,10 @@
/**
* Private inner class representing a Port for the PortMixer.
*/
- private static class PortMixerPort extends AbstractLine implements Port {
- private int portIndex;
+ private static final class PortMixerPort extends AbstractLine
+ implements Port {
+
+ private final int portIndex;
private long id;
// CONSTRUCTOR
@@ -342,9 +344,9 @@
/**
* Private inner class representing a BooleanControl for PortMixerPort
*/
- private static class BoolCtrl extends BooleanControl {
+ private static final class BoolCtrl extends BooleanControl {
// the handle to the native control function
- private long controlID;
+ private final long controlID;
private boolean closed = false;
private static BooleanControl.Type createType(String name) {
@@ -386,7 +388,7 @@
/**
* inner class for custom types
*/
- private static class BCT extends BooleanControl.Type {
+ private static final class BCT extends BooleanControl.Type {
private BCT(String name) {
super(name);
}
@@ -396,7 +398,7 @@
/**
* Private inner class representing a CompoundControl for PortMixerPort
*/
- private static class CompCtrl extends CompoundControl {
+ private static final class CompCtrl extends CompoundControl {
private CompCtrl(String name, Control[] controls) {
super(new CCT(name), controls);
}
@@ -404,7 +406,7 @@
/**
* inner class for custom compound control types
*/
- private static class CCT extends CompoundControl.Type {
+ private static final class CCT extends CompoundControl.Type {
private CCT(String name) {
super(name);
}
@@ -414,9 +416,9 @@
/**
* Private inner class representing a BooleanControl for PortMixerPort
*/
- private static class FloatCtrl extends FloatControl {
+ private static final class FloatCtrl extends FloatControl {
// the handle to the native control function
- private long controlID;
+ private final long controlID;
private boolean closed = false;
// predefined float control types. See also Ports.h
@@ -462,7 +464,7 @@
/**
* inner class for custom types
*/
- private static class FCT extends FloatControl.Type {
+ private static final class FCT extends FloatControl.Type {
private FCT(String name) {
super(name);
}
@@ -472,7 +474,7 @@
/**
* Private inner class representing a port info
*/
- private static class PortInfo extends Port.Info {
+ private static final class PortInfo extends Port.Info {
private PortInfo(String name, boolean isSource) {
super(Port.class, name, isSource);
}
--- a/jdk/src/share/classes/com/sun/media/sound/PortMixerProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/PortMixerProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
package com.sun.media.sound;
-import java.util.Vector;
-
import javax.sound.sampled.Mixer;
import javax.sound.sampled.spi.MixerProvider;
@@ -36,7 +34,7 @@
*
* @author Florian Bomers
*/
-public class PortMixerProvider extends MixerProvider {
+public final class PortMixerProvider extends MixerProvider {
// STATIC VARIABLES
@@ -66,16 +64,17 @@
* Required public no-arg constructor.
*/
public PortMixerProvider() {
- //if (Printer.trace) Printer.trace("PortMixerProvider: constructor");
- if (Platform.isPortsEnabled()) {
- init();
- } else {
- infos = new PortMixerInfo[0];
- devices = new PortMixer[0];
+ synchronized (PortMixerProvider.class) {
+ if (Platform.isPortsEnabled()) {
+ init();
+ } else {
+ infos = new PortMixerInfo[0];
+ devices = new PortMixer[0];
+ }
}
}
- private static synchronized void init() {
+ private static void init() {
// get the number of input devices
int numDevices = nGetNumDevices();
@@ -95,23 +94,28 @@
}
public Mixer.Info[] getMixerInfo() {
- Mixer.Info[] localArray = new Mixer.Info[infos.length];
- System.arraycopy(infos, 0, localArray, 0, infos.length);
- return localArray;
+ synchronized (PortMixerProvider.class) {
+ Mixer.Info[] localArray = new Mixer.Info[infos.length];
+ System.arraycopy(infos, 0, localArray, 0, infos.length);
+ return localArray;
+ }
}
public Mixer getMixer(Mixer.Info info) {
- for (int i = 0; i < infos.length; i++) {
- if (infos[i].equals(info)) {
- return getDevice(infos[i]);
+ synchronized (PortMixerProvider.class) {
+ for (int i = 0; i < infos.length; i++) {
+ if (infos[i].equals(info)) {
+ return getDevice(infos[i]);
+ }
}
}
- throw new IllegalArgumentException("Mixer " + info.toString() + " not supported by this provider.");
+ throw new IllegalArgumentException("Mixer " + info.toString()
+ + " not supported by this provider.");
}
- private Mixer getDevice(PortMixerInfo info) {
+ private static Mixer getDevice(PortMixerInfo info) {
int index = info.getIndex();
if (devices[index] == null) {
devices[index] = new PortMixer(info);
@@ -127,8 +131,8 @@
* making native references to a particular device.
* This constructor is called from native.
*/
- static class PortMixerInfo extends Mixer.Info {
- private int index;
+ static final class PortMixerInfo extends Mixer.Info {
+ private final int index;
private PortMixerInfo(int index, String name, String vendor, String description, String version) {
super("Port " + name, vendor, description, version);
--- a/jdk/src/share/classes/com/sun/media/sound/Printer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/Printer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
* @author David Rivas
* @author Kara Kytle
*/
-class Printer {
+final class Printer {
static final boolean err = false;
static final boolean debug = false;
@@ -68,6 +68,12 @@
release = on;
}*/
+ /**
+ * Suppresses default constructor, ensuring non-instantiability.
+ */
+ private Printer() {
+ }
+
public static void err(String str) {
if (err)
--- a/jdk/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class RIFFInvalidDataException extends InvalidDataException {
+public final class RIFFInvalidDataException extends InvalidDataException {
private static final long serialVersionUID = 1L;
--- a/jdk/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class RIFFInvalidFormatException extends InvalidFormatException {
+public final class RIFFInvalidFormatException extends InvalidFormatException {
private static final long serialVersionUID = 1L;
--- a/jdk/src/share/classes/com/sun/media/sound/RIFFReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/RIFFReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,11 +33,11 @@
*
* @author Karl Helgason
*/
-public class RIFFReader extends InputStream {
+public final class RIFFReader extends InputStream {
- private RIFFReader root;
+ private final RIFFReader root;
private long filepointer = 0;
- private String fourcc;
+ private final String fourcc;
private String riff_type = null;
private long ckSize = 0;
private InputStream stream;
--- a/jdk/src/share/classes/com/sun/media/sound/RIFFWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/RIFFWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
*
* @author Karl Helgason
*/
-public class RIFFWriter extends OutputStream {
+public final class RIFFWriter extends OutputStream {
private interface RandomAccessWriter {
@@ -60,11 +60,11 @@
RandomAccessFile raf;
- public RandomAccessFileWriter(File file) throws FileNotFoundException {
+ RandomAccessFileWriter(File file) throws FileNotFoundException {
this.raf = new RandomAccessFile(file, "rw");
}
- public RandomAccessFileWriter(String name) throws FileNotFoundException {
+ RandomAccessFileWriter(String name) throws FileNotFoundException {
this.raf = new RandomAccessFile(name, "rw");
}
@@ -107,9 +107,9 @@
int length = 0;
int pos = 0;
byte[] s;
- OutputStream stream;
+ final OutputStream stream;
- public RandomAccessByteWriter(OutputStream stream) {
+ RandomAccessByteWriter(OutputStream stream) {
this.stream = stream;
}
@@ -163,8 +163,8 @@
}
private int chunktype = 0; // 0=RIFF, 1=LIST; 2=CHUNK
private RandomAccessWriter raf;
- private long chunksizepointer;
- private long startpointer;
+ private final long chunksizepointer;
+ private final long startpointer;
private RIFFWriter childchunk = null;
private boolean open = true;
private boolean writeoverride = false;
--- a/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,13 @@
package com.sun.media.sound;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.DataOutputStream;
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.*;
@@ -46,7 +45,8 @@
/* TODO:
* - rename PlayThread to PlayEngine (because isn't a thread)
*/
-class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoConnectSequencer {
+final class RealTimeSequencer extends AbstractMidiDevice
+ implements Sequencer, AutoConnectSequencer {
// STATIC VARIABLES
@@ -58,7 +58,8 @@
* Event Dispatcher thread. Should be using a shared event
* dispatcher instance with a factory in EventDispatcher
*/
- private static final EventDispatcher eventDispatcher;
+ private static final Map<ThreadGroup, EventDispatcher> dispatchers =
+ new WeakHashMap<>();
/**
* All RealTimeSequencers share this info object.
@@ -66,11 +67,11 @@
static final RealTimeSequencerInfo info = new RealTimeSequencerInfo();
- private static Sequencer.SyncMode[] masterSyncModes = { Sequencer.SyncMode.INTERNAL_CLOCK };
- private static Sequencer.SyncMode[] slaveSyncModes = { Sequencer.SyncMode.NO_SYNC };
+ private static final Sequencer.SyncMode[] masterSyncModes = { Sequencer.SyncMode.INTERNAL_CLOCK };
+ private static final Sequencer.SyncMode[] slaveSyncModes = { Sequencer.SyncMode.NO_SYNC };
- private static Sequencer.SyncMode masterSyncMode = Sequencer.SyncMode.INTERNAL_CLOCK;
- private static Sequencer.SyncMode slaveSyncMode = Sequencer.SyncMode.NO_SYNC;
+ private static final Sequencer.SyncMode masterSyncMode = Sequencer.SyncMode.INTERNAL_CLOCK;
+ private static final Sequencer.SyncMode slaveSyncMode = Sequencer.SyncMode.NO_SYNC;
/**
@@ -100,7 +101,7 @@
private boolean[] trackSolo = null;
/** tempo cache for getMicrosecondPosition */
- private MidiUtils.TempoCache tempoCache = new MidiUtils.TempoCache();
+ private final MidiUtils.TempoCache tempoCache = new MidiUtils.TempoCache();
/**
* True if the sequence is running.
@@ -121,7 +122,7 @@
/**
* List of tracks to which we're recording
*/
- private List recordingTracks = new ArrayList();
+ private final List recordingTracks = new ArrayList();
private long loopStart = 0;
@@ -132,13 +133,13 @@
/**
* Meta event listeners
*/
- private ArrayList metaEventListeners = new ArrayList();
+ private final ArrayList metaEventListeners = new ArrayList();
/**
* Control change listeners
*/
- private ArrayList controllerEventListeners = new ArrayList();
+ private final ArrayList controllerEventListeners = new ArrayList();
/** automatic connection support */
@@ -151,16 +152,9 @@
Receiver autoConnectedReceiver = null;
- static {
- // create and start the global event thread
- eventDispatcher = new EventDispatcher();
- eventDispatcher.start();
- }
-
-
/* ****************************** CONSTRUCTOR ****************************** */
- protected RealTimeSequencer() throws MidiUnavailableException {
+ RealTimeSequencer() throws MidiUnavailableException {
super(info);
if (Printer.trace) Printer.trace(">> RealTimeSequencer CONSTRUCTOR");
@@ -574,7 +568,7 @@
return returnedModes;
}
- protected int getTrackCount() {
+ int getTrackCount() {
Sequence seq = getSequence();
if (seq != null) {
// $$fb wish there was a nicer way to get the number of tracks...
@@ -872,7 +866,7 @@
if (Printer.trace) Printer.trace("<< RealTimeSequencer: implClose() completed");
}
- protected void implStart() {
+ void implStart() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStart()");
if (playThread == null) {
@@ -889,7 +883,7 @@
}
- protected void implStop() {
+ void implStop() {
if (Printer.trace) Printer.trace(">> RealTimeSequencer: implStop()");
if (playThread == null) {
@@ -905,22 +899,36 @@
if (Printer.trace) Printer.trace("<< RealTimeSequencer: implStop() completed");
}
+ private static EventDispatcher getEventDispatcher() {
+ // create and start the global event thread
+ //TODO need a way to stop this thread when the engine is done
+ final ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ synchronized (dispatchers) {
+ EventDispatcher eventDispatcher = dispatchers.get(tg);
+ if (eventDispatcher == null) {
+ eventDispatcher = new EventDispatcher();
+ dispatchers.put(tg, eventDispatcher);
+ eventDispatcher.start();
+ }
+ return eventDispatcher;
+ }
+ }
/**
* Send midi player events.
* must not be synchronized on "this"
*/
- protected void sendMetaEvents(MidiMessage message) {
+ void sendMetaEvents(MidiMessage message) {
if (metaEventListeners.size() == 0) return;
//if (Printer.debug) Printer.debug("sending a meta event");
- eventDispatcher.sendAudioEvents(message, metaEventListeners);
+ getEventDispatcher().sendAudioEvents(message, metaEventListeners);
}
/**
* Send midi player events.
*/
- protected void sendControllerEvents(MidiMessage message) {
+ void sendControllerEvents(MidiMessage message) {
int size = controllerEventListeners.size();
if (size == 0) return;
@@ -942,7 +950,7 @@
}
}
}
- eventDispatcher.sendAudioEvents(message, sendToListeners);
+ getEventDispatcher().sendAudioEvents(message, sendToListeners);
}
@@ -1024,7 +1032,7 @@
}
- class SequencerReceiver extends AbstractReceiver {
+ final class SequencerReceiver extends AbstractReceiver {
void implSend(MidiMessage message, long timeStamp) {
if (recording) {
@@ -1092,7 +1100,7 @@
// easier to deal with than turning all the
// ints into objects to use a Vector
int [] controllers;
- ControllerEventListener listener;
+ final ControllerEventListener listener;
private ControllerListElement(ControllerEventListener listener, int[] controllers) {
@@ -1197,7 +1205,7 @@
static class RecordingTrack {
- private Track track;
+ private final Track track;
private int channel;
RecordingTrack(Track track, int channel) {
@@ -1237,15 +1245,15 @@
}
- class PlayThread implements Runnable {
+ final class PlayThread implements Runnable {
private Thread thread;
- private Object lock = new Object();
+ private final Object lock = new Object();
/** true if playback is interrupted (in close) */
boolean interrupted = false;
boolean isPumping = false;
- private DataPump dataPump = new DataPump();
+ private final DataPump dataPump = new DataPump();
PlayThread() {
--- a/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencerProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
*
* @author Florian Bomers
*/
-public class RealTimeSequencerProvider extends MidiDeviceProvider {
+public final class RealTimeSequencerProvider extends MidiDeviceProvider {
public MidiDevice.Info[] getDeviceInfo() {
--- a/jdk/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,5 +29,5 @@
*
* @author Karl Helgason
*/
-public class SF2GlobalRegion extends SF2Region {
+public final class SF2GlobalRegion extends SF2Region {
}
--- a/jdk/src/share/classes/com/sun/media/sound/SF2Instrument.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2Instrument.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,16 +36,16 @@
*
* @author Karl Helgason
*/
-public class SF2Instrument extends ModelInstrument {
+public final class SF2Instrument extends ModelInstrument {
- protected String name = "";
- protected int preset = 0;
- protected int bank = 0;
- protected long library = 0;
- protected long genre = 0;
- protected long morphology = 0;
- protected SF2GlobalRegion globalregion = null;
- protected List<SF2InstrumentRegion> regions
+ String name = "";
+ int preset = 0;
+ int bank = 0;
+ long library = 0;
+ long genre = 0;
+ long morphology = 0;
+ SF2GlobalRegion globalregion = null;
+ List<SF2InstrumentRegion> regions
= new ArrayList<SF2InstrumentRegion>();
public SF2Instrument() {
@@ -730,7 +730,7 @@
return msrc;
}
- protected static ModelDestination convertDestination(int dst,
+ static ModelDestination convertDestination(int dst,
double[] amountcorrection, ModelSource[] extrasrc) {
ModelIdentifier id = null;
switch (dst) {
--- a/jdk/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,9 @@
*
* @author Karl Helgason
*/
-public class SF2InstrumentRegion extends SF2Region {
+public final class SF2InstrumentRegion extends SF2Region {
- protected SF2Layer layer;
+ SF2Layer layer;
public SF2Layer getLayer() {
return layer;
--- a/jdk/src/share/classes/com/sun/media/sound/SF2Layer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2Layer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,11 +34,11 @@
*
* @author Karl Helgason
*/
-public class SF2Layer extends SoundbankResource {
+public final class SF2Layer extends SoundbankResource {
- protected String name = "";
- protected SF2GlobalRegion globalregion = null;
- protected List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
+ String name = "";
+ SF2GlobalRegion globalregion = null;
+ List<SF2LayerRegion> regions = new ArrayList<SF2LayerRegion>();
public SF2Layer(SF2Soundbank soundBank) {
super(soundBank, null, null);
--- a/jdk/src/share/classes/com/sun/media/sound/SF2LayerRegion.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2LayerRegion.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,9 @@
*
* @author Karl Helgason
*/
-public class SF2LayerRegion extends SF2Region {
+public final class SF2LayerRegion extends SF2Region {
- protected SF2Sample sample;
+ SF2Sample sample;
public SF2Sample getSample() {
return sample;
--- a/jdk/src/share/classes/com/sun/media/sound/SF2Modulator.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2Modulator.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class SF2Modulator {
+public final class SF2Modulator {
public final static int SOURCE_NONE = 0;
public final static int SOURCE_NOTE_ON_VELOCITY = 2;
@@ -49,11 +49,11 @@
public final static int SOURCE_TYPE_SWITCH = 1024 * 3;
public final static int TRANSFORM_LINEAR = 0;
public final static int TRANSFORM_ABSOLUTE = 2;
- protected int sourceOperator;
- protected int destinationOperator;
- protected short amount;
- protected int amountSourceOperator;
- protected int transportOperator;
+ int sourceOperator;
+ int destinationOperator;
+ short amount;
+ int amountSourceOperator;
+ int transportOperator;
public short getAmount() {
return amount;
--- a/jdk/src/share/classes/com/sun/media/sound/SF2Sample.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2Sample.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,18 +36,18 @@
*
* @author Karl Helgason
*/
-public class SF2Sample extends SoundbankResource {
+public final class SF2Sample extends SoundbankResource {
- protected String name = "";
- protected long startLoop = 0;
- protected long endLoop = 0;
- protected long sampleRate = 44100;
- protected int originalPitch = 60;
- protected byte pitchCorrection = 0;
- protected int sampleLink = 0;
- protected int sampleType = 0;
- protected ModelByteBuffer data;
- protected ModelByteBuffer data24;
+ String name = "";
+ long startLoop = 0;
+ long endLoop = 0;
+ long sampleRate = 44100;
+ int originalPitch = 60;
+ byte pitchCorrection = 0;
+ int sampleLink = 0;
+ int sampleType = 0;
+ ModelByteBuffer data;
+ ModelByteBuffer data24;
public SF2Sample(Soundbank soundBank) {
super(soundBank, null, AudioInputStream.class);
--- a/jdk/src/share/classes/com/sun/media/sound/SF2Soundbank.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2Soundbank.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,40 +50,40 @@
*
* @author Karl Helgason
*/
-public class SF2Soundbank implements Soundbank {
+public final class SF2Soundbank implements Soundbank {
// version of the Sound Font RIFF file
- protected int major = 2;
- protected int minor = 1;
+ int major = 2;
+ int minor = 1;
// target Sound Engine
- protected String targetEngine = "EMU8000";
+ String targetEngine = "EMU8000";
// Sound Font Bank Name
- protected String name = "untitled";
+ String name = "untitled";
// Sound ROM Name
- protected String romName = null;
+ String romName = null;
// Sound ROM Version
- protected int romVersionMajor = -1;
- protected int romVersionMinor = -1;
+ int romVersionMajor = -1;
+ int romVersionMinor = -1;
// Date of Creation of the Bank
- protected String creationDate = null;
+ String creationDate = null;
// Sound Designers and Engineers for the Bank
- protected String engineers = null;
+ String engineers = null;
// Product for which the Bank was intended
- protected String product = null;
+ String product = null;
// Copyright message
- protected String copyright = null;
+ String copyright = null;
// Comments
- protected String comments = null;
+ String comments = null;
// The SoundFont tools used to create and alter the bank
- protected String tools = null;
+ String tools = null;
// The Sample Data loaded from the SoundFont
private ModelByteBuffer sampleData = null;
private ModelByteBuffer sampleData24 = null;
private File sampleFile = null;
private boolean largeFormat = false;
- private List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
- private List<SF2Layer> layers = new ArrayList<SF2Layer>();
- private List<SF2Sample> samples = new ArrayList<SF2Sample>();
+ private final List<SF2Instrument> instruments = new ArrayList<SF2Instrument>();
+ private final List<SF2Layer> layers = new ArrayList<SF2Layer>();
+ private final List<SF2Sample> samples = new ArrayList<SF2Sample>();
public SF2Soundbank() {
}
--- a/jdk/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
*
* @author Karl Helgason
*/
-public class SF2SoundbankReader extends SoundbankReader {
+public final class SF2SoundbankReader extends SoundbankReader {
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
float samplerateconv = 1;
float pitchcorrection = 0;
- public ModelAbstractResamplerStream() {
+ ModelAbstractResamplerStream() {
pad = getPadding();
pad2 = getPadding() * 2;
ibuffer = new float[2][sector_size + pad2];
@@ -384,7 +384,7 @@
float in_end, float[] pitch, float pitchstep, float[] out,
int[] out_offset, int out_end);
- public SoftResamplerStreamer openStreamer() {
+ public final SoftResamplerStreamer openStreamer() {
return new ModelAbstractResamplerStream();
}
}
--- a/jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
*
* @author Karl Helgason
*/
-public class SoftAudioBuffer {
+public final class SoftAudioBuffer {
private int size;
private float[] buffer;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,13 @@
*
* @author Karl Helgason
*/
-public class SoftAudioPusher implements Runnable {
+public final class SoftAudioPusher implements Runnable {
private volatile boolean active = false;
private SourceDataLine sourceDataLine = null;
private Thread audiothread;
- private AudioInputStream ais;
- private byte[] buffer;
+ private final AudioInputStream ais;
+ private final byte[] buffer;
public SoftAudioPusher(SourceDataLine sourceDataLine, AudioInputStream ais,
int workbuffersizer) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
*
* @author Karl Helgason
*/
-public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
+public final class SoftChannel implements MidiChannel, ModelDirectedPlayer {
private static boolean[] dontResetControls = new boolean[128];
static {
@@ -90,15 +90,15 @@
private static final int RPN_NULL_VALUE = (127 << 7) + 127;
private int rpn_control = RPN_NULL_VALUE;
private int nrpn_control = RPN_NULL_VALUE;
- protected double portamento_time = 1; // keyschanges per control buffer time
- protected int[] portamento_lastnote = new int[128];
- protected int portamento_lastnote_ix = 0;
+ double portamento_time = 1; // keyschanges per control buffer time
+ int[] portamento_lastnote = new int[128];
+ int portamento_lastnote_ix = 0;
private boolean portamento = false;
private boolean mono = false;
private boolean mute = false;
private boolean solo = false;
private boolean solomute = false;
- private Object control_mutex;
+ private final Object control_mutex;
private int channel;
private SoftVoice[] voices;
private int bank;
@@ -111,21 +111,21 @@
private int pitchbend;
private double[] co_midi_pitch = new double[1];
private double[] co_midi_channel_pressure = new double[1];
- protected SoftTuning tuning = new SoftTuning();
- protected int tuning_bank = 0;
- protected int tuning_program = 0;
- protected SoftInstrument current_instrument = null;
- protected ModelChannelMixer current_mixer = null;
- protected ModelDirector current_director = null;
+ SoftTuning tuning = new SoftTuning();
+ int tuning_bank = 0;
+ int tuning_program = 0;
+ SoftInstrument current_instrument = null;
+ ModelChannelMixer current_mixer = null;
+ ModelDirector current_director = null;
// Controller Destination Settings
- protected int cds_control_number = -1;
- protected ModelConnectionBlock[] cds_control_connections = null;
- protected ModelConnectionBlock[] cds_channelpressure_connections = null;
- protected ModelConnectionBlock[] cds_polypressure_connections = null;
- protected boolean sustain = false;
- protected boolean[][] keybasedcontroller_active = null;
- protected double[][] keybasedcontroller_value = null;
+ int cds_control_number = -1;
+ ModelConnectionBlock[] cds_control_connections = null;
+ ModelConnectionBlock[] cds_channelpressure_connections = null;
+ ModelConnectionBlock[] cds_polypressure_connections = null;
+ boolean sustain = false;
+ boolean[][] keybasedcontroller_active = null;
+ double[][] keybasedcontroller_value = null;
private class MidiControlObject implements SoftControl {
double[] pitch = co_midi_pitch;
@@ -336,7 +336,7 @@
}
- protected void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
+ void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
int noteNumber, int velocity, int delay, ModelConnectionBlock[] connectionBlocks,
ModelChannelMixer channelmixer, boolean releaseTriggered) {
if (voice.active) {
@@ -414,7 +414,7 @@
/* A special noteOn with delay parameter, which is used to
* start note within control buffers.
*/
- protected void noteOn(int noteNumber, int velocity, int delay) {
+ void noteOn(int noteNumber, int velocity, int delay) {
noteNumber = restrict7Bit(noteNumber);
velocity = restrict7Bit(velocity);
noteOn_internal(noteNumber, velocity, delay);
@@ -707,7 +707,7 @@
}
}
- protected void applyInstrumentCustomization() {
+ void applyInstrumentCustomization() {
if (cds_control_connections == null
&& cds_channelpressure_connections == null
&& cds_polypressure_connections == null) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftChannelProxy.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannelProxy.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
*
* @author Karl Helgason
*/
-public class SoftChannelProxy implements MidiChannel {
+public final class SoftChannelProxy implements MidiChannel {
private MidiChannel channel = null;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,11 @@
*
* @author Karl Helgason
*/
-public class SoftChorus implements SoftAudioProcessor {
+public final class SoftChorus implements SoftAudioProcessor {
private static class VariableDelay {
- private float[] delaybuffer;
+ private final float[] delaybuffer;
private int rovepos = 0;
private float gain = 1;
private float rgain = 0;
@@ -44,7 +44,7 @@
private float lastdelay = 0;
private float feedback = 0;
- public VariableDelay(int maxbuffersize) {
+ VariableDelay(int maxbuffersize) {
delaybuffer = new float[maxbuffersize];
}
@@ -119,10 +119,10 @@
private double phase_step = 0;
private double depth = 0;
private VariableDelay vdelay;
- private double samplerate;
- private double controlrate;
+ private final double samplerate;
+ private final double controlrate;
- public LFODelay(double samplerate, double controlrate) {
+ LFODelay(double samplerate, double controlrate) {
this.samplerate = samplerate;
this.controlrate = controlrate;
// vdelay = new VariableDelay((int)(samplerate*4));
--- a/jdk/src/share/classes/com/sun/media/sound/SoftCubicResampler.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftCubicResampler.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class SoftCubicResampler extends SoftAbstractResampler {
+public final class SoftCubicResampler extends SoftAbstractResampler {
public int getPadding() {
return 3;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class SoftEnvelopeGenerator implements SoftProcess {
+public final class SoftEnvelopeGenerator implements SoftProcess {
public final static int EG_OFF = 0;
public final static int EG_DELAY = 1;
@@ -42,23 +42,23 @@
public final static int EG_END = 8;
int max_count = 10;
int used_count = 0;
- private int[] stage = new int[max_count];
- private int[] stage_ix = new int[max_count];
- private double[] stage_v = new double[max_count];
- private int[] stage_count = new int[max_count];
- private double[][] on = new double[max_count][1];
- private double[][] active = new double[max_count][1];
- private double[][] out = new double[max_count][1];
- private double[][] delay = new double[max_count][1];
- private double[][] attack = new double[max_count][1];
- private double[][] hold = new double[max_count][1];
- private double[][] decay = new double[max_count][1];
- private double[][] sustain = new double[max_count][1];
- private double[][] release = new double[max_count][1];
- private double[][] shutdown = new double[max_count][1];
- private double[][] release2 = new double[max_count][1];
- private double[][] attack2 = new double[max_count][1];
- private double[][] decay2 = new double[max_count][1];
+ private final int[] stage = new int[max_count];
+ private final int[] stage_ix = new int[max_count];
+ private final double[] stage_v = new double[max_count];
+ private final int[] stage_count = new int[max_count];
+ private final double[][] on = new double[max_count][1];
+ private final double[][] active = new double[max_count][1];
+ private final double[][] out = new double[max_count][1];
+ private final double[][] delay = new double[max_count][1];
+ private final double[][] attack = new double[max_count][1];
+ private final double[][] hold = new double[max_count][1];
+ private final double[][] decay = new double[max_count][1];
+ private final double[][] sustain = new double[max_count][1];
+ private final double[][] release = new double[max_count][1];
+ private final double[][] shutdown = new double[max_count][1];
+ private final double[][] release2 = new double[max_count][1];
+ private final double[][] attack2 = new double[max_count][1];
+ private final double[][] decay2 = new double[max_count][1];
private double control_time = 0;
public void reset() {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
*
* @author Karl Helgason
*/
-public class SoftFilter {
+public final class SoftFilter {
public final static int FILTERTYPE_LP6 = 0x00;
public final static int FILTERTYPE_LP12 = 0x01;
@@ -55,7 +55,7 @@
// 0x30 = NP, Notch or Band Elimination Filter
//
private int filtertype = FILTERTYPE_LP6;
- private float samplerate;
+ private final float samplerate;
private float x1;
private float x2;
private float y1;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,12 @@
*
* @author Karl Helgason
*/
-public class SoftInstrument extends Instrument {
+public final class SoftInstrument extends Instrument {
private SoftPerformer[] performers;
private ModelPerformer[] modelperformers;
- private Object data;
- private ModelInstrument ins;
+ private final Object data;
+ private final ModelInstrument ins;
public SoftInstrument(ModelInstrument ins) {
super(ins.getSoundbank(), ins.getPatch(), ins.getName(),
--- a/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
*
* @author Karl Helgason
*/
-public class SoftJitterCorrector extends AudioInputStream {
+public final class SoftJitterCorrector extends AudioInputStream {
private static class JitterStream extends InputStream {
@@ -48,7 +48,7 @@
int writepos = 0;
int readpos = 0;
byte[][] buffers;
- Object buffers_mutex = new Object();
+ private final Object buffers_mutex = new Object();
// Adapative Drift Statistics
int w_count = 1000;
@@ -112,7 +112,7 @@
}
}
- public JitterStream(AudioInputStream s, int buffersize,
+ JitterStream(AudioInputStream s, int buffersize,
int smallbuffersize) {
this.w_count = 10 * (buffersize / smallbuffersize);
if (w_count < 100)
--- a/jdk/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class SoftLanczosResampler extends SoftAbstractResampler {
+public final class SoftLanczosResampler extends SoftAbstractResampler {
float[][] sinc_table;
int sinc_table_fsize = 2000;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
*
* @author Karl Helgason
*/
-public class SoftLimiter implements SoftAudioProcessor {
+public final class SoftLimiter implements SoftAudioProcessor {
float lastmax = 0;
float gain = 1;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class SoftLinearResampler extends SoftAbstractResampler {
+public final class SoftLinearResampler extends SoftAbstractResampler {
public int getPadding() {
return 2;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
*
* @author Karl Helgason
*/
-public class SoftLinearResampler2 extends SoftAbstractResampler {
+public final class SoftLinearResampler2 extends SoftAbstractResampler {
public int getPadding() {
return 2;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,21 +29,21 @@
*
* @author Karl Helgason
*/
-public class SoftLowFrequencyOscillator implements SoftProcess {
+public final class SoftLowFrequencyOscillator implements SoftProcess {
- private int max_count = 10;
+ private final int max_count = 10;
private int used_count = 0;
- private double[][] out = new double[max_count][1];
- private double[][] delay = new double[max_count][1];
- private double[][] delay2 = new double[max_count][1];
- private double[][] freq = new double[max_count][1];
- private int[] delay_counter = new int[max_count];
- private double[] sin_phase = new double[max_count];
- private double[] sin_stepfreq = new double[max_count];
- private double[] sin_step = new double[max_count];
+ private final double[][] out = new double[max_count][1];
+ private final double[][] delay = new double[max_count][1];
+ private final double[][] delay2 = new double[max_count][1];
+ private final double[][] freq = new double[max_count][1];
+ private final int[] delay_counter = new int[max_count];
+ private final double[] sin_phase = new double[max_count];
+ private final double[] sin_stepfreq = new double[max_count];
+ private final double[] sin_step = new double[max_count];
private double control_time = 0;
private double sin_factor = 0;
- private static double PI2 = 2.0 * Math.PI;
+ private static final double PI2 = 2.0 * Math.PI;
public SoftLowFrequencyOscillator() {
// If sin_step is 0 then sin_stepfreq must be -INF
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
*
* @author Karl Helgason
*/
-public class SoftMainMixer {
+public final class SoftMainMixer {
// A private class thats contains a ModelChannelMixer and it's private buffers.
// This becomes necessary when we want to have separate delay buffers for each channel mixer.
@@ -67,13 +67,13 @@
public final static int CHANNEL_RIGHT_DRY = 11;
public final static int CHANNEL_SCRATCH1 = 12;
public final static int CHANNEL_SCRATCH2 = 13;
- protected boolean active_sensing_on = false;
+ boolean active_sensing_on = false;
private long msec_last_activity = -1;
private boolean pusher_silent = false;
private int pusher_silent_count = 0;
private long sample_pos = 0;
- protected boolean readfully = true;
- private Object control_mutex;
+ boolean readfully = true;
+ private final Object control_mutex;
private SoftSynthesizer synth;
private float samplerate = 44100;
private int nrofchannels = 2;
@@ -84,7 +84,7 @@
private SoftAudioProcessor agc;
private long msec_buffer_len = 0;
private int buffer_len = 0;
- protected TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
+ TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
private int delay_midievent = 0;
private int max_delay_midievent = 0;
double last_volume_left = 1.0;
@@ -97,7 +97,7 @@
private Set<SoftChannelMixerContainer> registeredMixers = null;
private Set<ModelChannelMixer> stoppedMixers = null;
private SoftChannelMixerContainer[] cur_registeredMixers = null;
- protected SoftControl co_master = new SoftControl() {
+ SoftControl co_master = new SoftControl() {
double[] balance = co_master_balance;
double[] volume = co_master_volume;
@@ -438,7 +438,7 @@
delay_midievent = 0;
}
- protected void processAudioBuffers() {
+ void processAudioBuffers() {
if(synth.weakstream != null && synth.weakstream.silent_samples != 0)
{
@@ -859,16 +859,16 @@
InputStream in = new InputStream() {
- private SoftAudioBuffer[] buffers = SoftMainMixer.this.buffers;
- private int nrofchannels
+ private final SoftAudioBuffer[] buffers = SoftMainMixer.this.buffers;
+ private final int nrofchannels
= SoftMainMixer.this.synth.getFormat().getChannels();
- private int buffersize = buffers[0].getSize();
- private byte[] bbuffer = new byte[buffersize
+ private final int buffersize = buffers[0].getSize();
+ private final byte[] bbuffer = new byte[buffersize
* (SoftMainMixer.this.synth.getFormat()
.getSampleSizeInBits() / 8)
* nrofchannels];
private int bbuffer_pos = 0;
- private byte[] single = new byte[1];
+ private final byte[] single = new byte[1];
public void fillBuffer() {
/*
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
*
* @author Karl Helgason
*/
-public class SoftMidiAudioFileReader extends AudioFileReader {
+public final class SoftMidiAudioFileReader extends AudioFileReader {
public static final Type MIDI = new Type("MIDI", "mid");
private static AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingClip.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingClip.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
*
* @author Karl Helgason
*/
-public class SoftMixingClip extends SoftMixingDataLine implements Clip {
+public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
private AudioFormat format;
@@ -50,7 +50,7 @@
private byte[] data;
- private InputStream datastream = new InputStream() {
+ private final InputStream datastream = new InputStream() {
public int read() throws IOException {
byte[] b = new byte[1];
@@ -162,7 +162,7 @@
private AudioFloatInputStream afis;
- protected SoftMixingClip(SoftMixingMixer mixer, DataLine.Info info) {
+ SoftMixingClip(SoftMixingMixer mixer, DataLine.Info info) {
super(mixer, info);
}
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,22 +50,22 @@
"Chorus Send") {
};
- protected static class AudioFloatInputStreamResampler extends
+ protected static final class AudioFloatInputStreamResampler extends
AudioFloatInputStream {
- private AudioFloatInputStream ais;
+ private final AudioFloatInputStream ais;
- private AudioFormat targetFormat;
+ private final AudioFormat targetFormat;
private float[] skipbuffer;
private SoftAbstractResampler resampler;
- private float[] pitch = new float[1];
+ private final float[] pitch = new float[1];
- private float[] ibuffer2;
+ private final float[] ibuffer2;
- private float[][] ibuffer;
+ private final float[][] ibuffer;
private float ibuffer_index = 0;
@@ -75,15 +75,15 @@
private float[][] cbuffer;
- private int buffer_len = 512;
+ private final int buffer_len = 512;
- private int pad;
+ private final int pad;
- private int pad2;
+ private final int pad2;
- private float[] ix = new float[1];
+ private final float[] ix = new float[1];
- private int[] ox = new int[1];
+ private final int[] ox = new int[1];
private float[][] mark_ibuffer = null;
@@ -294,7 +294,7 @@
}
- private class Gain extends FloatControl {
+ private final class Gain extends FloatControl {
private Gain() {
@@ -308,7 +308,7 @@
}
}
- private class Mute extends BooleanControl {
+ private final class Mute extends BooleanControl {
private Mute() {
super(BooleanControl.Type.MUTE, false, "True", "False");
@@ -320,7 +320,7 @@
}
}
- private class ApplyReverb extends BooleanControl {
+ private final class ApplyReverb extends BooleanControl {
private ApplyReverb() {
super(BooleanControl.Type.APPLY_REVERB, false, "True", "False");
@@ -333,7 +333,7 @@
}
- private class Balance extends FloatControl {
+ private final class Balance extends FloatControl {
private Balance() {
super(FloatControl.Type.BALANCE, -1.0f, 1.0f, (1.0f / 128.0f), -1,
@@ -347,7 +347,7 @@
}
- private class Pan extends FloatControl {
+ private final class Pan extends FloatControl {
private Pan() {
super(FloatControl.Type.PAN, -1.0f, 1.0f, (1.0f / 128.0f), -1,
@@ -365,7 +365,7 @@
}
- private class ReverbSend extends FloatControl {
+ private final class ReverbSend extends FloatControl {
private ReverbSend() {
super(FloatControl.Type.REVERB_SEND, -80f, 6.0206f, 80f / 128.0f,
@@ -379,7 +379,7 @@
}
- private class ChorusSend extends FloatControl {
+ private final class ChorusSend extends FloatControl {
private ChorusSend() {
super(CHORUS_SEND, -80f, 6.0206f, 80f / 128.0f, -1, -80f, "dB",
@@ -393,43 +393,43 @@
}
- private Gain gain_control = new Gain();
+ private final Gain gain_control = new Gain();
- private Mute mute_control = new Mute();
+ private final Mute mute_control = new Mute();
- private Balance balance_control = new Balance();
+ private final Balance balance_control = new Balance();
- private Pan pan_control = new Pan();
+ private final Pan pan_control = new Pan();
- private ReverbSend reverbsend_control = new ReverbSend();
+ private final ReverbSend reverbsend_control = new ReverbSend();
- private ChorusSend chorussend_control = new ChorusSend();
+ private final ChorusSend chorussend_control = new ChorusSend();
- private ApplyReverb apply_reverb = new ApplyReverb();
+ private final ApplyReverb apply_reverb = new ApplyReverb();
- private Control[] controls;
+ private final Control[] controls;
- protected float leftgain = 1;
+ float leftgain = 1;
- protected float rightgain = 1;
+ float rightgain = 1;
- protected float eff1gain = 0;
+ float eff1gain = 0;
- protected float eff2gain = 0;
+ float eff2gain = 0;
- protected List<LineListener> listeners = new ArrayList<LineListener>();
+ List<LineListener> listeners = new ArrayList<LineListener>();
- protected Object control_mutex;
+ final Object control_mutex;
- protected SoftMixingMixer mixer;
+ SoftMixingMixer mixer;
- protected DataLine.Info info;
+ DataLine.Info info;
protected abstract void processControlLogic();
protected abstract void processAudioLogic(SoftAudioBuffer[] buffers);
- protected SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
+ SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
this.mixer = mixer;
this.info = info;
this.control_mutex = mixer.control_mutex;
@@ -440,7 +440,7 @@
calcVolume();
}
- protected void calcVolume() {
+ final void calcVolume() {
synchronized (control_mutex) {
double gain = Math.pow(10.0, gain_control.getValue() / 20.0);
if (mute_control.getValue())
@@ -466,7 +466,7 @@
}
}
- protected void sendEvent(LineEvent event) {
+ final void sendEvent(LineEvent event) {
if (listeners.size() == 0)
return;
LineListener[] listener_array = listeners
@@ -476,23 +476,23 @@
}
}
- public void addLineListener(LineListener listener) {
+ public final void addLineListener(LineListener listener) {
synchronized (control_mutex) {
listeners.add(listener);
}
}
- public void removeLineListener(LineListener listener) {
+ public final void removeLineListener(LineListener listener) {
synchronized (control_mutex) {
listeners.add(listener);
}
}
- public javax.sound.sampled.Line.Info getLineInfo() {
+ public final javax.sound.sampled.Line.Info getLineInfo() {
return info;
}
- public Control getControl(Type control) {
+ public final Control getControl(Type control) {
if (control != null) {
for (int i = 0; i < controls.length; i++) {
if (controls[i].getType() == control) {
@@ -504,11 +504,11 @@
+ control);
}
- public Control[] getControls() {
+ public final Control[] getControls() {
return Arrays.copyOf(controls, controls.length);
}
- public boolean isControlSupported(Type control) {
+ public final boolean isControlSupported(Type control) {
if (control != null) {
for (int i = 0; i < controls.length; i++) {
if (controls[i].getType() == control) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
*
* @author Karl Helgason
*/
-public class SoftMixingMainMixer {
+public final class SoftMixingMainMixer {
public final static int CHANNEL_LEFT = 0;
@@ -63,23 +63,23 @@
public final static int CHANNEL_CHANNELMIXER_RIGHT = 15;
- private SoftMixingMixer mixer;
+ private final SoftMixingMixer mixer;
- private AudioInputStream ais;
+ private final AudioInputStream ais;
- private SoftAudioBuffer[] buffers;
+ private final SoftAudioBuffer[] buffers;
- private SoftAudioProcessor reverb;
+ private final SoftAudioProcessor reverb;
- private SoftAudioProcessor chorus;
+ private final SoftAudioProcessor chorus;
- private SoftAudioProcessor agc;
+ private final SoftAudioProcessor agc;
- private int nrofchannels;
+ private final int nrofchannels;
- private Object control_mutex;
+ private final Object control_mutex;
- private List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
+ private final List<SoftMixingDataLine> openLinesList = new ArrayList<SoftMixingDataLine>();
private SoftMixingDataLine[] openLines = new SoftMixingDataLine[0];
@@ -87,7 +87,7 @@
return ais;
}
- protected void processAudioBuffers() {
+ void processAudioBuffers() {
for (int i = 0; i < buffers.length; i++) {
buffers[i].clear();
}
@@ -162,20 +162,20 @@
InputStream in = new InputStream() {
- private SoftAudioBuffer[] buffers = SoftMixingMainMixer.this.buffers;
+ private final SoftAudioBuffer[] buffers = SoftMixingMainMixer.this.buffers;
- private int nrofchannels = SoftMixingMainMixer.this.mixer
+ private final int nrofchannels = SoftMixingMainMixer.this.mixer
.getFormat().getChannels();
- private int buffersize = buffers[0].getSize();
+ private final int buffersize = buffers[0].getSize();
- private byte[] bbuffer = new byte[buffersize
+ private final byte[] bbuffer = new byte[buffersize
* (SoftMixingMainMixer.this.mixer.getFormat()
.getSampleSizeInBits() / 8) * nrofchannels];
private int bbuffer_pos = 0;
- private byte[] single = new byte[1];
+ private final byte[] single = new byte[1];
public void fillBuffer() {
processAudioBuffers();
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingMixer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingMixer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,27 +48,27 @@
*
* @author Karl Helgason
*/
-public class SoftMixingMixer implements Mixer {
+public final class SoftMixingMixer implements Mixer {
private static class Info extends Mixer.Info {
- public Info() {
+ Info() {
super(INFO_NAME, INFO_VENDOR, INFO_DESCRIPTION, INFO_VERSION);
}
}
- protected static final String INFO_NAME = "Gervill Sound Mixer";
+ static final String INFO_NAME = "Gervill Sound Mixer";
- protected static final String INFO_VENDOR = "OpenJDK Proposal";
+ static final String INFO_VENDOR = "OpenJDK Proposal";
- protected static final String INFO_DESCRIPTION = "Software Sound Mixer";
+ static final String INFO_DESCRIPTION = "Software Sound Mixer";
- protected static final String INFO_VERSION = "1.0";
+ static final String INFO_VERSION = "1.0";
- protected final static Mixer.Info info = new Info();
+ static final Mixer.Info info = new Info();
- protected Object control_mutex = this;
+ final Object control_mutex = this;
- protected boolean implicitOpen = false;
+ boolean implicitOpen = false;
private boolean open = false;
@@ -82,15 +82,15 @@
private AudioInputStream pusher_stream = null;
- private float controlrate = 147f;
+ private final float controlrate = 147f;
- private long latency = 100000; // 100 msec
+ private final long latency = 100000; // 100 msec
- private boolean jitter_correction = false;
+ private final boolean jitter_correction = false;
- private List<LineListener> listeners = new ArrayList<LineListener>();
+ private final List<LineListener> listeners = new ArrayList<LineListener>();
- private javax.sound.sampled.Line.Info[] sourceLineInfo;
+ private final javax.sound.sampled.Line.Info[] sourceLineInfo;
public SoftMixingMixer() {
@@ -516,11 +516,11 @@
}
}
- protected float getControlRate() {
+ float getControlRate() {
return controlrate;
}
- protected SoftMixingMainMixer getMainMixer() {
+ SoftMixingMainMixer getMainMixer() {
if (!isOpen())
return null;
return mainmixer;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,13 +33,13 @@
*
* @author Karl Helgason
*/
-public class SoftMixingMixerProvider extends MixerProvider {
+public final class SoftMixingMixerProvider extends MixerProvider {
static SoftMixingMixer globalmixer = null;
static Thread lockthread = null;
- protected final static Object mutex = new Object();
+ static final Object mutex = new Object();
public Mixer getMixer(Info info) {
if (!(info == null || info == SoftMixingMixer.info)) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,8 @@
*
* @author Karl Helgason
*/
-public class SoftMixingSourceDataLine extends SoftMixingDataLine implements
- SourceDataLine {
+public final class SoftMixingSourceDataLine extends SoftMixingDataLine
+ implements SourceDataLine {
private boolean open = false;
@@ -72,7 +72,7 @@
AudioFloatInputStream {
AudioFloatInputStream ais;
- public NonBlockingFloatInputStream(AudioFloatInputStream ais) {
+ NonBlockingFloatInputStream(AudioFloatInputStream ais) {
this.ais = ais;
}
@@ -120,7 +120,7 @@
}
- protected SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) {
+ SoftMixingSourceDataLine(SoftMixingMixer mixer, DataLine.Info info) {
super(mixer, info);
}
--- a/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
*
* @author Karl Helgason
*/
-public class SoftPerformer {
+public final class SoftPerformer {
static ModelConnectionBlock[] defaultconnections
= new ModelConnectionBlock[42];
--- a/jdk/src/share/classes/com/sun/media/sound/SoftPointResampler.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftPointResampler.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*
* @author Karl Helgason
*/
-public class SoftPointResampler extends SoftAbstractResampler {
+public final class SoftPointResampler extends SoftAbstractResampler {
public int getPadding() {
return 100;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,10 @@
*
* @author Karl Helgason
*/
-public class SoftProvider extends MidiDeviceProvider {
+public final class SoftProvider extends MidiDeviceProvider {
- protected final static Info softinfo = SoftSynthesizer.info;
- private static Info[] softinfos = {softinfo};
+ static final Info softinfo = SoftSynthesizer.info;
+ private static final Info[] softinfos = {softinfo};
public MidiDevice.Info[] getDeviceInfo() {
return Arrays.copyOf(softinfos, softinfos.length);
--- a/jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,13 +36,13 @@
*
* @author Karl Helgason
*/
-public class SoftReceiver implements MidiDeviceReceiver {
+public final class SoftReceiver implements MidiDeviceReceiver {
- protected boolean open = true;
- private Object control_mutex;
- private SoftSynthesizer synth;
- protected TreeMap<Long, Object> midimessages;
- protected SoftMainMixer mainmixer;
+ boolean open = true;
+ private final Object control_mutex;
+ private final SoftSynthesizer synth;
+ TreeMap<Long, Object> midimessages;
+ SoftMainMixer mainmixer;
public SoftReceiver(SoftSynthesizer synth) {
this.control_mutex = synth.control_mutex;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,14 @@
*
* @author Karl Helgason
*/
-public class SoftReverb implements SoftAudioProcessor {
+public final class SoftReverb implements SoftAudioProcessor {
private final static class Delay {
private float[] delaybuffer;
private int rovepos = 0;
- public Delay() {
+ Delay() {
delaybuffer = null;
}
@@ -77,7 +77,7 @@
private int rovepos = 0;
private float feedback;
- public AllPass(int size) {
+ AllPass(int size) {
delaybuffer = new float[size];
delaybuffersize = size;
}
@@ -127,7 +127,7 @@
private float filtercoeff1 = 0;
private float filtercoeff2 = 1;
- public Comb(int size) {
+ Comb(int size) {
delaybuffer = new float[size];
delaybuffersize = size;
}
--- a/jdk/src/share/classes/com/sun/media/sound/SoftShortMessage.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftShortMessage.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
*
* @author Karl Helgason
*/
-public class SoftShortMessage extends ShortMessage {
+public final class SoftShortMessage extends ShortMessage {
int channel = 0;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftSincResampler.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftSincResampler.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
*
* @author Karl Helgason
*/
-public class SoftSincResampler extends SoftAbstractResampler {
+public final class SoftSincResampler extends SoftAbstractResampler {
float[][][] sinc_table;
int sinc_scale_size = 100;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,10 +66,10 @@
*
* @author Karl Helgason
*/
-public class SoftSynthesizer implements AudioSynthesizer,
+public final class SoftSynthesizer implements AudioSynthesizer,
ReferenceCountingDevice {
- protected static class WeakAudioStream extends InputStream
+ protected static final class WeakAudioStream extends InputStream
{
private volatile AudioInputStream stream;
public SoftAudioPusher pusher = null;
@@ -166,39 +166,39 @@
}
private static class Info extends MidiDevice.Info {
- public Info() {
+ Info() {
super(INFO_NAME, INFO_VENDOR, INFO_DESCRIPTION, INFO_VERSION);
}
}
- protected static final String INFO_NAME = "Gervill";
- protected static final String INFO_VENDOR = "OpenJDK";
- protected static final String INFO_DESCRIPTION = "Software MIDI Synthesizer";
- protected static final String INFO_VERSION = "1.0";
- protected final static MidiDevice.Info info = new Info();
+ static final String INFO_NAME = "Gervill";
+ static final String INFO_VENDOR = "OpenJDK";
+ static final String INFO_DESCRIPTION = "Software MIDI Synthesizer";
+ static final String INFO_VERSION = "1.0";
+ final static MidiDevice.Info info = new Info();
private static SourceDataLine testline = null;
private static Soundbank defaultSoundBank = null;
- protected WeakAudioStream weakstream = null;
+ WeakAudioStream weakstream = null;
- protected Object control_mutex = this;
+ final Object control_mutex = this;
- protected int voiceIDCounter = 0;
+ int voiceIDCounter = 0;
// 0: default
// 1: DLS Voice Allocation
- protected int voice_allocation_mode = 0;
+ int voice_allocation_mode = 0;
- protected boolean load_default_soundbank = false;
- protected boolean reverb_light = true;
- protected boolean reverb_on = true;
- protected boolean chorus_on = true;
- protected boolean agc_on = true;
+ boolean load_default_soundbank = false;
+ boolean reverb_light = true;
+ boolean reverb_on = true;
+ boolean chorus_on = true;
+ boolean agc_on = true;
- protected SoftChannel[] channels;
- protected SoftChannelProxy[] external_channels = null;
+ SoftChannel[] channels;
+ SoftChannelProxy[] external_channels = null;
private boolean largemode = false;
@@ -371,7 +371,7 @@
this.format = format;
}
- protected void removeReceiver(Receiver recv) {
+ void removeReceiver(Receiver recv) {
boolean perform_close = false;
synchronized (control_mutex) {
if (recvslist.remove(recv)) {
@@ -383,13 +383,13 @@
close();
}
- protected SoftMainMixer getMainMixer() {
+ SoftMainMixer getMainMixer() {
if (!isOpen())
return null;
return mainmixer;
}
- protected SoftInstrument findInstrument(int program, int bank, int channel) {
+ SoftInstrument findInstrument(int program, int bank, int channel) {
// Add support for GM2 banks 0x78 and 0x79
// as specified in DLS 2.2 in Section 1.4.6
@@ -450,31 +450,31 @@
return null;
}
- protected int getVoiceAllocationMode() {
+ int getVoiceAllocationMode() {
return voice_allocation_mode;
}
- protected int getGeneralMidiMode() {
+ int getGeneralMidiMode() {
return gmmode;
}
- protected void setGeneralMidiMode(int gmmode) {
+ void setGeneralMidiMode(int gmmode) {
this.gmmode = gmmode;
}
- protected int getDeviceID() {
+ int getDeviceID() {
return deviceid;
}
- protected float getControlRate() {
+ float getControlRate() {
return controlrate;
}
- protected SoftVoice[] getVoices() {
+ SoftVoice[] getVoices() {
return voices;
}
- protected SoftTuning getTuning(Patch patch) {
+ SoftTuning getTuning(Patch patch) {
String t_id = patchToString(patch);
SoftTuning tuning = tunings.get(t_id);
if (tuning == null) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,10 @@
*
* @author Karl Helgason
*/
-public class SoftTuning {
+public final class SoftTuning {
private String name = null;
- private double[] tuning = new double[128];
+ private final double[] tuning = new double[128];
private Patch patch = null;
public SoftTuning() {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
*
* @author Karl Helgason
*/
-public class SoftVoice extends VoiceStatus {
+public final class SoftVoice extends VoiceStatus {
public int exclusiveClass = 0;
public boolean releaseTriggered = false;
@@ -44,32 +44,32 @@
private int noteOn_velocity = 0;
private int noteOff_velocity = 0;
private int delay = 0;
- protected ModelChannelMixer channelmixer = null;
- protected double tunedKey = 0;
- protected SoftTuning tuning = null;
- protected SoftChannel stealer_channel = null;
- protected ModelConnectionBlock[] stealer_extendedConnectionBlocks = null;
- protected SoftPerformer stealer_performer = null;
- protected ModelChannelMixer stealer_channelmixer = null;
- protected int stealer_voiceID = -1;
- protected int stealer_noteNumber = 0;
- protected int stealer_velocity = 0;
- protected boolean stealer_releaseTriggered = false;
- protected int voiceID = -1;
- protected boolean sustain = false;
- protected boolean sostenuto = false;
- protected boolean portamento = false;
- private SoftFilter filter_left;
- private SoftFilter filter_right;
- private SoftProcess eg = new SoftEnvelopeGenerator();
- private SoftProcess lfo = new SoftLowFrequencyOscillator();
- protected Map<String, SoftControl> objects =
+ ModelChannelMixer channelmixer = null;
+ double tunedKey = 0;
+ SoftTuning tuning = null;
+ SoftChannel stealer_channel = null;
+ ModelConnectionBlock[] stealer_extendedConnectionBlocks = null;
+ SoftPerformer stealer_performer = null;
+ ModelChannelMixer stealer_channelmixer = null;
+ int stealer_voiceID = -1;
+ int stealer_noteNumber = 0;
+ int stealer_velocity = 0;
+ boolean stealer_releaseTriggered = false;
+ int voiceID = -1;
+ boolean sustain = false;
+ boolean sostenuto = false;
+ boolean portamento = false;
+ private final SoftFilter filter_left;
+ 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>();
- protected SoftSynthesizer synthesizer;
- protected SoftInstrument instrument;
- protected SoftPerformer performer;
- protected SoftChannel softchannel = null;
- protected boolean on = false;
+ SoftSynthesizer synthesizer;
+ SoftInstrument instrument;
+ SoftPerformer performer;
+ SoftChannel softchannel = null;
+ boolean on = false;
private boolean audiostarted = false;
private boolean started = false;
private boolean stopping = false;
@@ -87,7 +87,7 @@
private float last_out_mixer_right = 0;
private float last_out_mixer_effect1 = 0;
private float last_out_mixer_effect2 = 0;
- protected ModelConnectionBlock[] extendedConnectionBlocks = null;
+ ModelConnectionBlock[] extendedConnectionBlocks = null;
private ModelConnectionBlock[] connections;
// Last value added to destination
private double[] connections_last = new double[50];
@@ -100,10 +100,10 @@
private boolean soundoff = false;
private float lastMuteValue = 0;
private float lastSoloMuteValue = 0;
- protected double[] co_noteon_keynumber = new double[1];
- protected double[] co_noteon_velocity = new double[1];
- protected double[] co_noteon_on = new double[1];
- private SoftControl co_noteon = new SoftControl() {
+ double[] co_noteon_keynumber = new double[1];
+ double[] co_noteon_velocity = new double[1];
+ double[] co_noteon_on = new double[1];
+ private final SoftControl co_noteon = new SoftControl() {
double[] keynumber = co_noteon_keynumber;
double[] velocity = co_noteon_velocity;
double[] on = co_noteon_on;
@@ -119,13 +119,13 @@
return null;
}
};
- private double[] co_mixer_active = new double[1];
- private double[] co_mixer_gain = new double[1];
- private double[] co_mixer_pan = new double[1];
- private double[] co_mixer_balance = new double[1];
- private double[] co_mixer_reverb = new double[1];
- private double[] co_mixer_chorus = new double[1];
- private SoftControl co_mixer = new SoftControl() {
+ private final double[] co_mixer_active = new double[1];
+ private final double[] co_mixer_gain = new double[1];
+ private final double[] co_mixer_pan = new double[1];
+ private final double[] co_mixer_balance = new double[1];
+ 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;
@@ -150,8 +150,8 @@
return null;
}
};
- private double[] co_osc_pitch = new double[1];
- private SoftControl co_osc = new SoftControl() {
+ private final double[] co_osc_pitch = new double[1];
+ private final SoftControl co_osc = new SoftControl() {
double[] pitch = co_osc_pitch;
public double[] get(int instance, String name) {
if (name == null)
@@ -161,10 +161,10 @@
return null;
}
};
- private double[] co_filter_freq = new double[1];
- private double[] co_filter_type = new double[1];
- private double[] co_filter_q = new double[1];
- private SoftControl co_filter = new SoftControl() {
+ private final double[] co_filter_freq = new double[1];
+ 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;
@@ -180,8 +180,8 @@
return null;
}
};
- protected SoftResamplerStreamer resampler;
- private int nrofchannels;
+ SoftResamplerStreamer resampler;
+ private final int nrofchannels;
public SoftVoice(SoftSynthesizer synth) {
synthesizer = synth;
@@ -278,7 +278,7 @@
// co_mixer_gain[0] = 0;
}
- protected void updateTuning(SoftTuning newtuning) {
+ void updateTuning(SoftTuning newtuning) {
tuning = newtuning;
tunedKey = tuning.getTuning(note) / 100.0;
if (!portamento) {
@@ -293,12 +293,12 @@
}
}
- protected void setNote(int noteNumber) {
+ void setNote(int noteNumber) {
note = noteNumber;
tunedKey = tuning.getTuning(noteNumber) / 100.0;
}
- protected void noteOn(int noteNumber, int velocity, int delay) {
+ void noteOn(int noteNumber, int velocity, int delay) {
sustain = false;
sostenuto = false;
@@ -435,7 +435,7 @@
}
- protected void setPolyPressure(int pressure) {
+ void setPolyPressure(int pressure) {
if(performer == null)
return;
int[] c = performer.midi_connections[2];
@@ -445,7 +445,7 @@
processConnection(c[i]);
}
- protected void setChannelPressure(int pressure) {
+ void setChannelPressure(int pressure) {
if(performer == null)
return;
int[] c = performer.midi_connections[1];
@@ -455,7 +455,7 @@
processConnection(c[i]);
}
- protected void controlChange(int controller, int value) {
+ void controlChange(int controller, int value) {
if(performer == null)
return;
int[] c = performer.midi_ctrl_connections[controller];
@@ -465,7 +465,7 @@
processConnection(c[i]);
}
- protected void nrpnChange(int controller, int value) {
+ void nrpnChange(int controller, int value) {
if(performer == null)
return;
int[] c = performer.midi_nrpn_connections.get(controller);
@@ -475,7 +475,7 @@
processConnection(c[i]);
}
- protected void rpnChange(int controller, int value) {
+ void rpnChange(int controller, int value) {
if(performer == null)
return;
int[] c = performer.midi_rpn_connections.get(controller);
@@ -485,7 +485,7 @@
processConnection(c[i]);
}
- protected void setPitchBend(int bend) {
+ void setPitchBend(int bend) {
if(performer == null)
return;
int[] c = performer.midi_connections[0];
@@ -495,19 +495,19 @@
processConnection(c[i]);
}
- protected void setMute(boolean mute) {
+ void setMute(boolean mute) {
co_mixer_gain[0] -= lastMuteValue;
lastMuteValue = mute ? -960 : 0;
co_mixer_gain[0] += lastMuteValue;
}
- protected void setSoloMute(boolean mute) {
+ void setSoloMute(boolean mute) {
co_mixer_gain[0] -= lastSoloMuteValue;
lastSoloMuteValue = mute ? -960 : 0;
co_mixer_gain[0] += lastSoloMuteValue;
}
- protected void shutdown() {
+ void shutdown() {
if (co_noteon_on[0] < -0.5)
return;
on = false;
@@ -523,12 +523,12 @@
processConnection(c[i]);
}
- protected void soundOff() {
+ void soundOff() {
on = false;
soundoff = true;
}
- protected void noteOff(int velocity) {
+ void noteOff(int velocity) {
if (!on)
return;
on = false;
@@ -553,7 +553,7 @@
processConnection(c[i]);
}
- protected void redamp() {
+ void redamp() {
if (co_noteon_on[0] > 0.5)
return;
if (co_noteon_on[0] < -0.5)
@@ -571,7 +571,7 @@
processConnection(c[i]);
}
- protected void processControlLogic() {
+ void processControlLogic() {
if (stopping) {
active = false;
stopping = false;
@@ -760,9 +760,9 @@
}
- protected void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
- SoftAudioBuffer dout,
- float amp_from, float amp_to) {
+ void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
+ SoftAudioBuffer dout, float amp_from,
+ float amp_to) {
int bufferlen = in.getSize();
if (amp_from < 0.000000001 && amp_to < 0.000000001)
return;
@@ -815,7 +815,7 @@
}
- protected void processAudioLogic(SoftAudioBuffer[] buffer) {
+ void processAudioLogic(SoftAudioBuffer[] buffer) {
if (!audiostarted)
return;
--- a/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,22 +26,13 @@
package com.sun.media.sound;
import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.SequenceInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.EOFException;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
import java.io.BufferedInputStream;
import java.net.URL;
-import java.net.MalformedURLException;
import javax.sound.midi.MidiFileFormat;
import javax.sound.midi.InvalidMidiDataException;
@@ -49,7 +40,6 @@
import javax.sound.midi.MidiEvent;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.Sequence;
-import javax.sound.midi.ShortMessage;
import javax.sound.midi.SysexMessage;
import javax.sound.midi.Track;
import javax.sound.midi.spi.MidiFileReader;
@@ -64,23 +54,12 @@
* @author Florian Bomers
*/
-public class StandardMidiFileReader extends MidiFileReader {
+public final class StandardMidiFileReader extends MidiFileReader {
private static final int MThd_MAGIC = 0x4d546864; // 'MThd'
- private static final int MIDI_TYPE_0 = 0;
- private static final int MIDI_TYPE_1 = 1;
-
private static final int bisBufferSize = 1024; // buffer size in buffered input streams
- /**
- * MIDI parser types
- */
- private static final int types[] = {
- MIDI_TYPE_0,
- MIDI_TYPE_1
- };
-
public MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException {
return getMidiFileFormatFromStream(stream, MidiFileFormat.UNKNOWN_LENGTH, null);
}
@@ -253,7 +232,7 @@
/**
* State variables during parsing of a MIDI file
*/
-class SMFParser {
+final class SMFParser {
private static final int MTrk_MAGIC = 0x4d54726b; // 'MTrk'
// set to true to not allow corrupt MIDI files tombe loaded
@@ -268,7 +247,7 @@
private byte[] trackData = null;
private int pos = 0;
- public SMFParser() {
+ SMFParser() {
}
private int readUnsigned() throws IOException {
--- a/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
package com.sun.media.sound;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
@@ -34,18 +33,13 @@
import java.io.SequenceInputStream;
import java.io.File;
import java.io.FileOutputStream;
-import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.IOException;
-import java.lang.IllegalArgumentException;
import java.io.OutputStream;
-import java.util.Vector;
-import javax.sound.midi.MidiFileFormat;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiEvent;
import javax.sound.midi.MetaMessage;
-import javax.sound.midi.MidiMessage;
import javax.sound.midi.Sequence;
import javax.sound.midi.ShortMessage;
import javax.sound.midi.SysexMessage;
@@ -59,7 +53,7 @@
* @author Kara Kytle
* @author Jan Borgersen
*/
-public class StandardMidiFileWriter extends MidiFileWriter {
+public final class StandardMidiFileWriter extends MidiFileWriter {
private static final int MThd_MAGIC = 0x4d546864; // 'MThd'
private static final int MTrk_MAGIC = 0x4d54726b; // 'MTrk'
--- a/jdk/src/share/classes/com/sun/media/sound/SunCodec.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SunCodec.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
package com.sun.media.sound;
-import java.io.InputStream;
-
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
@@ -48,14 +46,14 @@
*/
abstract class SunCodec extends FormatConversionProvider {
- AudioFormat.Encoding[] inputEncodings;
- AudioFormat.Encoding[] outputEncodings;
+ private final AudioFormat.Encoding[] inputEncodings;
+ private final AudioFormat.Encoding[] outputEncodings;
/**
* Constructs a new codec object.
*/
- protected SunCodec(AudioFormat.Encoding[] inputEncodings, AudioFormat.Encoding[] outputEncodings) {
-
+ SunCodec(final AudioFormat.Encoding[] inputEncodings,
+ final AudioFormat.Encoding[] outputEncodings) {
this.inputEncodings = inputEncodings;
this.outputEncodings = outputEncodings;
}
@@ -63,16 +61,14 @@
/**
*/
- public AudioFormat.Encoding[] getSourceEncodings() {
-
+ public final AudioFormat.Encoding[] getSourceEncodings() {
AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[inputEncodings.length];
System.arraycopy(inputEncodings, 0, encodings, 0, inputEncodings.length);
return encodings;
}
/**
*/
- public AudioFormat.Encoding[] getTargetEncodings() {
-
+ public final AudioFormat.Encoding[] getTargetEncodings() {
AudioFormat.Encoding[] encodings = new AudioFormat.Encoding[outputEncodings.length];
System.arraycopy(outputEncodings, 0, encodings, 0, outputEncodings.length);
return encodings;
--- a/jdk/src/share/classes/com/sun/media/sound/SunFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SunFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -27,7 +27,6 @@
import java.io.File;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.IOException;
import java.io.DataInputStream;
import java.net.URL;
@@ -52,7 +51,7 @@
/**
* Constructs a new SunFileReader object.
*/
- public SunFileReader() {
+ SunFileReader() {
}
@@ -167,7 +166,7 @@
* @return 32 bits swapped value.
* @exception IOException
*/
- protected int rllong(DataInputStream dis) throws IOException {
+ final int rllong(DataInputStream dis) throws IOException {
int b1, b2, b3, b4 ;
int i = 0;
@@ -190,7 +189,7 @@
* @param int
* @return 32 bits swapped value
*/
- protected int big2little(int i) {
+ final int big2little(int i) {
int b1, b2, b3, b4 ;
@@ -211,7 +210,7 @@
* @return the swapped value.
* @exception IOException
*/
- protected short rlshort(DataInputStream dis) throws IOException {
+ final short rlshort(DataInputStream dis) throws IOException {
short s=0;
short high, low;
@@ -232,7 +231,7 @@
* @param int
* @return 16 bits swapped value
*/
- protected short big2littleShort(short i) {
+ final short big2littleShort(short i) {
short high, low;
@@ -244,16 +243,14 @@
return i;
}
-
- /** Calculates the frame size for PCM frames.
- * Note that this method is appropriate for non-packed samples.
- * For instance, 12 bit, 2 channels will return 4 bytes, not 3.
- * @param sampleSizeInBits the size of a single sample in bits
- * @param channels the number of channels
- * @return the size of a PCM frame in bytes.
- */
- protected static int calculatePCMFrameSize(int sampleSizeInBits,
- int channels) {
- return ((sampleSizeInBits + 7) / 8) * channels;
- }
+ /** Calculates the frame size for PCM frames.
+ * Note that this method is appropriate for non-packed samples.
+ * For instance, 12 bit, 2 channels will return 4 bytes, not 3.
+ * @param sampleSizeInBits the size of a single sample in bits
+ * @param channels the number of channels
+ * @return the size of a PCM frame in bytes.
+ */
+ static final int calculatePCMFrameSize(int sampleSizeInBits, int channels) {
+ return ((sampleSizeInBits + 7) / 8) * channels;
+ }
}
--- a/jdk/src/share/classes/com/sun/media/sound/SunFileWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SunFileWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,8 +69,7 @@
// new, 10.27.99
- public AudioFileFormat.Type[] getAudioFileTypes(){
-
+ public final AudioFileFormat.Type[] getAudioFileTypes(){
AudioFileFormat.Type[] localArray = new AudioFileFormat.Type[types.length];
System.arraycopy(types, 0, localArray, 0, types.length);
return localArray;
@@ -95,7 +94,7 @@
* @return 32 bits swapped value.
* @exception IOException
*/
- protected int rllong(DataInputStream dis) throws IOException {
+ final int rllong(DataInputStream dis) throws IOException {
int b1, b2, b3, b4 ;
int i = 0;
@@ -118,7 +117,7 @@
* @param int
* @return 32 bits swapped value
*/
- protected int big2little(int i) {
+ final int big2little(int i) {
int b1, b2, b3, b4 ;
@@ -139,7 +138,7 @@
* @return the swapped value.
* @exception IOException
*/
- protected short rlshort(DataInputStream dis) throws IOException {
+ final short rlshort(DataInputStream dis) throws IOException {
short s=0;
short high, low;
@@ -160,7 +159,7 @@
* @param int
* @return 16 bits swapped value
*/
- protected short big2littleShort(short i) {
+ final short big2littleShort(short i) {
short high, low;
@@ -177,10 +176,10 @@
* The class is usefull for use with SequenceInputStream to prevent
* closing of the source input streams.
*/
- protected class NoCloseInputStream extends InputStream {
+ final class NoCloseInputStream extends InputStream {
private final InputStream in;
- public NoCloseInputStream(InputStream in) {
+ NoCloseInputStream(InputStream in) {
this.in = in;
}
--- a/jdk/src/share/classes/com/sun/media/sound/Toolkit.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/Toolkit.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,8 +35,13 @@
* @author Kara Kytle
* @author Florian Bomers
*/
-public class Toolkit {
+public final class Toolkit {
+ /**
+ * Suppresses default constructor, ensuring non-instantiability.
+ */
+ private Toolkit() {
+ }
/**
* Converts bytes from signed to unsigned.
--- a/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
package com.sun.media.sound;
-import java.io.InputStream;
import java.io.IOException;
import java.util.Vector;
@@ -40,12 +39,12 @@
*
* @author Kara Kytle
*/
-public class UlawCodec extends SunCodec {
+public final class UlawCodec extends SunCodec {
/* Tables used for U-law decoding */
- final static byte ULAW_TABH[] = new byte[256];
- final static byte ULAW_TABL[] = new byte[256];
+ private final static byte[] ULAW_TABH = new byte[256];
+ private final static byte[] ULAW_TABL = new byte[256];
private static final AudioFormat.Encoding[] ulawEncodings = {AudioFormat.Encoding.ULAW,
AudioFormat.Encoding.PCM_SIGNED};
--- a/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
*
* @author Karl Helgason
*/
-public class WaveExtensibleFileReader extends AudioFileReader {
+public final class WaveExtensibleFileReader extends AudioFileReader {
static private class GUID {
long i1;
@@ -74,7 +74,7 @@
private GUID() {
}
- public GUID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
+ GUID(long i1, int s1, int s2, int x1, int x2, int x3, int x4,
int x5, int x6, int x7, int x8) {
this.i1 = i1;
this.s1 = s1;
@@ -140,13 +140,13 @@
}
- private static String[] channelnames = { "FL", "FR", "FC", "LF",
+ private static final String[] channelnames = { "FL", "FR", "FC", "LF",
"BL",
"BR", // 5.1
"FLC", "FLR", "BC", "SL", "SR", "TC", "TFL", "TFC", "TFR", "TBL",
"TBC", "TBR" };
- private static String[] allchannelnames = { "w1", "w2", "w3", "w4", "w5",
+ private static final String[] allchannelnames = { "w1", "w2", "w3", "w4", "w5",
"w6", "w7", "w8", "w9", "w10", "w11", "w12", "w13", "w14", "w15",
"w16", "w17", "w18", "w19", "w20", "w21", "w22", "w23", "w24",
"w25", "w26", "w27", "w28", "w29", "w30", "w31", "w32", "w33",
@@ -155,10 +155,10 @@
"w52", "w53", "w54", "w55", "w56", "w57", "w58", "w59", "w60",
"w61", "w62", "w63", "w64" };
- private static GUID SUBTYPE_PCM = new GUID(0x00000001, 0x0000, 0x0010,
+ private static final GUID SUBTYPE_PCM = new GUID(0x00000001, 0x0000, 0x0010,
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
- private static GUID SUBTYPE_IEEE_FLOAT = new GUID(0x00000003, 0x0000,
+ private static final GUID SUBTYPE_IEEE_FLOAT = new GUID(0x00000003, 0x0000,
0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
private String decodeChannelMask(long channelmask) {
--- a/jdk/src/share/classes/com/sun/media/sound/WaveFileFormat.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveFileFormat.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,24 +25,8 @@
package com.sun.media.sound;
-import java.util.Vector;
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.lang.IllegalArgumentException;
-
-import java.io.BufferedOutputStream;
-import java.io.DataOutputStream;
-import java.io.FileOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.SequenceInputStream;
-
import javax.sound.sampled.AudioFileFormat;
-import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioSystem;
/**
@@ -51,12 +35,12 @@
* @author Jan Borgersen
*/
-class WaveFileFormat extends AudioFileFormat {
+final class WaveFileFormat extends AudioFileFormat {
/**
* Wave format type.
*/
- private int waveType;
+ private final int waveType;
//$$fb 2001-07-13: added management of header size in this class
//$$fb 2002-04-16: Fix for 4636355: RIFF audio headers could be _more_ spec compliant
--- a/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,28 +25,17 @@
package com.sun.media.sound;
-import java.util.Vector;
+import java.io.DataInputStream;
+import java.io.EOFException;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.EOFException;
import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.FileInputStream;
-import java.io.DataOutputStream;
-import java.io.FileOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.SequenceInputStream;
import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
@@ -59,20 +48,11 @@
* @author Jan Borgersen
* @author Florian Bomers
*/
-public class WaveFileReader extends SunFileReader {
+public final class WaveFileReader extends SunFileReader {
private static final int MAX_READ_LENGTH = 12;
/**
- * WAVE reader type
- */
-
- public static final AudioFileFormat.Type types[] = {
- AudioFileFormat.Type.WAVE
- };
-
-
- /**
* Constructs a new WaveFileReader object.
*/
public WaveFileReader() {
--- a/jdk/src/share/classes/com/sun/media/sound/WaveFileWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveFileWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
*
* @author Jan Borgersen
*/
-public class WaveFileWriter extends SunFileWriter {
+public final class WaveFileWriter extends SunFileWriter {
// magic numbers
static final int RIFF_MAGIC = 1380533830;
@@ -74,18 +74,10 @@
static final int WAVE_FORMAT_SX7383 = 0x1C07;
/**
- * WAVE type
- */
- private static final AudioFileFormat.Type waveTypes[] = {
- AudioFileFormat.Type.WAVE
- };
-
-
- /**
* Constructs a new WaveFileWriter object.
*/
public WaveFileWriter() {
- super(waveTypes);
+ super(new AudioFileFormat.Type[]{AudioFileFormat.Type.WAVE});
}
--- a/jdk/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
*
* @author Karl Helgason
*/
-public class WaveFloatFileReader extends AudioFileReader {
+public final class WaveFloatFileReader extends AudioFileReader {
public AudioFileFormat getAudioFileFormat(InputStream stream)
throws UnsupportedAudioFileException, IOException {
--- a/jdk/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
*
* @author Karl Helgason
*/
-public class WaveFloatFileWriter extends AudioFileWriter {
+public final class WaveFloatFileWriter extends AudioFileWriter {
public Type[] getAudioFileTypes() {
return new Type[] { Type.WAVE };
@@ -86,9 +86,9 @@
}
private static class NoCloseOutputStream extends OutputStream {
- OutputStream out;
+ final OutputStream out;
- public NoCloseOutputStream(OutputStream out) {
+ NoCloseOutputStream(OutputStream out) {
this.out = out;
}
--- a/jdk/src/share/classes/javax/sound/midi/MetaMessage.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/MetaMessage.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,6 @@
package javax.sound.midi;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
/**
* A <code>MetaMessage</code> is a <code>{@link MidiMessage}</code> that is not meaningful to synthesizers, but
@@ -71,14 +67,6 @@
*/
public static final int META = 0xFF; // 255
-
- // Default meta message data: just the META status byte value
- // $$kk: 09.09.99: need a real event here!!
-
- private static byte[] defaultMessage = { (byte)META, 0 };
-
-
-
// Instance variables
/**
@@ -98,8 +86,8 @@
* to set them subsequently.
*/
public MetaMessage() {
- //super(defaultMessage);
- this(defaultMessage);
+ // Default meta message data: just the META status byte value
+ this(new byte[]{(byte) META, 0});
}
/**
--- a/jdk/src/share/classes/javax/sound/sampled/Mixer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/sampled/Mixer.java Fri Mar 29 22:07:56 2013 +0400
@@ -253,22 +253,22 @@
/**
* Mixer name.
*/
- private /*final*/ String name;
+ private final String name;
/**
* Mixer vendor.
*/
- private /*final*/ String vendor;
+ private final String vendor;
/**
* Mixer description.
*/
- private /*final*/ String description;
+ private final String description;
/**
* Mixer version.
*/
- private /*final*/ String version;
+ private final String version;
/**
* Constructs a mixer's info object, passing it the given
--- a/jdk/src/share/classes/sun/audio/AudioData.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioData.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
*/
-public class AudioData {
+public final class AudioData {
private static final AudioFormat DEFAULT_FORMAT =
new AudioFormat(AudioFormat.Encoding.ULAW,
--- a/jdk/src/share/classes/sun/audio/AudioDataStream.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioDataStream.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,6 @@
package sun.audio;
import java.io.*;
-import javax.sound.sampled.*;
-import javax.sound.midi.*;
/**
* An input stream to play AudioData.
@@ -39,18 +37,18 @@
*/
public class AudioDataStream extends ByteArrayInputStream {
- AudioData ad;
+ private final AudioData ad;
/**
* Constructor
*/
- public AudioDataStream(AudioData data) {
+ public AudioDataStream(final AudioData data) {
super(data.buffer);
this.ad = data;
}
- AudioData getAudioData() {
+ final AudioData getAudioData() {
return ad;
}
}
--- a/jdk/src/share/classes/sun/audio/AudioDevice.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioDevice.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,9 @@
import java.util.Hashtable;
import java.util.Vector;
-import java.util.Enumeration;
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedInputStream;
-import java.io.OutputStream;
-import java.io.ByteArrayInputStream;
import javax.sound.sampled.*;
import javax.sound.midi.*;
@@ -57,8 +54,7 @@
* @author Florian Bomers
*/
-public class
- AudioDevice {
+public final class AudioDevice {
private boolean DEBUG = false /*true*/ ;
@@ -404,11 +400,11 @@
// INFO CLASS
- class Info implements MetaEventListener {
+ final class Info implements MetaEventListener {
- Sequencer sequencer;
- InputStream in;
- DataPusher datapusher;
+ final Sequencer sequencer;
+ final InputStream in;
+ final DataPusher datapusher;
Info( Sequencer sequencer, InputStream in, DataPusher datapusher ) {
--- a/jdk/src/share/classes/sun/audio/AudioPlayer.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioPlayer.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,7 @@
package sun.audio;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.FileOutputStream;
-
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -69,11 +63,10 @@
* @author Arthur van Hoff, Thomas Ball
*/
-public
- class AudioPlayer extends Thread {
+public final class AudioPlayer extends Thread {
- private AudioDevice devAudio;
- private static boolean DEBUG = false /*true*/;
+ private final AudioDevice devAudio;
+ private final static boolean DEBUG = false /*true*/;
/**
* The default audio player. This audio player is initialized
--- a/jdk/src/share/classes/sun/audio/AudioStream.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioStream.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,7 @@
package sun.audio;
import java.io.InputStream;
-import java.io.DataInputStream;
import java.io.FilterInputStream;
-import java.io.ByteArrayInputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
@@ -41,13 +39,13 @@
*/
-public class AudioStream extends FilterInputStream {
+public final class AudioStream extends FilterInputStream {
// AudioContainerInputStream acis;
- protected AudioInputStream ais = null;
- protected AudioFormat format = null;
- protected MidiFileFormat midiformat = null;
- protected InputStream stream = null;
+ AudioInputStream ais = null;
+ AudioFormat format = null;
+ MidiFileFormat midiformat = null;
+ InputStream stream = null;
/*
--- a/jdk/src/share/classes/sun/audio/AudioStreamSequence.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioStreamSequence.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
package sun.audio;
-import java.io.IOException;
import java.io.InputStream;
import java.io.SequenceInputStream;
import java.util.Enumeration;
@@ -44,8 +43,8 @@
* @see AudioPlayer
* @author Arthur van Hoff
*/
-public
- class AudioStreamSequence extends SequenceInputStream {
+public final class AudioStreamSequence extends SequenceInputStream {
+
Enumeration e;
InputStream in;
--- a/jdk/src/share/classes/sun/audio/AudioTranslatorStream.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioTranslatorStream.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,15 @@
package sun.audio;
import java.io.InputStream;
-import java.io.DataInputStream;
-import java.io.FilterInputStream;
import java.io.IOException;
/**
* Translator for native audio formats (not implemented in this release).
*
*/
-public
- class AudioTranslatorStream extends NativeAudioStream {
+public final class AudioTranslatorStream extends NativeAudioStream {
- private int length = 0;
+ private final int length = 0;
public AudioTranslatorStream(InputStream in) throws IOException {
super(in);
--- a/jdk/src/share/classes/sun/audio/ContinuousAudioDataStream.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/ContinuousAudioDataStream.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,11 +42,10 @@
* @author Arthur van Hoff
*/
-public
- class ContinuousAudioDataStream extends AudioDataStream {
+public final class ContinuousAudioDataStream extends AudioDataStream {
- /**
+ /**
* Create a continuous stream of audio.
*/
public ContinuousAudioDataStream(AudioData data) {
--- a/jdk/src/share/classes/sun/audio/InvalidAudioFormatException.java Fri Mar 29 10:01:19 2013 -0700
+++ b/jdk/src/share/classes/sun/audio/InvalidAudioFormatException.java Fri Mar 29 22:07:56 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,20 +29,20 @@
/**
* Signals an invalid audio stream for the stream handler.
*/
-class InvalidAudioFormatException extends IOException {
+final class InvalidAudioFormatException extends IOException {
/**
* Constructor.
*/
- public InvalidAudioFormatException() {
+ InvalidAudioFormatException() {
super();
}
/**
* Constructor with a detail message.
*/
- public InvalidAudioFormatException(String s) {
+ InvalidAudioFormatException(String s) {
super(s);
}
}