public class BitDepthConverter extends AudioProcessor
BitDepthConverter.BitDepthConversionAlgorithm
enum, a public inner class
within this class. The class supports chainable and direct processing,
like all audio processors should.
To use the class on an audio stream, use something like the following:
BitDepthConverter bdc = new BitDepthConverter(
audioStream,
BitDepthConversionAlgorithm.NEAREST,
new AudioFormat( 8, 44.1, 1 ) );
The constructors take an output format which must match the audio format
of the incoming stream in all respects other than the bit-depth. If the
input and output formats differ, an IllegalArgumentException
will
be thrown. If the input and output formats are identical in every respect,
the processor does nothing.
For the NEAREST algorithm, the conversion of the bit-depth is
mainly provided through the SampleBuffer
class.
Modifier and Type | Class and Description |
---|---|
static class |
BitDepthConverter.BitDepthConversionAlgorithm
An enumerator of the different bit-depth conversion algorithms
available.
|
Constructor and Description |
---|
BitDepthConverter(AudioStream as,
BitDepthConverter.BitDepthConversionAlgorithm converter,
AudioFormat outputFormat)
Chainable constructor.
|
BitDepthConverter(BitDepthConverter.BitDepthConversionAlgorithm converter,
AudioFormat outputFormat)
Default constructor that takes the input conversion
|
Modifier and Type | Method and Description |
---|---|
SampleChunk |
process(SampleChunk sample)
Function that takes a sample chunk and processes the chunk.
|
getLength, getUnderlyingStream, nextSampleChunk, process, processingComplete, reset, setUnderlyingStream
iterator, seek
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public BitDepthConverter(BitDepthConverter.BitDepthConversionAlgorithm converter, AudioFormat outputFormat)
converter
- The converter to useoutputFormat
- The output format to convert topublic BitDepthConverter(AudioStream as, BitDepthConverter.BitDepthConversionAlgorithm converter, AudioFormat outputFormat)
as
- The audio stream to processconverter
- The converter to useoutputFormat
- The output format to convert topublic SampleChunk process(SampleChunk sample) throws Exception
process
in class AudioProcessor
sample
- The sample chunk to process.Exception
- If the processing could not take placeAudioProcessor.process(org.openimaj.audio.SampleChunk)