com.groovemanager.sampled.waveform
Class DynamicAudioFileWaveForm
java.lang.Object
com.groovemanager.sampled.waveform.AbstractWaveForm
com.groovemanager.sampled.waveform.AudioFileWaveForm
com.groovemanager.sampled.waveform.DynamicAudioFileWaveForm
- All Implemented Interfaces:
- WaveForm
- public class DynamicAudioFileWaveForm
- extends AudioFileWaveForm
This class extends the AudioFileWaveForm class so that it can be used for
a dynamically growing audio file, especially in recording situations.
- Author:
- Manu Robledo
|
Constructor Summary |
DynamicAudioFileWaveForm(java.io.File source,
int wavelength,
int maxwaves,
int iSize)
Construct a new DynamicAudioFileWaveForm |
|
Method Summary |
void |
append(byte[] data,
int offset,
int length)
Dynamically append data to this WaveForm. |
private static DynamicPeakWaveForm |
createPeak(java.io.File source,
int iSize)
Create a DynamicPeakFile for the given source file |
protected WaveForm |
loadRealWaveForm(int pos)
Get the WaveForm that corresponds to the given sample position. |
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 |
| Methods inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm |
canProvide, getAdditionalToString, getChannels, getData, 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 |
DynamicAudioFileWaveForm
public DynamicAudioFileWaveForm(java.io.File source,
int wavelength,
int maxwaves,
int iSize)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
- Construct a new DynamicAudioFileWaveForm
- Parameters:
source - The source audio filewavelength - The number of WaveForms kept in the poolmaxwaves - The length of each WaveForm in the pooliSize - The interval size to be used for the DynmaicPeakWaveForm
which is used as this WaveForm´s peak WaveForm
- Throws:
javax.sound.sampled.UnsupportedAudioFileException - If the given audio file can not be
read
java.io.IOException - If an I/O Error occured
append
public void append(byte[] data,
int offset,
int length)
- Dynamically append data to this WaveForm. Note that the data will not be
written to the underlying audio file.
- Parameters:
data - The audio data to appendoffset - Start position inside the data Arraylength - The length of data to be appended in bytes
createPeak
private static DynamicPeakWaveForm createPeak(java.io.File source,
int iSize)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
- Create a DynamicPeakFile for the given source file
- Parameters:
source - The source fileiSize - The intervall size
- Returns:
- The created DynamicPeakFile
- Throws:
javax.sound.sampled.UnsupportedAudioFileException - If the AudioFileFormat cannot be
read out of the given file
java.io.IOException - If an I/O error occurs
loadRealWaveForm
protected WaveForm loadRealWaveForm(int pos)
- Description copied from class:
AudioFileWaveForm
- Get the WaveForm that corresponds to the given sample position. If this
WaveForm is already in the pool, it will be returned from there,
otherwise it will be loaded into the pool
- Overrides:
loadRealWaveForm in class AudioFileWaveForm
- Parameters:
pos - The position of the audio data in question in sample frames
- Returns:
- The WaveForm holding the audio data at the given position
subWaveForm
public WaveForm subWaveForm(int begin,
int length,
int width)
- Description copied from interface:
WaveForm
- Get a WaveForm Object that represents the part of
this WaveForm specified by
begin and
length and displays this part in the
specified width
- Specified by:
subWaveForm in interface WaveForm- Overrides:
subWaveForm in class AudioFileWaveForm
- Parameters:
begin - 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.
- Returns:
- A WaveForm Object that represents the specified
Part of this WaveForm and displays it in the given
width. Can also be the same Object with adapted
attributes
- See Also:
WaveForm.subWaveForm(int, int, int)