com.vwp.sound.mod.sound.output
Class JavaSoundOutput

java.lang.Object
  extended by com.vwp.sound.mod.sound.output.JavaSoundOutput
All Implemented Interfaces:
Output

public class JavaSoundOutput
extends java.lang.Object
implements Output

A output plugin that plays sound using the javax.sound.sampled api. This output plugin support 8 and 16 bits playback in mono or stereo using 11025, 22050 or 44100 samples per second


Field Summary
 
Fields inherited from interface com.vwp.sound.mod.sound.output.Output
INPUT_RATE
 
Constructor Summary
JavaSoundOutput(SoundDataFormat format, int bufferTime)
          Creates a StereoSoundOutput with a output buffer of the given size.
 
Method Summary
 boolean close()
          closes the output plugin
 SoundDataFormat getFormat()
           
 boolean isOpen()
          tests if an output plugin is open for writeing
protected  int mono16(byte[] data, int ofs, int len, double grad)
           
protected  int mono8(byte[] data, int ofs, int len, double grad)
           
 boolean open()
          opens the output plugin for writing
protected  int stereo16(byte[] data, int ofs, int len, double grad)
           
protected  int stereo8(byte[] data, int ofs, int len, double grad)
           
 boolean supports(SoundDataFormat format)
           
 int write(byte[] data, int ofs, int len)
          try to write len bytes from offset ofs from the array data.
protected  int writeConv(byte[] data, int ofs, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSoundOutput

public JavaSoundOutput(SoundDataFormat format,
                       int bufferTime)
                throws PlayerException
Creates a StereoSoundOutput with a output buffer of the given size.

Parameters:
bufferTime - the size of the output plugin in milliseconds.
Throws:
PlayerException
Method Detail

supports

public boolean supports(SoundDataFormat format)

getFormat

public SoundDataFormat getFormat()

isOpen

public boolean isOpen()
Description copied from interface: Output
tests if an output plugin is open for writeing

Specified by:
isOpen in interface Output
Returns:
true if the Output is open, false else

open

public boolean open()
Description copied from interface: Output
opens the output plugin for writing

Specified by:
open in interface Output
Returns:
true if the plugin was successfully opened, false else

close

public boolean close()
Description copied from interface: Output
closes the output plugin

Specified by:
close in interface Output
Returns:
true if the plugin was successfully closed, false else

write

public int write(byte[] data,
                 int ofs,
                 int len)
Description copied from interface: Output
try to write len bytes from offset ofs from the array data.

Specified by:
write in interface Output
Parameters:
data - the array containing data to write
ofs - the offset in data to write from
len - the number of samples to write
Returns:
the number of samples actually written

writeConv

protected int writeConv(byte[] data,
                        int ofs,
                        int len)

mono8

protected int mono8(byte[] data,
                    int ofs,
                    int len,
                    double grad)

stereo8

protected int stereo8(byte[] data,
                      int ofs,
                      int len,
                      double grad)

mono16

protected int mono16(byte[] data,
                     int ofs,
                     int len,
                     double grad)

stereo16

protected int stereo16(byte[] data,
                       int ofs,
                       int len,
                       double grad)