com.groovemanager.sampled.providers
Class SliceChunk

java.lang.Object
  extended by com.groovemanager.sampled.providers.WaveChunk
      extended by com.groovemanager.sampled.providers.SliceChunk

public class SliceChunk
extends WaveChunk

This class represents a self-defined Chunk for wave files to include slice information.

Author:
Manu Robledo

Field Summary
 
Fields inherited from class com.groovemanager.sampled.providers.WaveChunk
chunkData, chunkname
 
Constructor Summary
SliceChunk(byte[] data)
          Construct a new SliceChunk out of the given chunk data.
SliceChunk(int[][] slices)
          Construct a new SliceChunk out of the given slices
 
Method Summary
private static byte[] createData(int[][] slices)
          Create the chunk data out of the given slices
 int getSliceCount()
          Get the number of slices contained in this Chunk
 int[][] getSlices()
          Get the slices out of this Chunk
 
Methods inherited from class com.groovemanager.sampled.providers.WaveChunk
getData, getLength, getName, writeToOut, writeToOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SliceChunk

public SliceChunk(byte[] data)
Construct a new SliceChunk out of the given chunk data. The chunk data must not contain the Chunk id ("slic") or the chunk length

Parameters:
data - The chunk data

SliceChunk

public SliceChunk(int[][] slices)
Construct a new SliceChunk out of the given slices

Parameters:
slices - For each slice this Array should contain an int-Array of size 2 containing the frame position of the slice at index [0] and the frame length of the slice or -1 at index [1]
Method Detail

createData

private static byte[] createData(int[][] slices)
Create the chunk data out of the given slices

Parameters:
slices - For each slice this Array should contain an int-Array of size 2 containing the frame position of the slice at index [0] and the frame length of the slice or -1 at index [1]
Returns:
The chunk data

getSliceCount

public int getSliceCount()
Get the number of slices contained in this Chunk

Returns:
The number of slices contained in this chunk

getSlices

public int[][] getSlices()
Get the slices out of this Chunk

Returns:
The slices contained in this Chunk. For each slice this Array will contain an int-Array of size 2 containing the frame position of the slice at index [0] and the frame length of the slice or -1 at index [1]