jass.generators
Class StreamingAudioFileBuffer

java.lang.Object
  extended by jass.generators.StreamingAudioFileBuffer

public class StreamingAudioFileBuffer
extends java.lang.Object

A buffer from an audio file or URL, streamed off the source. Assumes 16 bit audio format.

Author:
Kees van den Doel (kvdoel@cs.ubc.ca)

Field Summary
 javax.sound.sampled.AudioInputStream audioInputStream
           
 int bitsPerSample
          Bits per sample
 int bufsz
          Length of buffer as floats, should be numBytes/2.
 int bytesPerFrame
          Bytes per frame (2 for mono, 4 stereo, etc.)
 int nChannels
          Number of channels
 long nFrames
          # frames
 int numBytes
          bytes
 float srate
          Sampling rate in Hertz.
 
Constructor Summary
StreamingAudioFileBuffer(java.lang.String fn)
          Construct buffer from named file.
StreamingAudioFileBuffer(java.net.URL url)
          Construct buffer from url.
 
Method Summary
 void close()
          Close stream
protected  void loadAudio(java.lang.String fn)
          Open and read audio file properties and prepare for streaming
protected  void loadAudio(java.net.URL url)
          Open and read audio URL properties and prepare for streaming
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

srate

public float srate
Sampling rate in Hertz.


bytesPerFrame

public int bytesPerFrame
Bytes per frame (2 for mono, 4 stereo, etc.)


nFrames

public long nFrames
# frames


numBytes

public int numBytes
bytes


bitsPerSample

public int bitsPerSample
Bits per sample


nChannels

public int nChannels
Number of channels


bufsz

public int bufsz
Length of buffer as floats, should be numBytes/2.


audioInputStream

public javax.sound.sampled.AudioInputStream audioInputStream
Constructor Detail

StreamingAudioFileBuffer

public StreamingAudioFileBuffer(java.lang.String fn)
                         throws UnsupportedAudioFileFormatException
Construct buffer from named file.

Parameters:
fn - Audio file name.
Throws:
UnsupportedAudioFileFormatException

StreamingAudioFileBuffer

public StreamingAudioFileBuffer(java.net.URL url)
                         throws UnsupportedAudioFileFormatException
Construct buffer from url.

Parameters:
url - Audiofile url.
Throws:
UnsupportedAudioFileFormatException
Method Detail

close

public void close()
Close stream


loadAudio

protected void loadAudio(java.lang.String fn)
                  throws UnsupportedAudioFileFormatException
Open and read audio file properties and prepare for streaming

Parameters:
fn - Audio file name.
Throws:
UnsupportedAudioFileFormatException

loadAudio

protected void loadAudio(java.net.URL url)
                  throws UnsupportedAudioFileFormatException
Open and read audio URL properties and prepare for streaming

Parameters:
url - Audiofile url.
Throws:
UnsupportedAudioFileFormatException