- public class PCM2PCMConversionProvider
- extends TSimpleFormatConversionProvider
This provider supports these PCM conversions (<--> meaning both directions):
The class uses 2 different approaches for conversion:
- 8 Signed <-> 8 unsigned
- 16/24/32 Signed little endian <-> 16/24/32 Signed big endian
- arbitrary conversion between 8/16/24/32 bit sample width
(up-conversion is done by adding low-byte zero(s)).
- 1 channel <-> x channels
- Simple, often used conversions with performance-optimized methods.
These are the following conversions:
- 8 Signed <-> 8 unsigned
- 16 signed little endian <--> 16 signed big endian
- 24 signed little endian <--> 24 signed big endian
- 32 signed little endian <--> 32 signed big endian
- 16 signed little endian <--> 8 signed
- 16 signed big endian <--> 8 signed
- 16 signed little endian <--> 8 unsigned
- 16 signed big endian <--> 8 unsigned
Downsampling from 16bit to 8bit is currently done
using the float conversion (see next point), in order
to profit of dithering.
- All other conversions are done using the FloatSampleBuffer.
Mixdown of channels (x channels -> 1 channel) is done by
plainly adding all channels together.
Thus, up mixing and down mixing will not result in the same audio,
as downmixing does NOT lower the volume and clippings are very
probable. To avoid that, the volume of the channels
should be lowered before using this converter for down mixing.
- All conversions support upmixing of channels:
1 channel -> x channels. This is done by
copying the channel to the other channels after
conversion of the format (if necessary).
SampleRate CANNOT be converted.
- Florian Bomers
- See Also:
|Methods inherited from class org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider
disable, doMatch, doMatch, getCollectionSourceEncodings, getCollectionSourceFormats, getCollectionTargetEncodings, getCollectionTargetFormats, getFrameSize, getSourceEncodings, getTargetEncodings, getTargetEncodings, isAllowedSourceEncoding, isAllowedSourceFormat, isAllowedTargetEncoding, isAllowedTargetFormat, isSourceEncodingSupported, isTargetEncodingSupported, replaceNotSpecified
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static AudioFormat.Encoding PCM_SIGNED
public static AudioFormat.Encoding PCM_UNSIGNED
public AudioInputStream getAudioInputStream(AudioFormat targetFormat,
- Specified by:
getAudioInputStream in class
public AudioFormat getTargetFormats(AudioFormat.Encoding targetEncoding,
- Description copied from class:
- This implementation assumes that the converter can convert
from each of its source formats to each of its target
formats. If this is not the case, the converter has to
override this method.
getTargetFormats in class
public boolean isConversionSupported(AudioFormat targetFormat,
- method overidden due to the difficult situation with the channel count
and the possible conversions possible.
isConversionSupported in class