Sharkysoft home

lava.riff.wave
Class WaveSampleRounder

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

public class WaveSampleRounder
extends java.lang.Object

Rounds wave sample data.

Details: WaveSampleRounder is a collection of functions that round sample arrays to a desired precision.

The parameters for each of these methods follow the same pattern as described in the header for class WaveSampleConverter, with the exception that there is an additional parameter that specifies the rounding precision.

Author:
Sharky

Constructor Summary
WaveSampleRounder()
           
 
Method Summary
static byte[] round(byte[] src, int from, byte[] dest, int to, int amt, int bits)
          Rounds values to requested precision.
static int[] round(int[] src, int from, int[] dest, int to, int amt, int bits)
          Rounds values to requested precision.
static long[] round(long[] src, int from, long[] dest, int to, int amt, int bits)
          Rounds values to requested precision.
static short[] round(short[] src, int from, short[] dest, int to, int amt, int bits)
          Rounds values to requested precision.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaveSampleRounder

public WaveSampleRounder()
Method Detail

round

public static long[] round(long[] src,
                           int from,
                           long[] dest,
                           int to,
                           int amt,
                           int bits)
Rounds values to requested precision.

Details: round modifies the sample data so that each value is rounded to the specified number of bits. Rounding is accomplished by setting the least significant bits to 0.

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

round

public static int[] round(int[] src,
                          int from,
                          int[] dest,
                          int to,
                          int amt,
                          int bits)
Rounds values to requested precision.

Details: round modifies the sample data so that each value is rounded to the specified number of bits. Rounding is accomplished by setting the least significant bits to 0.

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

round

public static short[] round(short[] src,
                            int from,
                            short[] dest,
                            int to,
                            int amt,
                            int bits)
Rounds values to requested precision.

Details: round modifies the sample data so that each value is rounded to the specified number of bits. Rounding is accomplished by setting the least significant bits to 0.

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

round

public static byte[] round(byte[] src,
                           int from,
                           byte[] dest,
                           int to,
                           int amt,
                           int bits)
Rounds values to requested precision.

Details: round modifies the sample data so that each value is rounded to the specified number of bits. Rounding is accomplished by setting the least significant bits to 0.

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

Sharkysoft home