Sharkysoft home

lava.riff.wave
Class WaveCuePointList

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

public class WaveCuePointList
extends java.lang.Object

Parses cue point list.

Details: A WaveCuePointList parses the cue point list (contained in the cue point chunk) of a wave file and provides access to the information contained in the individual cue point structures. Instances of this class are obtained by calling WaveStreamReader.getCuePoints.

In a given .wav file, the cue points may not be stored in any particular order. If an specific ordering is required, the client should call one of the sorting methods. Each cue point has, at the very least, an index (i.e., list order), a name (4 byte tag), and a position (i.e., offset into wave sample data). Cue points often have additional data, such as labels, recorded in a separate ADTL chunk.

Author:
Sharky

Method Summary
 int countCuePoints()
          Counts cue points.
 int findLabel(java.lang.String label)
          Searches for cue point label.
 java.lang.String getLabel(int index)
          Returns cue point label.
 int getName(int index)
          Returns cue point name.
 long getPosition(int index)
          Returns cue point position.
 WaveCuePointList sortByLabel()
          Sorts list by label.
 WaveCuePointList sortByPosition()
          Sorts list by sample position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

countCuePoints

public int countCuePoints()
                   throws java.io.IOException
Counts cue points.

Details: countCuePoints determines the total number of cue points in this list and returns it.

Returns:
number of cue points
Throws:
java.io.IOException - if an I/O error occurs

getName

public int getName(int index)
            throws java.io.IOException
Returns cue point name.

Details: getName returns the cue point name of the cue point whose index in the list is index.

Parameters:
index - cue point index
Returns:
cue point name
Throws:
java.io.IOException - if an I/O error occurs

getPosition

public long getPosition(int index)
                 throws java.io.IOException
Returns cue point position.

Details: getPosition returns the cue point position of the cue point whose index in the list is index.

Parameters:
index - cue point index
Returns:
cue point position
Throws:
java.io.IOException - if an I/O error occurs

getLabel

public java.lang.String getLabel(int index)
                          throws java.io.IOException
Returns cue point label.

Details: getLabel returns the cue point label of the cue point whose index in the list is index.

This method is the inverse of {@see #findLabel(java.lang.String) findLabel}.

Parameters:
index - cue point index
Returns:
cue point label
Throws:
java.io.IOException - if an I/O error occurs

findLabel

public int findLabel(java.lang.String label)
              throws java.io.IOException
Searches for cue point label.

Details: findLabel searches through the list of cue points for the first cue point whose label is label. If found, the index of the cue point is returned.

This method is the inverse of {@see #getLabel(int) getLabel}.

Parameters:
label - cue point label
Returns:
cue point index
Throws:
java.io.IOException - if an I/O error occurs

sortByPosition

public WaveCuePointList sortByPosition()
                                throws java.io.IOException
Sorts list by sample position.

Details: sortByPosition reads the position values of every cue point in this list, sorts the cue points in order of position, earliest first, and then creates and returns a new WaveCuePointList instance whose cue points are in the sorted order.

Returns:
sorted list
Throws:
java.io.IOException - if an I/O error occurs

sortByLabel

public WaveCuePointList sortByLabel()
                             throws java.io.IOException
Sorts list by label.

Details: sortByLabel reads the labels of every cue point in this list, sorts the cue points in alphabetical order, and then creates and returns a new WaveCuePointList instance whose cue points are in the sorted order.

Returns:
sorted list
Throws:
java.io.IOException - if an I/O error occurs

Sharkysoft home