javaFlacEncoder
Class FLAC_FileEncoder

java.lang.Object
  extended by javaFlacEncoder.FLAC_FileEncoder

public class FLAC_FileEncoder
extends java.lang.Object

FLAC_FileEncoder is a class to encode an input wav File to an output Flac file. It allows the EncodingConfiguration to be set only once, prior to encoding the entire File.

Author:
Preston Lacey

Nested Class Summary
static class FLAC_FileEncoder.Status
          Status enum for encode result
 
Constructor Summary
FLAC_FileEncoder()
          Constructor creates a FLAC_FileEncoder object with default StreamConfiguration configuration and default EncodingConfiguration.
 
Method Summary
 FLAC_FileEncoder.Status encode(java.io.File inputFile, java.io.File outputFile)
          Encode the given input wav file to an output file.
 int getLastTotalSamplesEncoded()
          Get the total number of samples encoded in last encode.
 void setEncodingConfig(EncodingConfiguration config)
          Set the EncodingConfiguration to use for encoding.
 void setStreamConfig(StreamConfiguration config)
          Set the stream configuration for this encoder to use.
 void useThreads(boolean val)
          Specify whether to use multiple threads or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FLAC_FileEncoder

public FLAC_FileEncoder()
Constructor creates a FLAC_FileEncoder object with default StreamConfiguration configuration and default EncodingConfiguration. Thread use defaults to true.

Method Detail

useThreads

public void useThreads(boolean val)
Specify whether to use multiple threads or not.

Parameters:
val - true to use threads, false otherwise.

setStreamConfig

public void setStreamConfig(StreamConfiguration config)
Set the stream configuration for this encoder to use. Note that the audio characteristics(number of channels, sample rate, and sample size), will be set to match the input file at encode time, so needn't be set in the given StreamConfiguration object.

Parameters:
config - StreamConfiguration to use for encoding.

setEncodingConfig

public void setEncodingConfig(EncodingConfiguration config)
Set the EncodingConfiguration to use for encoding.

Parameters:
config - EncodingConfiguration to use.

encode

public FLAC_FileEncoder.Status encode(java.io.File inputFile,
                                      java.io.File outputFile)
Encode the given input wav file to an output file.

Parameters:
inputFile - Input wav file to encode.
outputFile - Output file to write FLAC stream to. If file exists, it will be overwritten without prompting.
Returns:
Status flag for encode

getLastTotalSamplesEncoded

public int getLastTotalSamplesEncoded()
Get the total number of samples encoded in last encode. This is here primarily for use as a sanity check during debugging.

Returns:
Total number of samples encoded in last encode attempt.