icommand.platform.nxt
Class Speaker

java.lang.Object
  extended by icommand.platform.nxt.Speaker

public class Speaker
extends java.lang.Object

Speaker class. Usage: Sound.playTone(500, 1000);

Version:
0.1 10-August-2006
Author:
Brian Bagnall

Method Summary
static byte playSoundFile(java.lang.String fileName)
          Plays a sound file once from the NXT.
static byte playSoundFile(java.lang.String fileName, boolean repeat)
          Plays a sound file from the NXT.
static int playTone(int frequency, int duration)
           
static int stopSoundPlayback()
          Stops a sound file that has been playing/repeating.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

playTone

public static int playTone(int frequency,
                           int duration)

playSoundFile

public static byte playSoundFile(java.lang.String fileName,
                                 boolean repeat)
Plays a sound file from the NXT. Sound files use the .rso extension. The filename is not case sensitive. Filenames on the NXT Bricks display do now show the filename extension.

Parameters:
fileName - e.g. "Woops.rso"
repeat - true = repeat, false = play once.
Returns:
If you receive a non-zero number, the filename is probably wrong or the file is not uploaded to the NXT brick.

playSoundFile

public static byte playSoundFile(java.lang.String fileName)
Plays a sound file once from the NXT. Sound files use the .rso extension. The filename is not case sensitive. Filenames on the NXT Bricks display do now show the filename extension.

Parameters:
fileName - e.g. "Woops.rso"
Returns:
If you receive a non-zero number, the filename is probably wrong or the file is not uploaded to the NXT brick.

stopSoundPlayback

public static int stopSoundPlayback()
Stops a sound file that has been playing/repeating.

Returns:
Error code.