graphics
Class AudioSample

java.lang.Object
  extended by graphics.AudioSample

 class AudioSample
extends Object

The sound effects are instanstated as an instance of this class.

Author:
Terje

Nested Class Summary
private  class AudioSample.WaitUntilFinishedLineListener
           
 
Field Summary
private  Clip clip
           
 
Constructor Summary
AudioSample(InputStream inputStream)
          loads the sound effect from a file.
 
Method Summary
private static byte[] append(byte[] data, int amount, byte[] array, int offset)
           
private static InputStream ensureMarkResetAvailable(InputStream inputStream)
           
 void play()
          initiatez playbaqck of the sound object.
private  void play(boolean loop)
           
 void play(boolean wait, boolean loop)
           
private static byte[] readEntireStream(InputStream inputStream)
           
 void stop()
          Stops playback of the sound object.
private static byte[] trim(byte[] data, int amount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clip

private final Clip clip
Constructor Detail

AudioSample

public AudioSample(InputStream inputStream)
            throws IOException
loads the sound effect from a file.

Parameters:
inputStream -
Throws:
IOException
Method Detail

ensureMarkResetAvailable

private static InputStream ensureMarkResetAvailable(InputStream inputStream)
                                             throws IOException
Throws:
IOException

readEntireStream

private static byte[] readEntireStream(InputStream inputStream)
                                throws IOException
Throws:
IOException

append

private static byte[] append(byte[] data,
                             int amount,
                             byte[] array,
                             int offset)

trim

private static byte[] trim(byte[] data,
                           int amount)

play

public void play()
initiatez playbaqck of the sound object.


play

public void play(boolean wait,
                 boolean loop)

play

private void play(boolean loop)

stop

public void stop()
Stops playback of the sound object.