|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.fx.Sound
Sound is used to play sounds such as beeps and tones.
Playing beeps is supported under all platforms but tones are only supported where the underlying platform supports generating tones. Tones aren't supported under Java or Windows CE.
Here is an example that beeps the speaker and plays a tone:
Sound.beep(); Sound.tone(4000, 300);
Method Summary | |
static void |
beep()
Plays the device's default beep sound. |
static void |
midiTone(int midiNoteNumber,
int duration)
Plays a tone of the specified Midi Note Number for the specified duration. |
static void |
setEnabled(boolean on)
Sets the sound of the device on/off. |
static void |
tone(int freq,
int duration)
Plays a tone of the specified frequency for the specified duration. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Method Detail |
public static void beep()
public static void tone(int freq, int duration)
freq
- frequency in hertz from 32 to 32767duration
- duration in millisecondspublic static void setEnabled(boolean on)
Important: If the user had set its device sound to off, this method will not turn it on, ie, it will keep the device in silence. Otherwise, it will set the volume to its original configuration.
on
- if true enables the sound, if false disable it.public static void midiTone(int midiNoteNumber, int duration)
Note: The smaller the midi number, the greater the error in the frequency, due to the fact that the frequency calculated must be an integer.
midiNoteNumber
- number of the note according to MIDI standard
(eg. A (440hz) = 69), from 24 to 143duration
- duration in milliseconds
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |