edu.neu.ccs.util
Class SoundUtilities

java.lang.Object
  |
  +--edu.neu.ccs.util.SoundUtilities

public class SoundUtilities
extends Object

Provides static utility methods for playback of sound.

Since:
1.1

Constructor Summary
SoundUtilities()
           
 
Method Summary
static float getGain()
          Returns the gain for all lines created through this interface.
static float getPan()
          Returns the pan for all lines created through this interface.
static boolean isMuted()
          Returns whether or not sound is muted for all lines created through this interface.
static Thread playMidi(File midiFile)
          Plays the MIDI sequence stored in the given file.
static Thread playMidi(String midiFileName)
          Plays the MIDI sequence stored in a file with the given name.
static Thread playMidi(URL midiURL)
          Plays the MIDI sequence stored in the file at the given URL.
static SourceDataLine playSound(File soundFile)
           
static SourceDataLine playSound(String soundFileName)
          Plays the sound file with the given file name.
static SourceDataLine playSound(URL soundURL)
           
static void setGain(float dB)
          Sets the gain for all lines created through this interface to the given gain in dB.
static void setMuted(boolean isMuted)
          Sets whether or not sound is muted for all lines created through this interface.
static void setPan(float p)
          Sets the pan for all lines created through this interface to the given pan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoundUtilities

public SoundUtilities()
Method Detail

setGain

public static void setGain(float dB)
Sets the gain for all lines created through this interface to the given gain in dB.

Parameters:
dB - the desired gain level
See Also:
getGain()

getGain

public static float getGain()
Returns the gain for all lines created through this interface.

See Also:
setGain(float)

setMuted

public static void setMuted(boolean isMuted)
Sets whether or not sound is muted for all lines created through this interface.

Parameters:
isMuted - whether or not sound is muted

isMuted

public static boolean isMuted()
Returns whether or not sound is muted for all lines created through this interface.

See Also:
setMuted(boolean)

setPan

public static void setPan(float p)
Sets the pan for all lines created through this interface to the given pan.

Parameters:
p - the desired pan level
See Also:
getPan()

getPan

public static float getPan()
Returns the pan for all lines created through this interface.

See Also:
setPan(float)

playSound

public static SourceDataLine playSound(String soundFileName)
Plays the sound file with the given file name. If a file with the given name cannot be found, opened or read, this playback operation is cancelled. If the audio system for the host machine is unavailable, this playback operation is cancelled.

Parameters:
soundFileName - the file name for the sound to be played

playSound

public static SourceDataLine playSound(File soundFile)

playSound

public static SourceDataLine playSound(URL soundURL)

playMidi

public static Thread playMidi(String midiFileName)
Plays the MIDI sequence stored in a file with the given name. If a file with the given name cannot be found, opened, or read, this playback operation is cancelled. If the MIDI system for the host machine is unavailable, this playback operation is cancelled.

Parameters:
midiFileName - the file name for the desired sequence

playMidi

public static Thread playMidi(File midiFile)
Plays the MIDI sequence stored in the given file. If the given file cannot be found, opened, or read, this playback operation is cancelled. If the MIDI system for the host machine is unavailable, this playback operation is cancelled.

Parameters:
midiFile - the file containing the desired sequence

playMidi

public static Thread playMidi(URL midiURL)
Plays the MIDI sequence stored in the file at the given URL. If the file at the given URL cannot be found, opened, or read, this playback operation is cancelled. If the MIDI system for the host machine is unavailable, this playback operation is cancelled.