org.tritonus.sampled.convert
Class PCM2PCMConversionProvider.PCM2PCMStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjavax.sound.sampled.AudioInputStream
          extended byorg.tritonus.share.sampled.convert.TAudioInputStream
              extended byorg.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream
                  extended byorg.tritonus.sampled.convert.PCM2PCMConversionProvider.PCM2PCMStream
All Implemented Interfaces:
Closeable
Enclosing class:
PCM2PCMConversionProvider

class PCM2PCMConversionProvider.PCM2PCMStream
extends TSynchronousFilteredAudioInputStream

PCM2PCMStream Provides direct conversion of some selected formats and rxpanding of channels.


Field Summary
 
Fields inherited from class org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream
buffer
 
Fields inherited from class javax.sound.sampled.AudioInputStream
format, frameLength, framePos, frameSize, stream
 
Constructor Summary
PCM2PCMConversionProvider.PCM2PCMStream(AudioInputStream sourceStream, AudioFormat targetFormat, int sourceType, int targetType, int conversionType)
           
 
Method Summary
protected  int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount)
          Override this method to do the actual conversion.
protected  void convertInPlace(byte[] buffer, int byteOffset, int frameCount)
          Override this method to provide in-place conversion of samples.
 
Methods inherited from class org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream
available, close, enableConvertInPlace, getOriginalFormat, getOriginalStream, mark, markSupported, read, read, reset, skip
 
Methods inherited from class org.tritonus.share.sampled.convert.TAudioInputStream
properties, setProperty
 
Methods inherited from class javax.sound.sampled.AudioInputStream
getFormat, getFrameLength, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PCM2PCMConversionProvider.PCM2PCMStream

public PCM2PCMConversionProvider.PCM2PCMStream(AudioInputStream sourceStream,
                                               AudioFormat targetFormat,
                                               int sourceType,
                                               int targetType,
                                               int conversionType)
Method Detail

convert

protected int convert(byte[] inBuffer,
                      byte[] outBuffer,
                      int outByteOffset,
                      int inFrameCount)
Description copied from class: TSynchronousFilteredAudioInputStream
Override this method to do the actual conversion. inBuffer starts always at index 0 (it is an internal buffer) You should always override this. inFrameCount is the number of frames in inBuffer. These frames are of the format originalFormat.

Specified by:
convert in class TSynchronousFilteredAudioInputStream
Returns:
the resulting number of frames converted and put into outBuffer. The return value is in the format of this stream.

convertInPlace

protected void convertInPlace(byte[] buffer,
                              int byteOffset,
                              int frameCount)
Description copied from class: TSynchronousFilteredAudioInputStream
Override this method to provide in-place conversion of samples. To use it, call "enableConvertInPlace()". It will only be used when input bytes per frame >= output bytes per frame. This method must always convert frameCount frames, so no return value is necessary.

Overrides:
convertInPlace in class TSynchronousFilteredAudioInputStream