group1.view.audio
Class AudioCache

java.lang.Object
  extended by group1.view.audio.AudioCache

public class AudioCache
extends java.lang.Object

A class used to cache a single audio file. Stores the audio data as a byte array.


Constructor Summary
AudioCache(Audio a)
          Constructor.
 
Method Summary
 byte[] getAudioData()
          A method to directly return the byte array of audio data.
 javax.sound.sampled.AudioInputStream getAudioInputStream()
          A method to get an AudioInputStream to play the audio data.
 javax.sound.sampled.AudioFormat getFormat()
          Get the associated audio format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioCache

public AudioCache(Audio a)
           throws java.io.FileNotFoundException
Constructor. Sets up the byte array for a .wav file.

Parameters:
fileName - The enum type for the audio.
looping - If the audio clip should be looped.
Throws:
java.io.FileNotFoundException
Method Detail

getAudioData

public byte[] getAudioData()
A method to directly return the byte array of audio data. (It's better to use getAudioInputStream(), though.)

Returns:
The byte array of audio data.

getAudioInputStream

public javax.sound.sampled.AudioInputStream getAudioInputStream()
A method to get an AudioInputStream to play the audio data.

Returns:
The audio data stream.

getFormat

public javax.sound.sampled.AudioFormat getFormat()
Get the associated audio format.

Returns:
The audio format.