|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groovemanager.sampled.waveform.AbstractWaveForm
com.groovemanager.sampled.waveform.PeakWaveForm
A PeakWaveForm is a WaveForm that gets its data out of a number of peak
values that have been created once for a file. Each peak value represents
a number of sample frames in the original file and consists of a maximum
and a minimum value for each cahnnel. Mostly this peak data is stored in a
peak file, that is assigned to an audio file by giving it the name of the
original file with an added ".gmpk" extension. The file myfile.wav.gmpk is
for example the peak file of the file myfile.wav in the same directory.
A PeakWaveForm can also be created out of another WaveForm. In this case,
the peak values are created when they are first needed and then stored in
memory.
| Field Summary | |
|---|---|
protected byte[] |
data
The peak data |
static java.lang.String |
DEFAULT_PEAKFILE_EXTENSION
The default extension for peak files |
protected WaveForm |
source
PeakWaveForms can also be created on the fly from a source WaveForm. |
| Fields inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm |
|---|
channels, displayWidth, intervallSize, nullWave, position, realLength |
| Constructor Summary | |
|---|---|
|
PeakWaveForm(byte[] data)
Construct a new PeakWaveForm out of the given peak data. |
|
PeakWaveForm(java.io.File peakFile)
Create a new PeakWaveForm out of the given peak file |
private |
PeakWaveForm(WaveForm source,
int newWidth)
Private Constructor to be used from getPeak(). |
| Method Summary | |
|---|---|
static boolean |
checkPeakFile(java.io.File f,
java.io.File p)
Check, if the given peak file is a valid peak file for the given audio file. |
static PeakWaveForm |
createPeakWaveForm(java.io.File source,
org.eclipse.swt.widgets.Shell shell)
Get a PeakWaveForm for the given audio file. |
protected java.lang.String |
getAdditionalToString()
Get an additional String describing this WaveForm. |
byte[] |
getData()
Get the whole Peak data as array. |
static byte[] |
getHeader(int iSize,
long lastModified,
long realLength,
short channels,
int snapshots)
Create a valid peak file header out of the given data |
byte |
getMax(int channel)
Get the maximum value at the current read position in the given channel |
byte |
getMin(int channel)
Get the minimum value at the current read position in the given channel |
static WaveForm |
getPeak(WaveForm source,
int newWidth,
int iSize)
Get a PeakWaveForm for the given WaveForm |
protected void |
readFromFile(java.io.File peakFile)
Read the peak data from the given file |
WaveForm |
subWaveForm(int begin,
int length,
int width)
Get a WaveForm Object that represents the part of this WaveForm specified by begin and
length and displays this part in the
specified width |
static void |
writeToStream(WaveForm source,
java.io.OutputStream out,
long lastModified,
int iSize)
Write the given source WaveForm as a peak file into a given output. |
| Methods inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm |
|---|
canProvide, getChannels, getDisplayableLength, getIntervallSize, getPosition, getRealLength, getRealPosition, getZoomFactor, next, rewind, setPosition, setRealPosition, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected byte[] data
public static final java.lang.String DEFAULT_PEAKFILE_EXTENSION
protected WaveForm source
| Constructor Detail |
|---|
public PeakWaveForm(byte[] data)
data - The peak data
public PeakWaveForm(java.io.File peakFile)
throws java.io.IOException
peakFile - The peak file containing the peak data
java.io.IOException - If an I/O Error occured during reading
private PeakWaveForm(WaveForm source,
int newWidth)
getPeak().
source - The source WaveFormnewWidth - The width of the WaveForm to create| Method Detail |
|---|
public static boolean checkPeakFile(java.io.File f,
java.io.File p)
f - The audio filep - The peak file
public static PeakWaveForm createPeakWaveForm(java.io.File source,
org.eclipse.swt.widgets.Shell shell)
throws javax.sound.sampled.UnsupportedAudioFileException,
NotFinishedException,
java.io.IOException
source - The audio file to create the peak file forshell - The parent Shell, under which the ProgressMonitor should
be opened
javax.sound.sampled.UnsupportedAudioFileException - If the audio file´s format cannot
be read
NotFinishedException - If no valid peak file was found and the
operation for creating it didn´t finish correctly.
java.io.IOException - If an I/O Error occuredprotected java.lang.String getAdditionalToString()
AbstractWaveFormtoString()
getAdditionalToString in class AbstractWaveFormpublic byte[] getData()
WaveForm
getData in interface WaveFormgetData in class AbstractWaveFormWaveForm.getData()
public static byte[] getHeader(int iSize,
long lastModified,
long realLength,
short channels,
int snapshots)
iSize - The interval sizelastModified - The last modification date of the audio file
represented by this peak file or -1, if it is not knownrealLength - The length of the audio data in the audio file in
sample frameschannels - The number of channels of the audio filesnapshots - The number of peak values (snapshots) contained in this
peak file
public byte getMax(int channel)
WaveForm
channel - the zero-based index of the channel
public byte getMin(int channel)
WaveForm
channel - the zero-based index of the channel
public static WaveForm getPeak(WaveForm source,
int newWidth,
int iSize)
source - The WaveForm to get a PeakWaveForm for.newWidth - The width of the new PeakWaveFormiSize - The interval size to use for the new PeakWaveForm
protected void readFromFile(java.io.File peakFile)
throws java.io.IOException
peakFile - The file to read from
java.io.IOException - If an I/O Error occured during reading
public WaveForm subWaveForm(int begin,
int length,
int width)
WaveFormbegin and
length and displays this part in the
specified width
subWaveForm in interface WaveFormsubWaveForm in class AbstractWaveFormbegin - The offset to the beginning of this
WaveForm. May also be negative.length - The length in steps of this WaveForm
that should be represented by the returned WaveForm.width - The new width in which the part should
be displayed.
WaveForm.subWaveForm(int, int, int)
public static void writeToStream(WaveForm source,
java.io.OutputStream out,
long lastModified,
int iSize)
throws java.io.IOException
source - The WaveForm to get the peak data fromout - The OutputStream to write the data tolastModified - The last modification date of the audio file this
peak data belongs to or -1, if it is not knowniSize - The interval size of the WabeForm
java.io.IOException - If an I/O Error occurs during writing
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||