Class: Toybox.Attention.ToneProfile

Overview

Define a tone pattern.

Tones have two characteristics: frequency and duration. These characteristics are used to define a single ToneProfile object, which can then be passed with a collection of other ToneProfile objects in an Array to the playTone() method. The playTone() method will play through each of the ToneProfile objects within the Array in order.

Example:

Build a set of ToneProfile objects

if (Attention has :ToneProfile) {
    var toneProfile =
    [
        new Attention.ToneProfile( 2500, 250),
        new Attention.ToneProfile( 5000, 250),
        new Attention.ToneProfile(10000, 250),
        new Attention.ToneProfile( 5000, 250),
        new Attention.ToneProfile( 2500, 250),
    ];
    Attention.playTone({:toneProfile=>toneProfile});
}

Since:

API Level 3.1.0

Supported Devices:

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var duration as Lang.Number

The duration of the tone in milliseconds (ms).

Since:

API Level 3.1.0

var frequency as Lang.Number

The frequency of the tone in hertz (hz).

Since:

API Level 3.1.0

Instance Method Details

initialize(aFrequency as Lang.Number, aDuration as Lang.Number)

Constructor

Parameters:

  • aFrequency(Lang.Number)

    The frequency of the tone in hertz (hz)

  • aDuration(Lang.Number)

    The duration of the tone in milliseconds (ms)

Since:

API Level 3.1.0


Generated Mar 18, 2024 2:40:09 PM