jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler.java
changeset 40444 afabcfc2f3ef
parent 25859 3317bb8137f4
equal deleted inserted replaced
40442:e97e9982be6d 40444:afabcfc2f3ef
    20  *
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
       
    25 
    25 package com.sun.media.sound;
    26 package com.sun.media.sound;
    26 
    27 
    27 /**
    28 /**
    28  * A resampler that uses first-order (linear) interpolation.
    29  * A resampler that uses first-order (linear) interpolation.
    29  *
    30  *
    30  * @author Karl Helgason
    31  * @author Karl Helgason
    31  */
    32  */
    32 public final class SoftLinearResampler extends SoftAbstractResampler {
    33 public final class SoftLinearResampler extends SoftAbstractResampler {
    33 
    34 
       
    35     @Override
    34     public int getPadding() {
    36     public int getPadding() {
    35         return 2;
    37         return 2;
    36     }
    38     }
    37 
    39 
       
    40     @Override
    38     public void interpolate(float[] in, float[] in_offset, float in_end,
    41     public void interpolate(float[] in, float[] in_offset, float in_end,
    39             float[] startpitch, float pitchstep, float[] out, int[] out_offset,
    42                             float[] startpitch, float pitchstep, float[] out, int[] out_offset,
    40             int out_end) {
    43                             int out_end) {
    41 
    44 
    42         float pitch = startpitch[0];
    45         float pitch = startpitch[0];
    43         float ix = in_offset[0];
    46         float ix = in_offset[0];
    44         int ox = out_offset[0];
    47         int ox = out_offset[0];
    45         float ix_end = in_end;
    48         float ix_end = in_end;
    63             }
    66             }
    64         }
    67         }
    65         in_offset[0] = ix;
    68         in_offset[0] = ix;
    66         out_offset[0] = ox;
    69         out_offset[0] = ox;
    67         startpitch[0] = pitch;
    70         startpitch[0] = pitch;
    68 
       
    69     }
    71     }
    70 }
    72 }