Home Reference Source
import MorsePlayerWAA from 'morse-pro/src/morse-pro-player-waa.js'
public class | source

MorsePlayerWAA

Direct Subclass:

MorsePlayerWAALight

Web browser sound player using Web Audio API.

Example:

import MorseCWWave from 'morse-pro-cw-wave';
import MorsePlayerWAA from 'morse-pro-player-waa';
var morseCWWave = new MorseCWWave();
morseCWWave.translate("abc");
var morsePlayerWAA = new MorsePlayerWAA();
morsePlayerWAA.loadCWWave(morseCWWave);
morsePlayerWAA.playFromStart();

Constructor Summary

Public Constructor
public

constructor(sequenceStartCallback: function(), sequenceEndingCallback: function(), soundStoppedCallback: function())

Member Summary

Public Members
public
public
public get
public
public
public
public

isNote: *[]

public get
public get
public
public
public get

Return the index of the next note in the sequence to be scheduled.

public
public
public
public
public

upNext: *

public get
public set

Set the volume for the player

Private Members
private

_cTimings: *[]

private
private
private
private
private
private
private
private
private
private

_tZero: *

private

_timer: *

private
private

Method Summary

Public Methods
public
public

load(timings: number[])

Load timing sequence, replacing any existing sequence.

public

loadCWWave(cwWave: Object)

Convenience method to help playing directly from a MorseCWWave instance.

public

loadNext(timings: number[])

Load timing sequence which will be played when the current sequence is completed (only one sequence is queued).

public

Convenience method to help playing directly from a MorseCWWave instance.

public

pause()

Pause playback (resume with play())

public

play()

Starts or resumes playback of the loaded timing sequence.

public

Plays the loaded timing sequence from the start, regardless of whether playback is ongoing or paused.

public
public
public
public

stop()

Stop playback (calling play() afterwards will start from the beginning)

Private Methods
private

Set up the audio graph @access: private

private

Schedule notes that start before now + lookAheadTime.

Public Constructors

public constructor(sequenceStartCallback: function(), sequenceEndingCallback: function(), soundStoppedCallback: function()) source

Params:

NameTypeAttributeDescription
sequenceStartCallback function()

function to call each time the sequence starts.

sequenceEndingCallback function()

function to call when the sequence is nearing the end.

soundStoppedCallback function()

function to call when the sequence stops.

Public Members

public audioContext: * source

public audioContextClass: * source

public get audioType: number: number source

Return:

number

representing this audio player type: 4

public endPadding: number source

public frequency: * source

public gainNode: * source

public isNote: *[] source

public get isPaused: boolean: * source

Return:

boolean

whether the playback is paused or not

public get isPlaying: boolean: * source

Return:

boolean

whether a sequence is being played or not (still true even when paused); becomes false when stop is used

public loop: boolean source

public lowPassNode: * source

public get nextNote: number: * source

Return the index of the next note in the sequence to be scheduled. Useful if the sequence has been paused.

Return:

number

note index

public sequenceLength: * source

public sequenceStartCallbackFired: boolean source

public splitterNode: * source

public startPadding: number source

public upNext: * source

public get volume: number: * source

Return:

number

the current volume [0,1]

public set volume(v: number) source

Set the volume for the player

Private Members

private _cTimings: *[] source

private _isPaused: boolean source

private _isPlaying: boolean source

private _lookAheadTime: number source

private _nextNote: number source

private _noAudio: boolean source

private _notPlayedANote: boolean source

private _soundEndTime: * source

private _startTimer: * source

private _stopTimer: * source

private _tZero: * source

private _timer: * source

private _timerInterval: number source

private _volume: number source

Public Methods

public hasError(): boolean source

Return:

boolean

whether there was an error in initialisation

public load(timings: number[]) source

Load timing sequence, replacing any existing sequence. If endPadding is non-zero then an appropriate pause is added to the end.

Params:

NameTypeAttributeDescription
timings number[]

list of millisecond timings; +ve numbers are beeps, -ve numbers are silence

public loadCWWave(cwWave: Object) source

Convenience method to help playing directly from a MorseCWWave instance. Uses the CWWave timings and frequency.

Params:

NameTypeAttributeDescription
cwWave Object

a MorseCWWave instance

public loadNext(timings: number[]) source

Load timing sequence which will be played when the current sequence is completed (only one sequence is queued).

Params:

NameTypeAttributeDescription
timings number[]

list of millisecond timings; +ve numbers are beeps, -ve numbers are silence

public loadNextCWWave(cwWave: Object) source

Convenience method to help playing directly from a MorseCWWave instance. Uses the CWWave timings.

Params:

NameTypeAttributeDescription
cwWave Object

a MorseCWWave instance

public pause() source

Pause playback (resume with play())

public play() source

Starts or resumes playback of the loaded timing sequence.

public playFromStart() source

Plays the loaded timing sequence from the start, regardless of whether playback is ongoing or paused.

public sequenceEndingCallback() source

public sequenceStartCallback() source

public soundStoppedCallback() source

public stop() source

Stop playback (calling play() afterwards will start from the beginning)

Private Methods

private _initialiseAudioNodes() source

Set up the audio graph @access: private

private _scheduleNotes(): boolean source

Schedule notes that start before now + lookAheadTime.

Return:

boolean

true if there is more to schedule, false if sequence is complete @access: private