|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ridgesoft.io.Speaker
public abstract class Speaker
Abstract class to interface to a speaker or buzzer.
Constructor Summary | |
---|---|
protected |
Speaker()
Initializes a Speaker object. |
Method Summary | |
---|---|
void |
beep()
Beeps the speaker. |
void |
click()
Clicks the speaker. |
abstract void |
play(int frequency,
int duration)
Plays the specified tone (frequency) on the speaker. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Constructor Detail |
---|
protected Speaker()
Method Detail |
---|
public void beep()
Doesn't return until done.
public void click()
Doesn't return until done.
public abstract void play(int frequency, int duration)
The audible range for a human ear is about 20 Hz and 20 kHz. The actual range supported by the hardware implementing the speaker or buzzer may be less.
The frequencies of musical notes starting at middle C on a piano are:
The frequencies of notes double for each higher octave and are halved for each lower octave.
This method doesn't return until tone has been played.
frequency
- frequency in Hz of the tone to playduration
- duration to play the tone for in milliseconds
|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |