com.groovemanager.sampled
Class StereoToMonoStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.groovemanager.sampled.StereoToMonoStream
All Implemented Interfaces:
java.io.Closeable

public class StereoToMonoStream
extends java.io.InputStream

This class is used for simple conversion of a stereo AudioInputStream into mono just by reading from itīs left channel. It is used for instance in AudioManager.getMonoInputStream()

Author:
Manu Robledo

Field Summary
(package private)  int sampleSize
          The sample size of the source streamīs format
private  javax.sound.sampled.AudioInputStream source
          The stereo source stream to be converted
private  byte[] temp
          Temporary Array
 
Constructor Summary
StereoToMonoStream(javax.sound.sampled.AudioInputStream source)
          Construct a new StereoToMonoInputStream
 
Method Summary
 int available()
           
 void close()
           
 void mark(int arg0)
           
 boolean markSupported()
           
 int read()
          Donīt use this method!
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sampleSize

final int sampleSize
The sample size of the source streamīs format


source

private final javax.sound.sampled.AudioInputStream source
The stereo source stream to be converted


temp

private byte[] temp
Temporary Array

Constructor Detail

StereoToMonoStream

public StereoToMonoStream(javax.sound.sampled.AudioInputStream source)
Construct a new StereoToMonoInputStream

Parameters:
source - The source stream in stereo to be converted
Throws:
java.lang.IllegalArgumentException - If the source stream is not stereo
Method Detail

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.available()

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.close()

mark

public void mark(int arg0)
Overrides:
mark in class java.io.InputStream
See Also:
InputStream.mark(int)

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream
See Also:
InputStream.markSupported()

read

public int read()
         throws java.io.IOException
Donīt use this method!

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read()

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read(byte[])

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read(byte[], int, int)

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.reset()

skip

public long skip(long s)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.skip(long)