Package lejos.remote.nxt
Class RemoteNXTAudio
- java.lang.Object
-
- lejos.remote.nxt.RemoteNXTAudio
-
-
Constructor Summary
Constructors Constructor Description RemoteNXTAudio(NXTCommand nxtCommand)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetVolume()Get the current master volume levelvoidloadSettings()Load the current system settings associated with this class.voidplayNote(int[] inst, int freq, int len)Play a note with attack, decay, sustain and release shape.intplaySample(byte[] data, int offset, int len, int freq, int vol)Queue a series of PCM samples to play at the specified volume and sample rate.intplaySample(java.io.File file)Play a wav fileintplaySample(java.io.File file, int vol)Play a wav filevoidplayTone(int frequency, int duration)voidplayTone(int frequency, int duration, int aVolume)Plays a tone, given its frequency and duration.voidsetVolume(int vol)Set the master volume levelvoidsystemSound(int aCode)Play a system sound.
-
-
-
Constructor Detail
-
RemoteNXTAudio
public RemoteNXTAudio(NXTCommand nxtCommand)
-
-
Method Detail
-
systemSound
public void systemSound(int aCode)
Description copied from interface:AudioPlay a system sound.aCode Resulting Sound 0 short beep 1 double beep 2 descending arpeggio 3 ascending arpeggio 4 long, low buzz - Specified by:
systemSoundin interfaceAudio
-
playTone
public void playTone(int frequency, int duration, int aVolume)Description copied from interface:AudioPlays a tone, given its frequency and duration.
-
playTone
public void playTone(int frequency, int duration)
-
playSample
public int playSample(java.io.File file, int vol)Description copied from interface:AudioPlay a wav file- Specified by:
playSamplein interfaceAudio- Parameters:
file- the 8-bit PWM (WAV) sample filevol- the volume percentage 0 - 100- Returns:
- The number of milliseconds the sample will play for or < 0 if there is an error.
-
playSample
public int playSample(java.io.File file)
Description copied from interface:AudioPlay a wav file- Specified by:
playSamplein interfaceAudio- Parameters:
file- the 8-bit PWM (WAV) sample file- Returns:
- The number of milliseconds the sample will play for or < 0 if there is an error.
-
playSample
public int playSample(byte[] data, int offset, int len, int freq, int vol)Description copied from interface:AudioQueue a series of PCM samples to play at the specified volume and sample rate.- Specified by:
playSamplein interfaceAudio- Parameters:
data- Buffer containing the samplesoffset- Offset of the first sample in the bufferlen- Number of samples to queuefreq- Sample ratevol- playback volume- Returns:
- Number of samples actually queued
-
playNote
public void playNote(int[] inst, int freq, int len)Description copied from interface:AudioPlay a note with attack, decay, sustain and release shape. This function allows the playing of a more musical sounding note. It uses a set of supplied "instrument" parameters to define the shape of the notes envelope.
-
setVolume
public void setVolume(int vol)
Description copied from interface:AudioSet the master volume level
-
getVolume
public int getVolume()
Description copied from interface:AudioGet the current master volume level
-
loadSettings
public void loadSettings()
Description copied from interface:AudioLoad the current system settings associated with this class. Called automatically to initialize the class. May be called if it is required to reload any settings.- Specified by:
loadSettingsin interfaceAudio
-
-