|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.gameEngine.controller.SoundController
public class SoundController
GameRelatedItem
can play sounds by adding this class as a listener.
Developers can load in a Map
to be used to reference audio
files. These files will then be played when AudioEvent
s with
corresponding map keys are fired from GameRelatedItem
s.
Supported audio file types include wav, aiff, au, mid, and rmf.
AudioListener
,
AudioEvent
,
Serialized FormConstructor Summary | |
---|---|
SoundController()
|
Method Summary | |
---|---|
void |
addAllToAudioMap(java.util.Map<java.lang.String,java.net.URL> audioMap)
Provides support for adding a Map of String s to
URL s to this SoundController . |
void |
addToAudioMap(java.lang.String key,
java.io.File value)
Puts the specified key value pair in a map of String s to
audio files. |
void |
addToAudioMap(java.lang.String key,
java.net.URL value)
Puts the specified key value pair in a map of String s to
audio files. |
void |
audioRequested(AudioEvent e)
This method retrieves and plays a sound based on the received AudioEvent . |
void |
pause()
Pauses a background sound track. |
void |
playBackgroundSound(java.net.URL audioFile)
Plays a sound located at the given File . |
void |
playClip(java.net.URL audioClipURL)
Creates an audio clip from a URL and plays it. |
void |
resume()
Resumes a paused background sound track. |
void |
setAudioMap(java.util.ResourceBundle bundle)
Convenience method used to add built in support for ResourceBundle s. |
void |
stopPlayback()
Stops play back in the playing Thread which results in the
termination of that Thread |
void |
togglePause()
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SoundController()
Method Detail |
---|
public void addAllToAudioMap(java.util.Map<java.lang.String,java.net.URL> audioMap)
Map
of String
s to
URL
s to this SoundController
.
audioMap
- Maps AudioEvent
keys to files containing sounds.public void setAudioMap(java.util.ResourceBundle bundle)
ResourceBundle
s. Resource Bundles should be formatted with
AudioEvent
keys mapped to file names of the corresponding sounds.
For ResourceBundle
use all files MUST be local.
bundle
- The properly formatted ResourceBundle
public void addToAudioMap(java.lang.String key, java.net.URL value)
String
s to
audio files.
key
- Used to refer to an audio file via events or otherwisevalue
- a URL referring to a supported audio file.public void addToAudioMap(java.lang.String key, java.io.File value)
String
s to
audio files.
key
- Used to refer to an audio file via events or otherwisevalue
- a File
referring to a supported audio file.public void audioRequested(AudioEvent e)
AudioListener
AudioEvent
.
audioRequested
in interface AudioListener
e
- The AudioEvent
fired to request that a sound be
playedpublic void playClip(java.net.URL audioClipURL)
audioClipURL
- a URL
mapping to the desired audio file.public void playBackgroundSound(java.net.URL audioFile)
File
. Supported audio
file types include wav, aiff, au, mid, and rmf. Sounds played through
this method support pausing and larger file sizes than sounds played
using the playClip(URL)
method. Background sounds may be
terminated by using the stopPlayback()
method. Only one
background sound may be played at a time. Calling this method when a
background sound is playing will result in the current audio being
terminated and replaced with the new audio.
audioFile
- The File
containing the audio file@Deprecated public void togglePause()
pause()
method and resume()
method.
public void pause()
public void resume()
public void stopPlayback()
Thread
which results in the
termination of that Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |