util
Class Toc

java.lang.Object
  extended by util.CommandLineParser
      extended by util.Toc

public class Toc
extends CommandLineParser

Writes a TOC to the file TOC or to the specified toc file given with the -o switch. Two further command line switches are recognized, -a for append to a toc file and -s to name the wav file containing the wav data. If no -a switch is given, the name of the wav file defaults to SIDE1, in the appending case the default wav-file name is SIDE2. As parameters this class expects the starting times in seconds for each track plus the ending time of the last track, i.e. you must give one more time-tag than tracks. Only the time-tag must be in correct order, command line switches can be at arbitrary positions
Examples:

        java util.Toc 6 174 373 654 840 1117

   
Read 5 tracks from the file SIDE1, create a new toc and write it to TOC. The first song starts after 6 seconds and has a duration of 168 seconds.
 
        java util.Toc -a -s uiuiui.wav 0 174 373 654 840 1117 -o out.toc

   
Read from the file uiuiui.wav, appends to the toc file out.toc and uses track boundaries as specified, the first song starting at the beginning of the wav file.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.CommandLineParser
CommandLineParser.Test
 
Field Summary
private  boolean append
          True if toc should be appended.
static String ONESWITCH
          All command line switches recoginzed with a single parameter.
private  double pregap
          The pregap prior to the first song.
static double PREGAP
          The default pregap .
static String SIDE1
          The default name of an A-side.
static String SIDE2
          The default name of a B-side.
private  File toc
          The file to write out the toc.
static String TOC
          The default toc output file.
private  File wav
          The wav file containing all tracks.
static String ZEROSWITCH
          All command line switches recoginzed without a parameter.
 
Constructor Summary
Toc()
          Creates a new toc dumper.
 
Method Summary
protected  void fill()
          Fills all relevant data with the defaults, if not explicetly given.
private static String getTocTime(double time)
          Converts seconds into the toc-time format.
static void main(String[] arg)
          Reads in a command line and converts it to a toc file.
 boolean writeToc()
          Writes the toc.
 
Methods inherited from class util.CommandLineParser
getArguments, getCommandLine, getCommands, getRegisteredSwitches, hasAnySwitch, hasSwitch, hasSwitch, haveAllSwitches, parse, printCommandLine, registerLine, registerSwitches, setCommands, staticUsage, usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZEROSWITCH

public static final String ZEROSWITCH
All command line switches recoginzed without a parameter.

See Also:
Constant Field Values

ONESWITCH

public static final String ONESWITCH
All command line switches recoginzed with a single parameter.

See Also:
Constant Field Values

SIDE1

public static final String SIDE1
The default name of an A-side.

See Also:
Constant Field Values

SIDE2

public static final String SIDE2
The default name of a B-side.

See Also:
Constant Field Values

TOC

public static final String TOC
The default toc output file.

See Also:
Constant Field Values

PREGAP

public static final double PREGAP
The default pregap .

See Also:
Constant Field Values

wav

private File wav
The wav file containing all tracks.


toc

private File toc
The file to write out the toc.


append

private boolean append
True if toc should be appended.


pregap

private double pregap
The pregap prior to the first song.

Constructor Detail

Toc

public Toc()
Creates a new toc dumper. Registeres the appropriate command line switches.

Method Detail

writeToc

public boolean writeToc()
                 throws IOException
Writes the toc. All the data given on the command line must be parsed prior to a call to this method, i.e. by calling CommandLineParser.parse(java.lang.String[]) and fill() in succession.

Throws:
IOException

fill

protected void fill()
Fills all relevant data with the defaults, if not explicetly given.


getTocTime

private static final String getTocTime(double time)
Converts seconds into the toc-time format. This format is mm:ss:ts where ts are the fractions of the seconds rounded to cd-second fractions (0.75 ts equals 1 second).


main

public static void main(String[] arg)
                 throws ParseException
Reads in a command line and converts it to a toc file.

Throws:
ParseException