Index: modules/sound/src/main/java/javax/sound/sampled/FloatControl.java =================================================================== --- modules/sound/src/main/java/javax/sound/sampled/FloatControl.java (revision 482089) +++ modules/sound/src/main/java/javax/sound/sampled/FloatControl.java (working copy) @@ -17,34 +17,50 @@ package javax.sound.sampled; -import org.apache.harmony.luni.util.NotImplementedException; - public abstract class FloatControl extends Control { public static class Type extends Control.Type { - public static final Type MASTER_GAIN = new Type("MASTER_GAIN"); + public static final Type MASTER_GAIN = new Type("Master Gain"); //$NON-NLS-1$ - public static final Type AUX_SEND = new Type("AUX_SEND"); + public static final Type AUX_SEND = new Type("AUX Send"); //$NON-NLS-1$ - public static final Type AUX_RETURN = new Type("AUX_RETURN"); + public static final Type AUX_RETURN = new Type("AUX Return"); //$NON-NLS-1$ - public static final Type REVERB_SEND = new Type("REVERB_SEND"); + public static final Type REVERB_SEND = new Type("Reverb Send"); //$NON-NLS-1$ - public static final Type REVERB_RETURN = new Type("REVERB_RETURN"); + public static final Type REVERB_RETURN = new Type("Reverb Return"); //$NON-NLS-1$ - public static final Type VOLUME = new Type("VOLUME"); + public static final Type VOLUME = new Type("Volume"); //$NON-NLS-1$ - public static final Type PAN = new Type("PAN"); + public static final Type PAN = new Type("Pan"); //$NON-NLS-1$ - public static final Type BALANCE = new Type("BALANCE"); + public static final Type BALANCE = new Type("Balance"); //$NON-NLS-1$ - public static final Type SAMPLE_RATE = new Type("SAMPLE_RATE"); + public static final Type SAMPLE_RATE = new Type("Sample Rate"); //$NON-NLS-1$ protected Type(String name) { super(name); } } + private float value; + + private float maximum; + + private float minimum; + + private String units; + + private String minLabel; + + private String midLabel; + + private String maxLabel; + + private float precision; + + private int updatePeriod; + protected FloatControl(FloatControl.Type type, float minimum, float maximum, float precision, int updatePeriod, float initialValue, String units, String minLabel, String midLabel, @@ -64,37 +80,14 @@ protected FloatControl(FloatControl.Type type, float minimum, float maximum, float precision, int updatePeriod, float initialValue, String units) { - super(type); - this.maximum = maximum; - this.maxLabel = ""; - this.midLabel = ""; - this.minLabel = ""; - this.minimum = minimum; - this.precision = precision; - this.units = units; - this.updatePeriod = updatePeriod; - this.value = initialValue; + this(type, minimum, maximum, precision, updatePeriod, initialValue, + units, "", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - private float value; - - private float maximum; - - private float minimum; - - private String units; - - private String minLabel; - - private String midLabel; - - private String maxLabel; - - private float precision; - - private int updatePeriod; - public void setValue(float newValue) { + if (newValue > maximum || newValue < minimum) { + throw new IllegalArgumentException("value does not fall within the allowable range"); //$NON-NLS-1$ + } this.value = newValue; } @@ -134,12 +127,13 @@ return this.updatePeriod; } - public void shift(float from, float to, int microseconds) throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public void shift(float from, float to, int microseconds) { + setValue(to); } - public String toString() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public String toString() { + return getType() + " with current value: "+ value + " " + units //$NON-NLS-1$ //$NON-NLS-2$ + + " (range: " + minimum + " - " + maximum + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } Index: modules/sound/src/main/java/javax/sound/sampled/Port.java =================================================================== --- modules/sound/src/main/java/javax/sound/sampled/Port.java (revision 482089) +++ modules/sound/src/main/java/javax/sound/sampled/Port.java (working copy) @@ -17,10 +17,6 @@ package javax.sound.sampled; -import javax.sound.sampled.Line; - -import org.apache.harmony.luni.util.NotImplementedException; - public interface Port extends Line { public static class Info extends Line.Info { @@ -30,20 +26,20 @@ private boolean isSource; public static final Info MICROPHONE = new Info(Port.class, - "MICROPHONE", true); + "MICROPHONE", true); //$NON-NLS-1$ - public static final Info LINE_IN = new Info(Port.class, "LINE_IN", true); + public static final Info LINE_IN = new Info(Port.class, "LINE_IN", true); //$NON-NLS-1$ public static final Info COMPACT_DISC = new Info(Port.class, - "COMPACT_DISC", true); + "COMPACT_DISC", true); //$NON-NLS-1$ - public static final Info SPEAKER = new Info(Port.class, "SPEAKER", + public static final Info SPEAKER = new Info(Port.class, "SPEAKER", //$NON-NLS-1$ false); - public static final Info HEADPHONE = new Info(Port.class, "HEADPHONES", + public static final Info HEADPHONE = new Info(Port.class, "HEADPHONES", //$NON-NLS-1$ false); - public static final Info LINE_OUT = new Info(Port.class, "LINE_OUT", + public static final Info LINE_OUT = new Info(Port.class, "LINE_OUT", //$NON-NLS-1$ false); public Info(Class lineClass, String name, boolean isSource) { @@ -60,20 +56,25 @@ return this.isSource; } - public boolean matches(Line.Info info) throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public boolean matches(Line.Info info) { + if (super.matches(info) && Port.Info.class.equals(info.getClass()) + && name.equals(((Port.Info) info).getName()) + && isSource == ((Port.Info) info).isSource()) { + return true; + } + return false; } - public final boolean equals(Object obj) throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public final boolean equals(Object obj) { + return this == obj; } - public final int hashCode() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public final int hashCode() { + return name.hashCode() ^ getLineClass().hashCode(); } - public final String toString() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public final String toString() { + return name + (isSource ? " source port" : " target port"); //$NON-NLS-1$ //$NON-NLS-2$ } } } Index: modules/sound/src/main/java/javax/sound/sampled/Mixer.java =================================================================== --- modules/sound/src/main/java/javax/sound/sampled/Mixer.java (revision 482089) +++ modules/sound/src/main/java/javax/sound/sampled/Mixer.java (working copy) @@ -17,8 +17,6 @@ package javax.sound.sampled; -import org.apache.harmony.luni.util.NotImplementedException; - public interface Mixer extends Line { static class Info{ private String name; @@ -26,7 +24,7 @@ private String description; private String version; - public Info(String name, String vendor, String description, String version) { + protected Info(String name, String vendor, String description, String version) { this.name = name; this.vendor = vendor; this.description = description; @@ -60,8 +58,8 @@ } @Override - public String toString() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public String toString() { + return name + ", version " + version; //$NON-NLS-1$ } } Index: modules/sound/src/main/java/javax/sound/sampled/Line.java =================================================================== --- modules/sound/src/main/java/javax/sound/sampled/Line.java (revision 482089) +++ modules/sound/src/main/java/javax/sound/sampled/Line.java (working copy) @@ -17,8 +17,6 @@ package javax.sound.sampled; -import org.apache.harmony.luni.util.NotImplementedException; - public interface Line { class Info { @@ -37,8 +35,8 @@ } @Override - public String toString() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public String toString() { + return lineClass.toString(); } } Index: modules/sound/src/main/java/javax/sound/sampled/ReverbType.java =================================================================== --- modules/sound/src/main/java/javax/sound/sampled/ReverbType.java (revision 482089) +++ modules/sound/src/main/java/javax/sound/sampled/ReverbType.java (working copy) @@ -17,8 +17,6 @@ package javax.sound.sampled; -import org.apache.harmony.luni.util.NotImplementedException; - public class ReverbType { protected ReverbType(String name, int earlyReflectionDelay, @@ -68,15 +66,19 @@ return this.decayTime; } - public final boolean equals(Object obj) throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public final boolean equals(Object obj) { + return this == obj; } - public final int hashCode() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public final int hashCode() { + return toString().hashCode(); } - public final String toString() throws NotImplementedException { - throw new NotImplementedException("not yet implemented"); + public final String toString() { + return name + ", early reflection delay " + earlyReflectionDelay //$NON-NLS-1$ + + " ns, early reflection intensity " + earlyReflectionIntensity //$NON-NLS-1$ + + " dB, late deflection delay " + lateReflectionDelay //$NON-NLS-1$ + + " ns, late reflection intensity " + lateReflectionIntensity //$NON-NLS-1$ + + " dB, decay time " + decayTime; //$NON-NLS-1$ } } Index: modules/sound/src/main/java/javax/sound/sampled/LineEvent.java =================================================================== --- modules/sound/src/main/java/javax/sound/sampled/LineEvent.java (revision 482089) +++ modules/sound/src/main/java/javax/sound/sampled/LineEvent.java (working copy) @@ -25,6 +25,9 @@ * */ private static final long serialVersionUID = -1274246333383880410L; + + private LineEvent.Type type; + private long position; public static class Type { @@ -69,6 +72,23 @@ public LineEvent(Line line, LineEvent.Type type, long position) { super(line); - throw new Error("Not yet imlemented"); + this.type = type; + this.position = position; } + + public final Line getLine() { + return (Line)getSource(); + } + + public final LineEvent.Type getType() { + return type; + } + + public final long getFramePosition() { + return position; + } + + public String toString() { + return type + " event from line " + getLine(); //$NON-NLS-1$ + } }