
public class Sound extends EV3DevSysfs
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CMD_APLAY |
static java.lang.String |
CMD_BEEP |
private static Sound |
Instance |
static java.lang.String |
SOUND_PATH |
static java.lang.String |
TONE_PATH |
static java.lang.String |
VOLUME_PATH |
| Modifier | Constructor and Description |
|---|---|
private |
Sound() |
| Modifier and Type | Method and Description |
|---|---|
void |
beep()
Beeps once.
|
static Sound |
getInstance() |
int |
getVolume()
Get the current master volume level
|
void |
pause(int t) |
int |
playSample(java.io.File file)
Play a wav file.
|
int |
playSample(java.io.File file,
int vol)
Play a wav file.
|
void |
playTone(int frequency,
int duration)
Plays a tone, given its frequency and duration.
|
void |
playTone(int frequency,
int duration,
int volume)
Plays a tone, given its frequency and duration.
|
void |
setVolume(int vol)
Set the master volume level
|
void |
twoBeeps()
Beeps twice.
|
getElements, readFloat, readInteger, readString, writeInteger, writeStringclose, releaseOnClosepublic static final java.lang.String SOUND_PATH
public static final java.lang.String TONE_PATH
public static final java.lang.String VOLUME_PATH
public static final java.lang.String CMD_BEEP
public static final java.lang.String CMD_APLAY
private static Sound Instance
public static Sound getInstance()
public void beep()
public void twoBeeps()
public void pause(int t)
public void playTone(int frequency,
int duration,
int volume)
aFrequency - The frequency of the tone in Hertz (Hz).aDuration - The duration of the tone, in milliseconds.aVolume - The volume of the playback 100 corresponds to 100%public void playTone(int frequency,
int duration)
freq - The frequency of the tone in Hertz (Hz).duration - The duration of the tone, in milliseconds.public int playSample(java.io.File file,
int vol)
file - the 8-bit or 16-bit PWM (WAV) sample filevol - the volume percentage 0 - 100java.io.FileNotFoundExceptionpublic int playSample(java.io.File file)
file - the 8-bit or 16-bit PWM (WAV) sample filejava.io.FileNotFoundExceptionpublic void setVolume(int vol)
vol - 0-100public int getVolume()