org.tritonus.sampled.convert
Class SampleRateConversionProvider
java.lang.Object
javax.sound.sampled.spi.FormatConversionProvider
org.tritonus.share.sampled.convert.TFormatConversionProvider
org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider
org.tritonus.sampled.convert.SampleRateConversionProvider
- public class SampleRateConversionProvider
- extends TSimpleFormatConversionProvider
This provider converts sample rate of 2 PCM streams.
It does:
- conversion of different sample rates
- conversion of unsigned/signed (only 8bit unsigned supported)
- conversion of big/small endian
- 8,16,24,32 bit conversion
It does NOT:
- change channel count
- accept a stream where the sample rates are equal. This case should be handled
by the PCM2PCM converter
- Author:
- Florian Bomers
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 |
PCM_SIGNED
public static AudioFormat.Encoding PCM_SIGNED
PCM_UNSIGNED
public static AudioFormat.Encoding PCM_UNSIGNED
SampleRateConversionProvider
public SampleRateConversionProvider()
- Constructor.
getAudioInputStream
public AudioInputStream getAudioInputStream(AudioFormat targetFormat,
AudioInputStream sourceStream)
- Specified by:
getAudioInputStream
in class FormatConversionProvider
getTargetFormats
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
- Description copied from class:
TSimpleFormatConversionProvider
- 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.
- Overrides:
getTargetFormats
in class TSimpleFormatConversionProvider
isConversionSupported
public boolean isConversionSupported(AudioFormat targetFormat,
AudioFormat sourceFormat)
- Description copied from class:
TFormatConversionProvider
- WARNING: this method uses
getTargetFormats(AudioFormat.Encoding, AudioFormat)
which may create infinite loops if the latter is overwritten.
This method is overwritten here to make use of org.tritonus.share.sampled.AudioFormats.matches
and is considered temporary until AudioFormat.matches is corrected in the JavaSound API.
- Overrides:
isConversionSupported
in class TFormatConversionProvider