Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.tuneology.avm
Class AudioConverter  view AudioConverter download AudioConverter.java

java.lang.Object
  extended bycom.tuneology.avm.AudioConverter

public class AudioConverter
extends java.lang.Object

Utilities for converting audio files to different types.

Version:
$Id: AudioConverter.java,v 1.5 2002/11/05 08:06:44 xnarf Exp $

Nested Class Summary
private static class AudioConverter.MadplayReader
           
private static class AudioConverter.MadplayVerRdr
           
private static class AudioConverter.Mpg123VerRdr
           
private static class AudioConverter.NotLameReader
           
private static class AudioConverter.NotlameVerRdr
           
private static class AudioConverter.Ogg123VerRdr
           
private static class AudioConverter.OggencReader
           
private static class AudioConverter.OggencVerRdr
           
 
Field Summary
private static int COPY_BUFSIZ
           
private static java.lang.String madplayCmd
           
private static int MP3_HIGH_QUALITY_RATE
           
private static int MP3_LOW_QUALITY_RATE
           
private static int MP3_MED_QUALITY_RATE
           
private static java.lang.String mpg123Cmd
           
private static java.lang.String normalizeCmd
           
private static java.lang.String notLameCmd
           
private static int OGG_HIGH_QUALITY_RATE
           
private static int OGG_LOW_QUALITY_RATE
           
private static int OGG_MED_QUALITY_RATE
           
private static java.lang.String ogg2wavCmd
           
private static java.io.File tempDir
           
private static boolean useMpg123
           
private static int WAV_HIGH_QUALITY_RATE
           
private static int WAV_LOW_QUALITY_RATE
           
private static int WAV_MED_QUALITY_RATE
           
private static java.lang.String wav2oggCmd
           
private static int WMA_HIGH_QUALITY_RATE
           
private static int WMA_LOW_QUALITY_RATE
           
private static int WMA_MED_QUALITY_RATE
           
 
Constructor Summary
private AudioConverter()
           
 
Method Summary
private static void addNotLameArgs(java.util.Vector v, TocEntry finfo, FormatPrefs prefs, boolean isMP3)
           
private static void addOggencArgs(java.util.Vector v, TocEntry finfo, FormatPrefs prefs)
           
static java.io.File convertFile(java.io.File dir, java.io.File src, FormatPrefs prefs, TocEntry finfo, ProgressListener pm, boolean isTemp)
          Converts a file from one format to another
static java.io.File convertMP3ToOgg(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Creates a new Ogg file based on an existing MP3 file.
static java.io.File convertMP3ToWAV(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Creates a new WAV file based on an existing MP3 file.
static java.io.File convertOggToMP3(java.io.File dir, java.io.File f, TocEntry info, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Converts a file from OGG format to MP3 format.
static java.io.File convertOggToWAV(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Creates a new WAV file based on an existing Ogg file.
static java.io.File convertWAVToMP3(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Creates a new MP3 file based on an existing WAV file.
static java.io.File convertWAVToOgg(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Creates a new Ogg file based on an existing WAV file.
static void createSubdirs(java.lang.String path)
          Creates any necessary subdirectories for the path.
static int getFileFormat(java.io.File f)
          Returns the file type.
static java.lang.String getVersions()
          Returns a string containing the versions of all the format conversion programs.
private static java.lang.String madplayVersion()
           
static java.io.File makeLocalCopy(java.io.File dir, java.io.File f, ProgressListener pm, boolean isTemp)
          Given a file, creates a new object representing a local version of the file, and copies the file from the remote store to the local file system.
private static java.lang.String mpg123Version()
           
private static java.lang.String newPath(java.lang.String f, java.lang.String suffix)
           
static void normalize(java.io.File f)
           
private static java.lang.String notlameVersion()
           
private static java.lang.String ogg123Version()
           
private static java.lang.String oggencVersion()
           
private static int parseSecs(java.lang.String tm)
           
static java.io.File resampleMP3(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Changes the sampling rate (or other characteristics) of an existing MP3 file.
static java.io.File resampleOgg(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
          Changes the sampling rate (or other characteristics) of an existing OGG file.
private static java.io.File runMadplay(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
           
private static java.io.File runMpg123(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
           
private static java.io.File runNotLame(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp, boolean isMP3)
           
private static java.io.File runWav2Ogg(java.io.File dir, java.io.File f, TocEntry finfo, FormatPrefs prefs, ProgressListener pm, boolean isTemp)
           
static void setLameCmd(java.lang.String cmd)
           
static void setMadplayCmd(java.lang.String cmd)
           
static void setMpg123Cmd(java.lang.String cmd)
           
static void setNormalizeCmd(java.lang.String cmd)
           
static void setOgg2wavCmd(java.lang.String cmd)
           
static void setTempDir(java.io.File dir)
           
static void setWav2oggCmd(java.lang.String cmd)
           
static long spaceRequired(TocEntry finfo, FormatPrefs prefs)
          returns the number of bytes of space required to store the specified file according to the specified preferences.
private static java.lang.String truncateName(java.lang.String str, int mx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPY_BUFSIZ

private static final int COPY_BUFSIZ
See Also:
Constant Field Values

mpg123Cmd

private static java.lang.String mpg123Cmd

madplayCmd

private static java.lang.String madplayCmd

ogg2wavCmd

private static java.lang.String ogg2wavCmd

wav2oggCmd

private static java.lang.String wav2oggCmd

notLameCmd

private static java.lang.String notLameCmd

normalizeCmd

private static java.lang.String normalizeCmd

tempDir

private static java.io.File tempDir

useMpg123

private static boolean useMpg123

MP3_LOW_QUALITY_RATE

private static final int MP3_LOW_QUALITY_RATE
See Also:
Constant Field Values

MP3_MED_QUALITY_RATE

private static final int MP3_MED_QUALITY_RATE
See Also:
Constant Field Values

MP3_HIGH_QUALITY_RATE

private static final int MP3_HIGH_QUALITY_RATE
See Also:
Constant Field Values

OGG_LOW_QUALITY_RATE

private static final int OGG_LOW_QUALITY_RATE
See Also:
Constant Field Values

OGG_MED_QUALITY_RATE

private static final int OGG_MED_QUALITY_RATE
See Also:
Constant Field Values

OGG_HIGH_QUALITY_RATE

private static final int OGG_HIGH_QUALITY_RATE
See Also:
Constant Field Values

WAV_LOW_QUALITY_RATE

private static final int WAV_LOW_QUALITY_RATE
See Also:
Constant Field Values

WAV_MED_QUALITY_RATE

private static final int WAV_MED_QUALITY_RATE
See Also:
Constant Field Values

WAV_HIGH_QUALITY_RATE

private static final int WAV_HIGH_QUALITY_RATE
See Also:
Constant Field Values

WMA_LOW_QUALITY_RATE

private static final int WMA_LOW_QUALITY_RATE
See Also:
Constant Field Values

WMA_MED_QUALITY_RATE

private static final int WMA_MED_QUALITY_RATE
See Also:
Constant Field Values

WMA_HIGH_QUALITY_RATE

private static final int WMA_HIGH_QUALITY_RATE
See Also:
Constant Field Values
Constructor Detail

AudioConverter

private AudioConverter()
Method Detail

getVersions

public static java.lang.String getVersions()
Returns a string containing the versions of all the format conversion programs.


makeLocalCopy

public static java.io.File makeLocalCopy(java.io.File dir,
                                         java.io.File f,
                                         ProgressListener pm,
                                         boolean isTemp)
                                  throws java.io.IOException
Given a file, creates a new object representing a local version of the file, and copies the file from the remote store to the local file system.


getFileFormat

public static int getFileFormat(java.io.File f)
Returns the file type.


spaceRequired

public static long spaceRequired(TocEntry finfo,
                                 FormatPrefs prefs)
                          throws java.lang.Exception
returns the number of bytes of space required to store the specified file according to the specified preferences.


convertFile

public static java.io.File convertFile(java.io.File dir,
                                       java.io.File src,
                                       FormatPrefs prefs,
                                       TocEntry finfo,
                                       ProgressListener pm,
                                       boolean isTemp)
                                throws java.lang.Exception
Converts a file from one format to another


createSubdirs

public static void createSubdirs(java.lang.String path)
                          throws java.io.IOException
Creates any necessary subdirectories for the path.


resampleMP3

public static java.io.File resampleMP3(java.io.File dir,
                                       java.io.File f,
                                       TocEntry finfo,
                                       FormatPrefs prefs,
                                       ProgressListener pm,
                                       boolean isTemp)
                                throws java.lang.Exception
Changes the sampling rate (or other characteristics) of an existing MP3 file.


resampleOgg

public static java.io.File resampleOgg(java.io.File dir,
                                       java.io.File f,
                                       TocEntry finfo,
                                       FormatPrefs prefs,
                                       ProgressListener pm,
                                       boolean isTemp)
                                throws java.lang.Exception
Changes the sampling rate (or other characteristics) of an existing OGG file.


convertOggToMP3

public static java.io.File convertOggToMP3(java.io.File dir,
                                           java.io.File f,
                                           TocEntry info,
                                           FormatPrefs prefs,
                                           ProgressListener pm,
                                           boolean isTemp)
                                    throws java.lang.Exception
Converts a file from OGG format to MP3 format.


convertWAVToMP3

public static java.io.File convertWAVToMP3(java.io.File dir,
                                           java.io.File f,
                                           TocEntry finfo,
                                           FormatPrefs prefs,
                                           ProgressListener pm,
                                           boolean isTemp)
                                    throws java.lang.Exception
Creates a new MP3 file based on an existing WAV file.


convertMP3ToWAV

public static java.io.File convertMP3ToWAV(java.io.File dir,
                                           java.io.File f,
                                           TocEntry finfo,
                                           FormatPrefs prefs,
                                           ProgressListener pm,
                                           boolean isTemp)
                                    throws java.lang.Exception
Creates a new WAV file based on an existing MP3 file.


convertOggToWAV

public static java.io.File convertOggToWAV(java.io.File dir,
                                           java.io.File f,
                                           TocEntry finfo,
                                           FormatPrefs prefs,
                                           ProgressListener pm,
                                           boolean isTemp)
                                    throws java.lang.Exception
Creates a new WAV file based on an existing Ogg file.


convertMP3ToOgg

public static java.io.File convertMP3ToOgg(java.io.File dir,
                                           java.io.File f,
                                           TocEntry finfo,
                                           FormatPrefs prefs,
                                           ProgressListener pm,
                                           boolean isTemp)
                                    throws java.lang.Exception
Creates a new Ogg file based on an existing MP3 file.


convertWAVToOgg

public static java.io.File convertWAVToOgg(java.io.File dir,
                                           java.io.File f,
                                           TocEntry finfo,
                                           FormatPrefs prefs,
                                           ProgressListener pm,
                                           boolean isTemp)
                                    throws java.lang.Exception
Creates a new Ogg file based on an existing WAV file.


normalize

public static void normalize(java.io.File f)
                      throws java.lang.Exception

setMpg123Cmd

public static void setMpg123Cmd(java.lang.String cmd)

setMadplayCmd

public static void setMadplayCmd(java.lang.String cmd)

setOgg2wavCmd

public static void setOgg2wavCmd(java.lang.String cmd)

setWav2oggCmd

public static void setWav2oggCmd(java.lang.String cmd)

setLameCmd

public static void setLameCmd(java.lang.String cmd)

setNormalizeCmd

public static void setNormalizeCmd(java.lang.String cmd)

setTempDir

public static void setTempDir(java.io.File dir)

runWav2Ogg

private static java.io.File runWav2Ogg(java.io.File dir,
                                       java.io.File f,
                                       TocEntry finfo,
                                       FormatPrefs prefs,
                                       ProgressListener pm,
                                       boolean isTemp)
                                throws java.lang.Exception

addOggencArgs

private static void addOggencArgs(java.util.Vector v,
                                  TocEntry finfo,
                                  FormatPrefs prefs)

runMpg123

private static java.io.File runMpg123(java.io.File dir,
                                      java.io.File f,
                                      TocEntry finfo,
                                      FormatPrefs prefs,
                                      ProgressListener pm,
                                      boolean isTemp)
                               throws java.lang.Exception

addNotLameArgs

private static void addNotLameArgs(java.util.Vector v,
                                   TocEntry finfo,
                                   FormatPrefs prefs,
                                   boolean isMP3)

runNotLame

private static java.io.File runNotLame(java.io.File dir,
                                       java.io.File f,
                                       TocEntry finfo,
                                       FormatPrefs prefs,
                                       ProgressListener pm,
                                       boolean isTemp,
                                       boolean isMP3)
                                throws java.lang.Exception

parseSecs

private static int parseSecs(java.lang.String tm)

newPath

private static java.lang.String newPath(java.lang.String f,
                                        java.lang.String suffix)

notlameVersion

private static java.lang.String notlameVersion()

madplayVersion

private static java.lang.String madplayVersion()

runMadplay

private static java.io.File runMadplay(java.io.File dir,
                                       java.io.File f,
                                       TocEntry finfo,
                                       FormatPrefs prefs,
                                       ProgressListener pm,
                                       boolean isTemp)
                                throws java.lang.Exception

mpg123Version

private static java.lang.String mpg123Version()

oggencVersion

private static java.lang.String oggencVersion()

ogg123Version

private static java.lang.String ogg123Version()

truncateName

private static java.lang.String truncateName(java.lang.String str,
                                             int mx)