|
||||||||
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. GreenfootSound represent one sound that can be played, stopped, looped etc. TODO: Midi (playback of a file to start with, maybe creation later) Add support for MP3, OGG etc What happens if playback is started from a static method? Should it depend on whether simulation is running? Should we allow playback if the simulation is not running? Probably not Do we need an isLooping() method? In general, should we have a lot of isXXX methods or only a few. Except for isStopped, the user could keep track of this himself. Do we need a close() to release resources (maybe not for now, can always be added later if needed)? Do we then need an open as well?
Constructor Summary | |
---|---|
GreenfootSound(java.lang.String filename)
Creates a new sound from the given file. |
Method Summary | |
---|---|
boolean |
isPaused()
True if the sound is currently paused. |
boolean |
isPlaying()
True if the sound is currently playing. |
boolean |
isStopped()
True if the sound is currently stopped. |
void |
loop()
Play this sound in a loop until it is explicitly stopped, or the current execution is stopped. |
void |
pause()
Pauses the current playback of this sound. |
void |
play()
Start playback of this sound. |
void |
stop()
Stop playback of this sound if it is currently playing. |
java.lang.String |
toString()
Returns a string representation of this sound. |
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 stop()
public void play()
public void loop()
public void pause()
public boolean isPlaying()
public boolean isPaused()
public boolean isStopped()
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 |