|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgreenfoot.GreenfootSound
public class GreenfootSound
Represents audio that can be played in Greenfoot. A GreenfootSound loads the audio from a file. The sound cannot be played several times simultaneously, but can be played several times sequentially. Most files of the following formats are supported: AIFF, AU, WAV, MP3 and MIDI.
| Constructor Summary | |
|---|---|
GreenfootSound(java.lang.String filename)
Creates a new sound from the given file. |
|
| Method Summary | |
|---|---|
boolean |
isPlaying()
True if the sound is currently playing. |
void |
pause()
Pauses the current sound if it is currently playing. |
void |
play()
Start playing this sound. |
void |
playLoop()
Play this sound repeatedly in a loop. |
void |
stop()
Stop playing this sound if it is currently playing. |
java.lang.String |
toString()
Returns a string representation of this sound containing the name of the file and whether it is currently playing or not. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GreenfootSound(java.lang.String filename)
filename - Typically the name of a file in the sounds directory in
the project directory.| Method Detail |
|---|
public void play()
public void playLoop()
public void stop()
public void pause()
Make sure that this is really the method you want. If possible, you
should always use stop(), because the resources can be released
after calling stop(). The resources for the sound will not be
released while it is paused.
stop()public boolean isPlaying()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||