java.lang.ObjectSoundEngine
Class SoundEngine provides functionality to process sound files. Sounds can be loaded, played, paused, resumed, and stopped. The sound engine can play multiple sounds simultaniously, but only the last sound loaded can be controlled (pased, resumed, etc.). The sound engine accepts files in WAV, AIFF, and AU formats (although not all WAV files - it depends on the encoding in the file).
Constructor Summary | |
SoundEngine()
Create a SoundEngine that can play sound files. |
Method Summary | |
int |
getDuration()
Return the duration of the currently loaded sound clip. |
void |
pause()
Pause the currently playing sound. |
boolean |
play(java.io.File soundFile)
Load and play a specified sound file. |
void |
resume()
Resume the currently paused sound. |
void |
seek(int value)
Set the current playing position in the currently playing sound to 'value'. |
void |
setVolume(int vol)
Set the playback volume of the current sound. |
void |
stop()
Stop the currently playing sound (if there is one playing). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SoundEngine()
Method Detail |
public int getDuration()
public void pause()
public boolean play(java.io.File soundFile)
soundFile
- The file to be loaded.
public void resume()
public void seek(int value)
value
- The target position in the sound file, as a percentage.public void setVolume(int vol)
vol
- Volume level as a percentage (0..100).public void stop()