package josx.platform.rcx; /** * RCX sound routines. */ public class Sound { private Sound() { } /** * Play a system sound. * * * * * * * * *
aCodeResulting Sound
0short beep
1double beep
2descending arpeggio
3ascending arpeggio
4long, low beep
5quick ascending arpeggio
*/ public static void systemSound (boolean aQueued, int aCode) { ROM.call ((short) 0x299a, (short) (aQueued ? 0x4004 : 0x4003), (short) aCode); } /** * Beeps once. */ public static void beep() { systemSound (true, 0); } /** * Beeps twice. */ public static void twoBeeps() { systemSound (true, 1); } /** * Downward tones. */ public static void beepSequence() { systemSound (true, 2); } /** * Low buzz. */ public static void buzz() { systemSound (true, 4); } /** * Plays a tone, given its frequency and duration. Frequency is audible from about 31 to 2100 Hertz. The * duration argument is in hundreds of a seconds (centiseconds, not milliseconds) and is truncated * at 256, so the maximum duration of a tone is 2.56 seconds. * @param aFrequency The frequency of the tone in Hertz (Hz). * @param aDuration The duration of the tone, in centiseconds. Value is truncated at 256 centiseconds. */ public static void playTone (int aFrequency, int aDuration) { ROM.call ((short) 0x327c, (short) 0x1773, (short) aFrequency, (short) aDuration); } }