You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/10/19 07:24:49 UTC

svn commit: r465499 - in /incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled: AudioFileFormat.java AudioFormat.java AudioInputStream.java Control.java DataLine.java Line.java LineEvent.java

Author: mloenko
Date: Wed Oct 18 22:24:48 2006
New Revision: 465499

URL: http://svn.apache.org/viewvc?view=rev&rev=465499
Log:
implemented some essential methods in sound, fixed Japi report problems

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Control.java
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/DataLine.java
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java
    incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFileFormat.java Wed Oct 18 22:24:48 2006
@@ -25,6 +25,16 @@
 
         private String extension;
 
+        public static final Type AIFC = new Type("AIFF-C", "aifc"); //$NON-NLS-1$ //$NON-NLS-2$
+
+        public static final Type AIFF = new Type("AIFF", "aif"); //$NON-NLS-1$ //$NON-NLS-2$
+
+        public static final Type AU = new Type("AU", "au"); //$NON-NLS-1$ //$NON-NLS-2$
+
+        public static final Type SND = new Type("SND", "snd"); //$NON-NLS-1$ //$NON-NLS-2$
+
+        public static final Type WAVE = new Type("WAVE", "wav"); //$NON-NLS-1$ //$NON-NLS-2$
+
         public Type(String name, String extension) {
             this.name = name;
             this.extension = extension;
@@ -58,12 +68,13 @@
 
         @Override
         public final int hashCode() {
-            return name.hashCode() + extension.hashCode();
+            return (name == null ? 0 : name.hashCode()) + 
+                    (extension == null ? 0 : extension.hashCode());
         }
 
         @Override
         public final String toString() {
-            throw new Error("not yet implemented");
+            return name;
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFormat.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioFormat.java Wed Oct 18 22:24:48 2006
@@ -18,8 +18,61 @@
 package javax.sound.sampled;
 
 public class AudioFormat {
-    public static class Encoding{}
-    
+    public static class Encoding {
+
+        public static final Encoding ALAW = new Encoding("ALAW"); //$NON-NLS-1$
+
+        public static final Encoding PCM_SIGNED = new Encoding("PCM_SIGNED"); //$NON-NLS-1$
+
+        public static final Encoding PCM_UNSIGNED = new Encoding("PCM_UNSIGNED"); //$NON-NLS-1$
+
+        public static final Encoding ULAW = new Encoding("ULAW"); //$NON-NLS-1$
+
+        private String name;
+
+        public Encoding(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public boolean equals(Object another) {
+            if (this == another) {
+                return true;
+            }
+
+            if (another == null || !(another instanceof Encoding)) {
+                return false;
+            }
+
+            Encoding obj = (Encoding) another;
+            return name == null ? obj.name == null : name.equals(obj.name);
+        }
+
+        @Override
+        public final int hashCode() {
+            return name == null ? 0 : name.hashCode();
+        }
+
+        @Override
+        public final String toString() {
+            return name;
+        }
+    }
+
+    protected boolean bigEndian;
+
+    protected int channels;
+
+    protected Encoding encoding;
+
+    protected float frameRate;
+
+    protected int frameSize;
+
+    protected float sampleRate;
+
+    protected int sampleSizeInBits;
+
     public Encoding getEncoding() {
         throw new Error("not yet implemented");
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioInputStream.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/AudioInputStream.java Wed Oct 18 22:24:48 2006
@@ -17,5 +17,21 @@
 
 package javax.sound.sampled;
 
-public class AudioInputStream {
+import java.io.IOException;
+import java.io.InputStream;
+
+public class AudioInputStream extends InputStream {
+
+    protected AudioFormat format;
+
+    protected long frameLength;
+
+    protected long framePos;
+
+    protected int frameSize;
+
+    @Override
+    public int read() throws IOException {
+        throw new Error("not yet implemented");
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Control.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Control.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Control.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Control.java Wed Oct 18 22:24:48 2006
@@ -19,34 +19,47 @@
 
 public abstract class Control {
 
-    static class Type {
+    public static class Type {
+
         private String name;
 
-        protected Type(String name) {
+        public Type(String name) {
             this.name = name;
         }
 
-        public final boolean equals(Object obj) {
-            throw new Error("Not yet imlemented");
+        @Override
+        public boolean equals(Object another) {
+            if (this == another) {
+                return true;
+            }
+
+            if (another == null || !(another instanceof Type)) {
+                return false;
+            }
+
+            Type obj = (Type) another;
+            return name == null ? obj.name == null : name.equals(obj.name);
         }
 
+        @Override
         public final int hashCode() {
-            throw new Error("Not yet imlemented");
+            return name == null ? 0 : name.hashCode();
         }
 
+        @Override
         public final String toString() {
-            throw new Error("Not yet imlemented");
+            return name;
         }
     }
 
-    private Control.Type type;
+    private Type type;
 
-    protected Control(Control.Type type) {
+    protected Control(Type type) {
         this.type = type;
     }
 
-    public Control.Type getType() {
-        return this.type;
+    public Type getType() {
+        return type;
     }
 
     public String toString() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/DataLine.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/DataLine.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/DataLine.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/DataLine.java Wed Oct 18 22:24:48 2006
@@ -91,7 +91,7 @@
     
     long getLongFramePosition();
     
-    long getMicroSecondPosition();
+    long getMicrosecondPosition();
     
     boolean isActive();
     

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/Line.java Wed Oct 18 22:24:48 2006
@@ -46,7 +46,7 @@
 
     Control getControl(Control.Type control);
 
-    Control[] getcontrols();
+    Control[] getControls();
 
     Line.Info getLineInfo();
 
@@ -54,7 +54,7 @@
 
     boolean isOpen();
 
-    void open();
+    void open() throws LineUnavailableException;
 
     void removeLineListener(LineListener listener);
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java?view=diff&rev=465499&r1=465498&r2=465499
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sound/src/main/java/javax/sound/sampled/LineEvent.java Wed Oct 18 22:24:48 2006
@@ -24,12 +24,51 @@
     /**
      * 
      */
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = -1274246333383880410L;
+
+    public static class Type {
+
+        public static final Type CLOSE = new Type("Close"); //$NON-NLS-1$
+
+        public static final Type OPEN = new Type("Open"); //$NON-NLS-1$
+
+        public static final Type START = new Type("Start"); //$NON-NLS-1$
+
+        public static final Type STOP = new Type("Stop"); //$NON-NLS-1$
+
+        private String name;
+
+        public Type(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public boolean equals(Object another) {
+            if (this == another) {
+                return true;
+            }
+
+            if (another == null || !(another instanceof Type)) {
+                return false;
+            }
+
+            Type obj = (Type) another;
+            return name == null ? obj.name == null : name.equals(obj.name);
+        }
+
+        @Override
+        public final int hashCode() {
+            return name == null ? 0 : name.hashCode();
+        }
+
+        @Override
+        public final String toString() {
+            return name;
+        }
+    }
 
     public LineEvent(Line line, LineEvent.Type type, long position) {
         super(line);
+        throw new Error("Not yet imlemented");
     }
-
-    public static class Type {}
-
 }