Sharkysoft home

lava.riff.wave
Class WaveSampleClipper

java.lang.Object
  |
  +--lava.riff.wave.WaveSampleClipper

public class WaveSampleClipper
extends java.lang.Object

Clips wave sample data.

Details: WaveSampleClipper is a collection of functions that clip samples to a particular range.

The parameters for each of these methods follow the same pattern as described in the header for class WaveSampleConverter.

Author:
Sharky

Constructor Summary
WaveSampleClipper()
           
 
Method Summary
static double[] clip(double[] src, int from, double[] dest, int to, int amt)
          Clip values to legal range.
static float[] clip(float[] src, int from, float[] dest, int to, int amt)
          Clip values to legal range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaveSampleClipper

public WaveSampleClipper()
Method Detail

clip

public static double[] clip(double[] src,
                            int from,
                            double[] dest,
                            int to,
                            int amt)
Clip values to legal range.

Details: clip modifies the sample data so that no value is greater than +1.0 or smaller than -1.0. Values greater than +1.0 are set to exactly +1.0, and value smaller than -1.0 are set to exactly -1.0.

Parameters:
src - source array
from - starting index in src
dest - destination array
to - starting index in dest
amt - number of values to clip
Returns:
destination array

clip

public static float[] clip(float[] src,
                           int from,
                           float[] dest,
                           int to,
                           int amt)
Clip values to legal range.

Details: clip modifies the sample data so that no value is greater than +1.0 or smaller than -1.0. Values greater than +1.0 are set to exactly +1.0, and value smaller than -1.0 are set to exactly -1.0.

Parameters:
src - source array
from - starting index in src
dest - destination array
to - starting index in dest
amt - number of values to clip
Returns:
destination array

Sharkysoft home