|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.aplu.util.SoundPlayer
public class SoundPlayer
Class for playing sound files using file streaming in a separate thread. Sound format supported: WAV, ALAW, ULAW For MP3 format, use class SoundPlayerExt.
SoundPlayerExt
Constructor Summary | |
---|---|
SoundPlayer(java.io.File audioFile)
Same as SoundPlayer(audioFile, mixerIndex) using the default sound device. |
|
SoundPlayer(java.io.File audioFile,
int mixerIndex)
Construct a sound player attached to given File instance using the given mixer index (sound device). |
|
SoundPlayer(java.lang.Object resourceObj,
java.lang.String audioPathname)
Same as SoundPlayer(obj, audioPathname, mixerIndex) using the default sound device. |
|
SoundPlayer(java.lang.Object resourceObj,
java.lang.String audioPathname,
int mixerIndex)
Construct a sound player attached to given pathname from a JAR archive using the given mixer index (sound device). |
|
SoundPlayer(java.lang.String audioPathname)
Same as SoundPlayer(audioPathname, mixerIndex) using the default sound device. |
|
SoundPlayer(java.lang.String audioPathname,
int mixerIndex)
Construct a sound player attached to given pathname (relative or fully qualified) using the given mixer index (sound device). |
|
SoundPlayer(java.net.URL url)
Same as SoundPlayer(url, mixerIndex) using the default sound device. |
|
SoundPlayer(java.net.URL url,
int mixerIndex)
Construct a sound player attached to given URL using the given mixer index (sound device). |
Method Summary | |
---|---|
void |
addSoundConverter(SoundConverter soundConverter)
Registers a sound converter. |
void |
addSoundPlayerListener(SoundPlayerListener listener)
Register a SoundPlayerListener to get notifications from the SoundPlayer. |
void |
advanceFrames(long nbFrames)
Advance current position (number of frames). |
void |
advanceTime(double time)
Advance current time (in ms). |
static java.lang.String[] |
getAvailableMixers()
Return a list of the names of available mixers (sound devices). |
long |
getCurrentPos()
Return the current position (in frames from beginning). |
double |
getCurrentTime()
Return the current time (in ms from beginning). |
javax.sound.sampled.AudioFormat |
getFormat()
Return AudioFormat of player's (decoded) resource. |
float |
getFrameRate()
Return frame rate (number of frames per seconds) of player's (decoded) resource. |
int |
getFrameSize()
Return frame size (nb of bytes per sound sample) of player's (decoded) resource. |
int |
getMixerIndex()
|
int |
getVolume()
Return the current volume (range 0..1000). |
boolean |
isPlaying()
Return true, if playing (and not pausing), otherwise false. |
void |
mute(boolean isMuting)
If isMuting is true, set sound level to mimimum; otherwise reset it to the old value. |
void |
pause()
Stop playing momentarily. |
int |
play()
Start or resume playing and return immediately. |
void |
playLoop()
Start a loop playing mode, e.g. when the playing ends, it is restarted automatically until stop() is called. |
void |
replay()
Wait until a playing underway has ended. |
void |
rewindFrames(long nbFrames)
Rewind current position (number of frames). |
void |
rewindTime(double time)
Rewind current time (in ms). |
void |
setVolume(int value)
Set the volume to the give value (range 0..1000). |
void |
stop()
Stop playing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SoundPlayer(java.net.URL url, int mixerIndex)
java.lang.RuntimeException
- if sound initialization failspublic SoundPlayer(java.net.URL url)
public SoundPlayer(java.lang.Object resourceObj, java.lang.String audioPathname, int mixerIndex)
public SoundPlayer(java.lang.Object resourceObj, java.lang.String audioPathname)
public SoundPlayer(java.io.File audioFile, int mixerIndex)
java.lang.RuntimeException
- if sound initialization failspublic SoundPlayer(java.io.File audioFile)
public SoundPlayer(java.lang.String audioPathname, int mixerIndex)
java.lang.RuntimeException
- if sound initialization failspublic SoundPlayer(java.lang.String audioPathname)
Method Detail |
---|
public void addSoundPlayerListener(SoundPlayerListener listener)
public void replay()
public int play()
public void stop()
public void pause()
public boolean isPlaying()
public long getCurrentPos()
public double getCurrentTime()
public javax.sound.sampled.AudioFormat getFormat()
AudioFormat
public int getFrameSize()
public float getFrameRate()
public void advanceFrames(long nbFrames)
public void advanceTime(double time)
public void rewindFrames(long nbFrames)
public void rewindTime(double time)
public void setVolume(int value)
public void mute(boolean isMuting)
public int getVolume()
public static java.lang.String[] getAvailableMixers()
public int getMixerIndex()
public void addSoundConverter(SoundConverter soundConverter)
SoundConverter
public void playLoop()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |