com.quadrique.jbuildingblocks.core.sound
Class JbbSoundHandlerAudioInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by javax.sound.sampled.AudioInputStream
          extended by com.quadrique.jbuildingblocks.core.sound.JbbSoundHandlerAudioInputStream
All Implemented Interfaces:
Closeable

public class JbbSoundHandlerAudioInputStream
extends AudioInputStream

This class is a custom AudioInputStream that programmatically generates sampled sounds The underlying implementation is based on the Java Sound APIs

Author:
Hervé Rivere

Field Summary
static int WAVEFORM_SAWTOOTH
           
static int WAVEFORM_SINE
           
static int WAVEFORM_SQUARE
           
static int WAVEFORM_TRIANGLE
           
 
Constructor Summary
JbbSoundHandlerAudioInputStream(int nWaveformType, float fSignalFrequency, float fAmplitude, AudioFormat audioFormat, long lLength)
           
 
Method Summary
 int available()
          Returns the number of bytes that can be read without blocking.
 int read()
           
 int read(byte[] abData, int nOffset, int nLength)
           
 
Methods inherited from class javax.sound.sampled.AudioInputStream
close, getFormat, getFrameLength, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAVEFORM_SINE

public static final int WAVEFORM_SINE
See Also:
Constant Field Values

WAVEFORM_SQUARE

public static final int WAVEFORM_SQUARE
See Also:
Constant Field Values

WAVEFORM_TRIANGLE

public static final int WAVEFORM_TRIANGLE
See Also:
Constant Field Values

WAVEFORM_SAWTOOTH

public static final int WAVEFORM_SAWTOOTH
See Also:
Constant Field Values
Constructor Detail

JbbSoundHandlerAudioInputStream

public JbbSoundHandlerAudioInputStream(int nWaveformType,
                                       float fSignalFrequency,
                                       float fAmplitude,
                                       AudioFormat audioFormat,
                                       long lLength)
Method Detail

available

public int available()
Returns the number of bytes that can be read without blocking. Since there is no blocking possible here, we simply try to return the number of bytes available at all. In case the length of the stream is indefinite, we return the highest number that can be represented in an integer. If the length if finite, this length is returned, clipped by the maximum that can be represented.

Overrides:
available in class AudioInputStream

read

public int read()
         throws IOException
Overrides:
read in class AudioInputStream
Throws:
IOException

read

public int read(byte[] abData,
                int nOffset,
                int nLength)
         throws IOException
Overrides:
read in class AudioInputStream
Throws:
IOException


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.