changes.
[IRC.git] / Robust / src / Tests / ssJava / mp3decoder / Obuffer.java
index 4f444c941e0755efed009fd9d9e8e34f7d87c9ef..e8e7965b346ee5087ee6562278aca5a24c35c834 100644 (file)
  */
 @LATTICE("")
 @METHODDEFAULT("D<IN,D<C,C*,THISLOC=D")
-public abstract class Obuffer
-{
public static final int     OBUFFERSIZE = 2 * 1152;  // max. 2 * 1152 samples per frame
public static final int   MAXCHANNELS = 2;        // max. number of channels
+public abstract class Obuffer {
+  public static final int OBUFFERSIZE = 2 * 1152; // max. 2 * 1152 samples per
                                                 // frame
 public static final int MAXCHANNELS = 2; // max. number of channels
 
   /**
    * Takes a 16 Bit PCM sample.
    */
-  public abstract void append(int channel, short value);
+  public abstract void append(@LOC("D") int channel, @LOC("D") short value);
 
   /**
-   * Accepts 32 new PCM samples. 
+   * Accepts 32 new PCM samples.
    */
-  public void appendSamples(@LOC("IN") int channel, @LOC("IN") float[] f)
-  {
-    @LOC("D") short s;
-    for (@LOC("C") int i=0; i<32;)
-    {
-      s = clip(f[i++]); // flow from "IN" to "D"
-      append(channel, s);  
+  @LATTICE("S<IN,IN<C,C*,THISLOC=IN")
+  public void appendSamples(@LOC("IN") int channel, @LOC("IN") float[] f) {
+    @LOC("S") short s;
+    for (@LOC("C") int i = 0; i < 32;) {
+      s = clip(f[i++]);
+      append(channel, s);
     }
   }
 
   /**
    * Clip Sample to 16 Bits
    */
-  @RETURNLOC("IN")
-  private final short clip(@LOC("IN") float sample)
-  {
-    return ((sample > 32767.0f) ?   (short) 32767 :
-      ((sample < -32768.0f) ?  (short)  -32768 :
-        (short) sample));
+  @LATTICE("THIS,OUT<IN,RETURNLOC=OUT,THISLOC=THIS")
+  private final short clip(@LOC("IN") float sample) {
+
+    @LOC("OUT") short s = (short) sample;
+
+    if (sample > 32767.0f) {
+      s = (short) 32767;
+    } else if (sample < -32768.0f) {
+      s = (short) -32768;
+    }
+
+    return s;
+
   }
 
   /**
    * Write the samples to the file or directly to the audio hardware.
    */
-  public abstract void write_buffer(int val);
+  public abstract void write_buffer(@LOC("IN") int val);
+
   public abstract void close();
 
   /**