WIMM Labs


com.wimm.framework.os
Class Beeper.Sequence

java.lang.Object
  extended by com.wimm.framework.os.Beeper.Sequence
Enclosing class:
Beeper

public static final class Beeper.Sequence
extends Object

Describes a sequence of beeps and breaks (pauses). Sequences can be played using the Beeper.

Since:
WIMM SDK 1.0.3

Constructor Summary
Beeper.Sequence(boolean repeats)
          Constructor for an empty sequence.
Beeper.Sequence(int[][] pattern, boolean repeats)
          Constructor for a sequence of beeps and breaks (pauses).
 
Method Summary
 Beeper.Sequence addBeep(Beeper.Beep beep)
          Adds a Beeper.Beep at the end of the sequence.
 Beeper.Sequence addBeep(int duration, int pitch)
          Adds a Beeper.Beep at the end of the sequence using the provided duration and pitch.
 Beeper.Sequence addBreak(int duration)
          Adds a break (pause) at the end of the sequence using the provided duration.
 int duration()
          The sum of the duration of all beeps and breaks in the sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Beeper.Sequence

public Beeper.Sequence(boolean repeats)
Constructor for an empty sequence.

Parameters:
repeats - true if the sequence should start from the beginning after finishing.
Since:
WIMM SDK 1.0.3

Beeper.Sequence

public Beeper.Sequence(int[][] pattern,
                       boolean repeats)
Constructor for a sequence of beeps and breaks (pauses).

Parameters:
pattern - An array of integer pairs representing the beeps and breaks.

The first integer in each pair is the duration. If the second integer is positive, then the pair is treated as a Beeper.Beep and the second integer becomes the pitch. If the second integer is negative, then the pair is treated as a break and the second integer is ignored.

The following array describes a 500ms beep, followed by a 100ms pause, followed by a 100ms beep, followed by a 100ms pause:
{ {500, 220}, {100, -1}, {100, 220}, {100, -1} }

repeats - true if the sequence should start from the beginning after finishing.
Since:
WIMM SDK 1.0.3
Method Detail

addBeep

public Beeper.Sequence addBeep(Beeper.Beep beep)
Adds a Beeper.Beep at the end of the sequence.

Parameters:
beep - The Beeper.Beep.
Since:
WIMM SDK 1.0.3

addBeep

public Beeper.Sequence addBeep(int duration,
                               int pitch)
Adds a Beeper.Beep at the end of the sequence using the provided duration and pitch.

Parameters:
duration - The length of the beep in milliseconds. Values range from 0 to 5000.
pitch - The tone of the beep. Values range from 0 to 255. Low=0, High=255.
Since:
WIMM SDK 1.0.3

addBreak

public Beeper.Sequence addBreak(int duration)
Adds a break (pause) at the end of the sequence using the provided duration.

Parameters:
duration - The length of the break in milliseconds. Values range from 0 to 5000.
Since:
WIMM SDK 1.0.3

duration

public int duration()
The sum of the duration of all beeps and breaks in the sequence.

Returns:
The length of the sequence in milliseconds.
Since:
WIMM SDK 1.0.3

WIMM Labs