setting parameters as readonly

This commit is contained in:
Yotam Mann 2020-04-14 22:01:00 -04:00
parent b217fc45ac
commit 989abb9697
2 changed files with 6 additions and 3 deletions

View file

@ -51,7 +51,7 @@ export class PulseOscillator extends Source<PulseOscillatorOptions> implements T
/**
* The width of the pulse.
*/
width: Signal<"audioRange">;
readonly width: Signal<"audioRange">;
/**
* gate the width amount
@ -69,12 +69,12 @@ export class PulseOscillator extends Source<PulseOscillatorOptions> implements T
/**
* The frequency control.
*/
frequency: Signal<"frequency">;
readonly frequency: Signal<"frequency">;
/**
* The detune in cents.
*/
detune: Signal<"cents">;
readonly detune: Signal<"cents">;
/**
* Threshold the signal to turn it into a square

View file

@ -3,6 +3,7 @@ import { Param } from "../../core/context/Param";
import { Cents, Frequency, Seconds, Time } from "../../core/type/Units";
import { optionsFromArguments } from "../../core/util/Defaults";
import { OneShotSource, OneShotSourceOptions } from "../OneShotSource";
import { readOnly } from "../../core/util/Interface";
export interface ToneOscillatorNodeOptions extends OneShotSourceOptions {
frequency: Frequency;
@ -67,6 +68,8 @@ export class ToneOscillatorNode extends OneShotSource<ToneOscillatorNodeOptions>
units: "cents",
value: options.detune,
});
readOnly(this, ["frequency", "detune"]);
}
static getDefaults(): ToneOscillatorNodeOptions {