|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lava.riff.wave.WaveFormatChunk | +--lava.riff.wave.PcmWaveFormatChunk
Format chunk for Microsoft PCM .wav files.
Details: A PcmWaveFormatChunk
represents the format chunk of a RIFF-Wave file where the sample data is encoded using the Microsoft PCM format.
Field Summary | |
short |
wBitsPerSample
Number of bits per channel sample. |
Fields inherited from class lava.riff.wave.WaveFormatChunk |
dwAvgBytesPerSec,
dwSamplesPerSec,
wBlockAlign,
wChannels,
wFormatTag |
Constructor Summary | |
PcmWaveFormatChunk(int channels,
int bpcs,
int rate)
Sets sampling parameters. |
Method Summary | |
int |
getSampleSize()
Computes bytes per sample. |
byte[] |
toBytes()
Serializes chunk. |
java.lang.String |
toString()
Serializes to string. |
Methods inherited from class lava.riff.wave.WaveFormatChunk |
clone,
validateFields |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public short wBitsPerSample
Details: This member reflects the wBitsPerSample field in a PCM format chunk, or the number of bits per channel sample. This is the number of bits used to sample a single channel, even if wChannels > 1
. It is assumed that all channels have the same bits per channel sample.
Constructor Detail |
public PcmWaveFormatChunk(int channels, int bpcs, int rate)
Details: This constructor sets the members of this format chunk to reflect the given sampling parameters, namely, the number of channels (channels), the bits per channel sample (bpcs), and the number of samples per second (rate).
channels
- the number of channelsbits
- per channel samplesample
- rateMethod Detail |
public final int getSampleSize()
Details: This method returns the number of bytes per sample. :
Details: getSampleSize
returns the number of bytes required to contain a single, full sample. The value is determined by considering the number of bits per channel sample and the number of channels, as follows:
bits per channel sample | mono | stereo |
---|---|---|
1-8 | 1 byte | 2 bytes |
9-16 | 2 byte | 4 bytes |
17-24 | 3 byte | 6 bytes |
25-32 | 4 byte | 8 bytes |
These values are calculated without allowing bits from different channel samples to be packed into the same byte.
public byte[] toBytes()
Details: toBytes
serializes this chunk into a string of bytes, as it would appear in a .wav file.
public java.lang.String toString()
Details: toString
produces a string representation of this chunk. This representation is useful for debugging.
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |