auditory.sampled
Class BufferedSoundFactory

java.lang.Object
  extended by auditory.sampled.BufferedSoundFactory

public class BufferedSoundFactory
extends java.lang.Object

A utility class that can be used to create BufferedSound objects in various ways. Notes: One millisecond is 1/1,000 of a second One microsecond is 1/1,000,000 of a second

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Constructor Summary
BufferedSoundFactory()
          Default Constructor
BufferedSoundFactory(ResourceFinder finder)
          Explicit Value Constructor
 
Method Summary
 BufferedSound createBufferedSound(javax.sound.sampled.AudioInputStream inStream)
          Create a BufferedSound from an AudioInputStream
 BufferedSound createBufferedSound(double frequency, int length, float sampleRate, double amplitude)
          Create a BufferedSound from a sine wave with a particular frequency The length of the sound is measured in microseconds to be consistent with the Clip interface
 BufferedSound createBufferedSound(java.lang.String name)
          Create a BufferedSound from a resource/file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedSoundFactory

public BufferedSoundFactory()
Default Constructor


BufferedSoundFactory

public BufferedSoundFactory(ResourceFinder finder)
Explicit Value Constructor

Parameters:
finder - The ResourceFinder to use (if needed)
Method Detail

createBufferedSound

public BufferedSound createBufferedSound(double frequency,
                                         int length,
                                         float sampleRate,
                                         double amplitude)
Create a BufferedSound from a sine wave with a particular frequency The length of the sound is measured in microseconds to be consistent with the Clip interface

Parameters:
frequency - The frequency of the wave (in Hz)
length - The length of the sound (in microseconds)
sampleRate - The number of samples per second
amplitude - The maximum amplitude of the wave in [0.0, 32767.0]

createBufferedSound

public BufferedSound createBufferedSound(java.lang.String name)
                                  throws java.io.IOException,
                                         javax.sound.sampled.UnsupportedAudioFileException
Create a BufferedSound from a resource/file

Parameters:
name - The name of the resource
Throws:
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException

createBufferedSound

public BufferedSound createBufferedSound(javax.sound.sampled.AudioInputStream inStream)
                                  throws java.io.IOException,
                                         javax.sound.sampled.UnsupportedAudioFileException
Create a BufferedSound from an AudioInputStream

Parameters:
inStream - The stream to read from
Throws:
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers