|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lava.riff.wave.WaveStreamWriter | +--lava.riff.wave.PcmWaveStreamWriter
Writes standard Microsoft PCM wave files.
Details: No details available.
Fields inherited from class lava.riff.wave.WaveStreamWriter |
rsw |
Constructor Summary | |
PcmWaveStreamWriter(IRiffOutput raos,
PcmWaveFormatChunk fmt)
|
Method Summary | |
void |
beginSamples(long duration)
Opens wave sample data chunk. |
void |
close()
Closes stream. |
void |
endSamples()
Closes wave data chunk. |
void |
writeSamples(java.lang.Object samples,
int samples_from,
int duration)
Encodes and writes samples. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public PcmWaveStreamWriter(IRiffOutput raos, PcmWaveFormatChunk fmt) throws java.io.IOException
Method Detail |
public void beginSamples(long duration) throws java.io.IOException
Details: beginSamples
prepares this WaveStreamWriter
to begin recording wave sample data. This method must be called before writeSamples
can be called.
If the number of (full) samples to be written is known ahead of time, that value should be provided in the duration parameter; otherwise, set this parameter to 0. Providing the duration value ahead of time allows the RIFF writer to complete the header that must appear before the sample data. Otherwise, the RIFF writer will need to seek backward in the file to complete the header after endSamples
is called, which can strain the underlying buffering mechanisms if the data isn't being written to a standard random access file.
duration
- number of samplespublic void writeSamples(java.lang.Object samples, int samples_from, int duration) throws java.io.IOException
Details: writeSamples
writes the given samples (in samples) into the wave file's wave data chunk. The sample values are given in a sample array, which is described in the package header. If the sample resolution implied by the array's primitive type is not the sample resolution of this wave file (as set in the format chunk), this method will automatically convert the samples before writing them.
The first sample in the given array is taken from samples [samples_from]. Exactly duration * wChannels values are encoded and written to the stream, where wChannels is the number of channels as set in the format chunk.
samples
- sample arraysamples_from
- starting offset into arrayduration
- number of samples to processpublic void endSamples() throws java.io.IOException
Details: Call endSamples
when there are no more wave samples to encode and write to the wave stream. Because this method causes the underlying RIFF stream generator to close the wave data chunk, no more samples can be written after this method is called.
public void close() throws java.io.IOException
Details: This method closes all open chunks in the wave stream and completes the stream. The close method of the underlying RiffStreamWriter is also called, which in turn calls the close method of its underlying IRiffOutput.
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |