|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.groovemanager.thread.ProgressThread
com.groovemanager.sampled.waveform.CreatePeakFileThread
This ProgressThread implementationcan be used to create a peak file out of a given AudioInputStream. This peak file can then be used for creating a PeakWaveForm.
| Nested Class Summary |
|---|
| Nested classes inherited from class java.lang.Thread |
|---|
java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected byte[] |
buffer
Temporary buffer |
protected int |
buffer_size
buffer size |
protected int |
bytesPerFrame
The AudioFormatīs frame size |
protected int |
bytesPerSample
The AudioFormatīs frame size |
static int |
DEFAULT_INTERVALL_SIZE
Default number of sample frames represented by one snapshot |
protected javax.sound.sampled.AudioFormat |
format
The AudioFormat of the source data |
protected javax.sound.sampled.AudioInputStream |
in
The AudioInputStream to read the peak data from |
protected int |
intervallPosition
Current position inside one interval |
protected int |
iSize
Number of sample frames represented by one snapshot |
protected int |
numBytesRead
Number of bytes read in the last read operation. |
protected java.io.OutputStream |
out
The OutputStream to write the peak file to |
protected byte[] |
p
Temporary buffer |
protected long |
snapshots
Number of snapshots to write |
protected java.io.File |
sourceFile
The source audio file if known |
protected byte |
value
temporary variable |
protected int |
valuesWritten
Number of snapshot values written so far |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.File peak)
Construct a new CreatePeakFileThread that reads audio data from the given AudioInputStream and writes the peak data into the given file |
|
CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.File peak,
int intervallSize)
Construct a new CreatePeakFileThread that reads audio data from the given AudioInputStream and writes the peak data into the given file |
|
CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.OutputStream out)
Construct a new CreatePeakFileThread that reads audio data from the given AudioInputStream and writes the peak data to the given OutputStream |
|
CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.OutputStream out,
int intervallSize)
Construct a new CreatePeakFileThread that reads audio data from the given AudioInputStream and writes the peak data to the given OutputStream |
|
CreatePeakFileThread(java.io.File source,
java.io.File peak)
Construct a new CreatePeakFileThread that reads audio data from the given audio file and writes the peak data to the given OutputStream |
|
CreatePeakFileThread(java.io.File source,
java.io.File peak,
int intervallSize)
Construct a new CreatePeakFileThread that reads audio data from the given audio file and writes the peak data to the given OutputStream |
|
CreatePeakFileThread(java.io.File source,
java.io.OutputStream out)
Construct a new CreatePeakFileThread that reads audio data from the given audio file and writes the peak data to the given OutputStream |
|
CreatePeakFileThread(java.io.File source,
java.io.OutputStream out,
int intervallSize)
Construct a new CreatePeakFileThread that reads audio data from the given audio file and writes the peak data to the given OutputStream |
|
| Method Summary | |
|---|---|
protected boolean |
breakCondition()
The break condition to indicate that the operation has finished |
protected void |
cleanUp()
Free any ressources and perform clean up operations. |
protected void |
init()
Any kind of initialization in the moment right before starting the operation should be performed here |
protected void |
processNext()
Perform the next step. |
protected java.lang.Object |
result()
Specify the result of this operation, if any. |
protected int |
tellElapsed()
Tell the length of the operation elapsed so for |
protected int |
tellTotal()
Tell the total length of the operation |
protected byte[] |
writeHeader()
Generate the peak fileīs header data. |
| Methods inherited from class com.groovemanager.thread.ProgressThread |
|---|
cancelOperation, getElapsed, getErrorMessage, getResult, getTotal, hasFinished, run, setMonitor |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected byte[] buffer
protected int buffer_size
protected int bytesPerFrame
protected int bytesPerSample
public static final int DEFAULT_INTERVALL_SIZE
protected javax.sound.sampled.AudioFormat format
protected javax.sound.sampled.AudioInputStream in
protected int intervallPosition
protected int iSize
protected int numBytesRead
protected java.io.OutputStream out
protected byte[] p
protected long snapshots
protected java.io.File sourceFile
protected byte value
protected int valuesWritten
| Constructor Detail |
|---|
public CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.File peak)
throws java.io.FileNotFoundException
in - The AudioInputStream to read frompeak - The file to write the data to
java.io.FileNotFoundException - If the file could not be opened for writing
public CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.File peak,
int intervallSize)
throws java.io.FileNotFoundException
in - The AudioInputStream to read frompeak - The file to write the data tointervallSize - The interval size to use
java.io.FileNotFoundException - If the file could not be opened for writing
public CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.OutputStream out)
in - The AudioInputStream to read fromout - The OutputStream to write to
public CreatePeakFileThread(javax.sound.sampled.AudioInputStream in,
java.io.OutputStream out,
int intervallSize)
in - The AudioInputStream to read fromout - The OutputStream to write tointervallSize - The interval size to use
public CreatePeakFileThread(java.io.File source,
java.io.File peak)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
source - The audio file to read frompeak - The file to write to
javax.sound.sampled.UnsupportedAudioFileException - If the given audio fileīs format
can not be read
java.io.IOException - If an I/O Error occured during file reading or
OutputStream creation
public CreatePeakFileThread(java.io.File source,
java.io.File peak,
int intervallSize)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
source - The audio file to read frompeak - The file to write tointervallSize - The interval size to use
javax.sound.sampled.UnsupportedAudioFileException - If the given audio fileīs format
can not be read
java.io.IOException - If an I/O Error occured during file reading or
OutputStream creation
public CreatePeakFileThread(java.io.File source,
java.io.OutputStream out)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
source - The audio file to read fromout - The OutputStream to write to
javax.sound.sampled.UnsupportedAudioFileException - If the given audio fileīs format
can not be read
java.io.IOException - If an I/O Error occured during file reading
public CreatePeakFileThread(java.io.File source,
java.io.OutputStream out,
int intervallSize)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
source - The audio file to read fromout - The OutputStream to write tointervallSize - The interval size to use
javax.sound.sampled.UnsupportedAudioFileException - If the given audio fileīs format
can not be read
java.io.IOException - If an I/O Error occured during file reading| Method Detail |
|---|
protected boolean breakCondition()
ProgressThread
breakCondition in class ProgressThreadprotected void cleanUp()
ProgressThread
cleanUp in class ProgressThreadprotected void init()
ProgressThread
init in class ProgressThreadprotected void processNext()
ProgressThreadtellElpased() < tellTotal() andbreakCondition() != true and
processNext in class ProgressThreadprotected java.lang.Object result()
ProgressThread
result in class ProgressThreadnull should onlx be returned, if the operation
didnīt finish correctly. If it did finish correctly, but it has no
result, a dummy object should be returned.protected int tellElapsed()
ProgressThread
tellElapsed in class ProgressThreadprotected int tellTotal()
ProgressThread
tellTotal in class ProgressThreadprotected byte[] writeHeader()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||