Class: Toybox::Attention::ToneProfile

Inherits:
Lang::Object show all

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.

Examples:

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:

  • 3.1.0

Supported Devices:

  • All devices except Approach S60 / vivoactive / vivoactive HR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(aFrequency, aDuration) ⇒ ToneProfile

Create a new ToneProfile.

Since:

  • 3.1.0


2526
2527
# File 'Monkeybrains.rb', line 2526

def initialize(aFrequency, aDuration)
end

Instance Attribute Details

durationObject

The duration of the vibration in milliseconds (ms).

Since:

  • 3.1.0


2522
2523
2524
# File 'Monkeybrains.rb', line 2522

def duration
  @duration
end

frequencyObject

The frequency of the tone in hertz (hz).

Since:

  • 3.1.0


2518
2519
2520
# File 'Monkeybrains.rb', line 2518

def frequency
  @frequency
end