public class Speaker extends Object
Robot
which it was created fromRobot.getSpeaker()
Modifier and Type | Field and Description |
---|---|
static int |
VOLUME_MAX
|
static int |
VOLUME_MIN
|
Modifier and Type | Method and Description |
---|---|
int |
getVolume()
Returns the current volume of the robots speaker
|
void |
playTone(int freq,
int duration)
Synchronously plays a tone of the specified frequency and duration through the robots speaker
(The current thread will be stalled whilst tone is playing)
|
void |
setVolume(int volume)
Sets the volume of the robots speaker
|
public static final int VOLUME_MAX
public static final int VOLUME_MIN
public int getVolume()
VOLUME_MIN
-VOLUME_MAX
.public void setVolume(int volume)
volume
- The volume the robot should play sounds at, value must be in the range VOLUME_MIN
-VOLUME_MAX
.IllegalArgumentException
- When volume
argument is outside of the range VOLUME_MIN
-VOLUME_MAX
.public void playTone(int freq, int duration)
freq
- The frequency of the tone in Hertz (Hz).duration
- The duration of the tone, in milliseconds (ms).IllegalArgumentException
- When freq
or duration
arguments are below 1.