mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 19:43:12 +00:00
Refactor options before super
This commit is contained in:
parent
aaf880c925
commit
3001db4700
104 changed files with 109 additions and 525 deletions
|
@ -62,17 +62,12 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
||||||
constructor(type?: AnalyserType, size?: number);
|
constructor(type?: AnalyserType, size?: number);
|
||||||
constructor(options?: Partial<AnalyserOptions>);
|
constructor(options?: Partial<AnalyserOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Analyser.getDefaults(), arguments, [
|
|
||||||
"type",
|
|
||||||
"size",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Analyser.getDefaults(),
|
Analyser.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["type", "size"]
|
["type", "size"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input =
|
this.input =
|
||||||
this.output =
|
this.output =
|
||||||
|
|
|
@ -32,10 +32,10 @@ export class FFT extends MeterBase<FFTOptions> {
|
||||||
constructor(size?: PowerOfTwo);
|
constructor(size?: PowerOfTwo);
|
||||||
constructor(options?: Partial<FFTOptions>);
|
constructor(options?: Partial<FFTOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(FFT.getDefaults(), arguments, ["size"]));
|
|
||||||
const options = optionsFromArguments(FFT.getDefaults(), arguments, [
|
const options = optionsFromArguments(FFT.getDefaults(), arguments, [
|
||||||
"size",
|
"size",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.normalRange = options.normalRange;
|
this.normalRange = options.normalRange;
|
||||||
this._analyser.type = "fft";
|
this._analyser.type = "fft";
|
||||||
|
|
|
@ -50,16 +50,12 @@ export class Follower extends ToneAudioNode<FollowerOptions> {
|
||||||
constructor(smoothing?: Time);
|
constructor(smoothing?: Time);
|
||||||
constructor(options?: Partial<FollowerOptions>);
|
constructor(options?: Partial<FollowerOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Follower.getDefaults(), arguments, [
|
|
||||||
"smoothing",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Follower.getDefaults(),
|
Follower.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["smoothing"]
|
["smoothing"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._abs = this.input = new Abs({ context: this.context });
|
this._abs = this.input = new Abs({ context: this.context });
|
||||||
this._lowpass = this.output = new OnePoleFilter({
|
this._lowpass = this.output = new OnePoleFilter({
|
||||||
|
|
|
@ -55,12 +55,10 @@ export class Meter extends MeterBase<MeterOptions> {
|
||||||
constructor(smoothing?: NormalRange);
|
constructor(smoothing?: NormalRange);
|
||||||
constructor(options?: Partial<MeterOptions>);
|
constructor(options?: Partial<MeterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Meter.getDefaults(), arguments, ["smoothing"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Meter.getDefaults(), arguments, [
|
const options = optionsFromArguments(Meter.getDefaults(), arguments, [
|
||||||
"smoothing",
|
"smoothing",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input =
|
this.input =
|
||||||
this.output =
|
this.output =
|
||||||
|
|
|
@ -22,14 +22,12 @@ export class Waveform extends MeterBase<WaveformOptions> {
|
||||||
constructor(size?: PowerOfTwo);
|
constructor(size?: PowerOfTwo);
|
||||||
constructor(options?: Partial<WaveformOptions>);
|
constructor(options?: Partial<WaveformOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Waveform.getDefaults(), arguments, ["size"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Waveform.getDefaults(),
|
Waveform.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["size"]
|
["size"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._analyser.type = "waveform";
|
this._analyser.type = "waveform";
|
||||||
this.size = options.size;
|
this.size = options.size;
|
||||||
|
|
|
@ -63,16 +63,11 @@ export class Channel extends ToneAudioNode<ChannelOptions> {
|
||||||
constructor(volume?: Decibels, pan?: AudioRange);
|
constructor(volume?: Decibels, pan?: AudioRange);
|
||||||
constructor(options?: Partial<ChannelOptions>);
|
constructor(options?: Partial<ChannelOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Channel.getDefaults(), arguments, [
|
|
||||||
"volume",
|
|
||||||
"pan",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Channel.getDefaults(), arguments, [
|
const options = optionsFromArguments(Channel.getDefaults(), arguments, [
|
||||||
"volume",
|
"volume",
|
||||||
"pan",
|
"pan",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._solo = this.input = new Solo({
|
this._solo = this.input = new Solo({
|
||||||
solo: options.solo,
|
solo: options.solo,
|
||||||
|
|
|
@ -100,18 +100,12 @@ export class CrossFade extends ToneAudioNode<CrossFadeOptions> {
|
||||||
constructor(fade?: NormalRange);
|
constructor(fade?: NormalRange);
|
||||||
constructor(options?: Partial<CrossFadeOptions>);
|
constructor(options?: Partial<CrossFadeOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(CrossFade.getDefaults(), arguments, [
|
|
||||||
"fade",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
CrossFade.getDefaults(),
|
CrossFade.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["fade"]
|
["fade"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.fade = new Signal({
|
this.fade = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -44,12 +44,10 @@ export class Merge extends ToneAudioNode<MergeOptions> {
|
||||||
constructor(channels?: Positive);
|
constructor(channels?: Positive);
|
||||||
constructor(options?: Partial<MergeOptions>);
|
constructor(options?: Partial<MergeOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Merge.getDefaults(), arguments, ["channels"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Merge.getDefaults(), arguments, [
|
const options = optionsFromArguments(Merge.getDefaults(), arguments, [
|
||||||
"channels",
|
"channels",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._merger =
|
this._merger =
|
||||||
this.output =
|
this.output =
|
||||||
|
|
|
@ -106,17 +106,12 @@ export class MultibandSplit extends ToneAudioNode<MultibandSplitOptions> {
|
||||||
constructor(lowFrequency?: Frequency, highFrequency?: Frequency);
|
constructor(lowFrequency?: Frequency, highFrequency?: Frequency);
|
||||||
constructor(options?: Partial<MultibandSplitOptions>);
|
constructor(options?: Partial<MultibandSplitOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(MultibandSplit.getDefaults(), arguments, [
|
|
||||||
"lowFrequency",
|
|
||||||
"highFrequency",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
MultibandSplit.getDefaults(),
|
MultibandSplit.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["lowFrequency", "highFrequency"]
|
["lowFrequency", "highFrequency"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.lowFrequency = new Signal({
|
this.lowFrequency = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -61,16 +61,11 @@ export class PanVol extends ToneAudioNode<PanVolOptions> {
|
||||||
constructor(pan?: AudioRange, volume?: Decibels);
|
constructor(pan?: AudioRange, volume?: Decibels);
|
||||||
constructor(options?: Partial<PanVolOptions>);
|
constructor(options?: Partial<PanVolOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(PanVol.getDefaults(), arguments, [
|
|
||||||
"pan",
|
|
||||||
"volume",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(PanVol.getDefaults(), arguments, [
|
const options = optionsFromArguments(PanVol.getDefaults(), arguments, [
|
||||||
"pan",
|
"pan",
|
||||||
"volume",
|
"volume",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._panner = this.input = new Panner({
|
this._panner = this.input = new Panner({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -54,14 +54,10 @@ export class Panner extends ToneAudioNode<TonePannerOptions> {
|
||||||
*/
|
*/
|
||||||
constructor(pan?: AudioRange);
|
constructor(pan?: AudioRange);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Panner.getDefaults(), arguments, ["pan"])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Panner.getDefaults(), arguments, [
|
const options = optionsFromArguments(Panner.getDefaults(), arguments, [
|
||||||
"pan",
|
"pan",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.pan = new Param({
|
this.pan = new Param({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -54,18 +54,12 @@ export class Panner3D extends ToneAudioNode<Panner3DOptions> {
|
||||||
constructor(positionX: number, positionY: number, positionZ: number);
|
constructor(positionX: number, positionY: number, positionZ: number);
|
||||||
constructor(options?: Partial<Panner3DOptions>);
|
constructor(options?: Partial<Panner3DOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Panner3D.getDefaults(), arguments, [
|
|
||||||
"positionX",
|
|
||||||
"positionY",
|
|
||||||
"positionZ",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Panner3D.getDefaults(),
|
Panner3D.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["positionX", "positionY", "positionZ"]
|
["positionX", "positionY", "positionZ"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._panner = this.input = this.output = this.context.createPanner();
|
this._panner = this.input = this.output = this.context.createPanner();
|
||||||
// set some values
|
// set some values
|
||||||
|
|
|
@ -57,8 +57,8 @@ export class Recorder extends ToneAudioNode<RecorderOptions> {
|
||||||
|
|
||||||
constructor(options?: Partial<RecorderOptions>);
|
constructor(options?: Partial<RecorderOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Recorder.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(Recorder.getDefaults(), arguments);
|
const options = optionsFromArguments(Recorder.getDefaults(), arguments);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = new Gain({
|
this.input = new Gain({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -34,10 +34,10 @@ export class Solo extends ToneAudioNode<SoloOptions> {
|
||||||
constructor(solo?: boolean);
|
constructor(solo?: boolean);
|
||||||
constructor(options?: Partial<SoloOptions>);
|
constructor(options?: Partial<SoloOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Solo.getDefaults(), arguments, ["solo"]));
|
|
||||||
const options = optionsFromArguments(Solo.getDefaults(), arguments, [
|
const options = optionsFromArguments(Solo.getDefaults(), arguments, [
|
||||||
"solo",
|
"solo",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = this.output = new Gain({
|
this.input = this.output = new Gain({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -33,12 +33,10 @@ export class Split extends ToneAudioNode<SplitOptions> {
|
||||||
constructor(channels?: number);
|
constructor(channels?: number);
|
||||||
constructor(options?: Partial<SplitOptions>);
|
constructor(options?: Partial<SplitOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Split.getDefaults(), arguments, ["channels"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Split.getDefaults(), arguments, [
|
const options = optionsFromArguments(Split.getDefaults(), arguments, [
|
||||||
"channels",
|
"channels",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._splitter =
|
this._splitter =
|
||||||
this.input =
|
this.input =
|
||||||
|
|
|
@ -54,12 +54,10 @@ export class Volume extends ToneAudioNode<VolumeOptions> {
|
||||||
constructor(volume?: Decibels);
|
constructor(volume?: Decibels);
|
||||||
constructor(options?: Partial<VolumeOptions>);
|
constructor(options?: Partial<VolumeOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Volume.getDefaults(), arguments, ["volume"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Volume.getDefaults(), arguments, [
|
const options = optionsFromArguments(Volume.getDefaults(), arguments, [
|
||||||
"volume",
|
"volume",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = this.output = new Gain({
|
this.input = this.output = new Gain({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -79,17 +79,12 @@ export class Compressor extends ToneAudioNode<CompressorOptions> {
|
||||||
constructor(threshold?: Decibels, ratio?: Positive);
|
constructor(threshold?: Decibels, ratio?: Positive);
|
||||||
constructor(options?: Partial<CompressorOptions>);
|
constructor(options?: Partial<CompressorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Compressor.getDefaults(), arguments, [
|
|
||||||
"threshold",
|
|
||||||
"ratio",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Compressor.getDefaults(),
|
Compressor.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["threshold", "ratio"]
|
["threshold", "ratio"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.threshold = new Param({
|
this.threshold = new Param({
|
||||||
minValue: this._compressor.threshold.minValue,
|
minValue: this._compressor.threshold.minValue,
|
||||||
|
|
|
@ -54,18 +54,11 @@ export class Gate extends ToneAudioNode<GateOptions> {
|
||||||
constructor(threshold?: Decibels, smoothing?: Time);
|
constructor(threshold?: Decibels, smoothing?: Time);
|
||||||
constructor(options?: Partial<GateOptions>);
|
constructor(options?: Partial<GateOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Gate.getDefaults(), arguments, [
|
|
||||||
"threshold",
|
|
||||||
"smoothing",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Gate.getDefaults(), arguments, [
|
const options = optionsFromArguments(Gate.getDefaults(), arguments, [
|
||||||
"threshold",
|
"threshold",
|
||||||
"smoothing",
|
"smoothing",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._follower = new Follower({
|
this._follower = new Follower({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -44,16 +44,10 @@ export class Limiter extends ToneAudioNode<LimiterOptions> {
|
||||||
constructor(threshold?: Decibels);
|
constructor(threshold?: Decibels);
|
||||||
constructor(options?: Partial<LimiterOptions>);
|
constructor(options?: Partial<LimiterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Limiter.getDefaults(), arguments, [
|
|
||||||
"threshold",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Limiter.getDefaults(), arguments, [
|
const options = optionsFromArguments(Limiter.getDefaults(), arguments, [
|
||||||
"threshold",
|
"threshold",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._compressor =
|
this._compressor =
|
||||||
this.input =
|
this.input =
|
||||||
|
|
|
@ -49,15 +49,11 @@ export class MidSideCompressor extends ToneAudioNode<MidSideCompressorOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<MidSideCompressorOptions>);
|
constructor(options?: RecursivePartial<MidSideCompressorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(MidSideCompressor.getDefaults(), arguments)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
MidSideCompressor.getDefaults(),
|
MidSideCompressor.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._midSideSplit = this.input = new MidSideSplit({
|
this._midSideSplit = this.input = new MidSideSplit({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -71,18 +71,11 @@ export class MultibandCompressor extends ToneAudioNode<MultibandCompressorOption
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<MultibandCompressorOptions>);
|
constructor(options?: RecursivePartial<MultibandCompressorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(
|
|
||||||
MultibandCompressor.getDefaults(),
|
|
||||||
arguments
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
MultibandCompressor.getDefaults(),
|
MultibandCompressor.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._splitter = this.input = new MultibandSplit({
|
this._splitter = this.input = new MultibandSplit({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -186,19 +186,12 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<EnvelopeOptions>);
|
constructor(options?: Partial<EnvelopeOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Envelope.getDefaults(), arguments, [
|
|
||||||
"attack",
|
|
||||||
"decay",
|
|
||||||
"sustain",
|
|
||||||
"release",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Envelope.getDefaults(),
|
Envelope.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["attack", "decay", "sustain", "release"]
|
["attack", "decay", "sustain", "release"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.attack = options.attack;
|
this.attack = options.attack;
|
||||||
this.decay = options.decay;
|
this.decay = options.decay;
|
||||||
|
|
|
@ -62,19 +62,12 @@ export class FrequencyEnvelope extends Envelope {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<FrequencyEnvelopeOptions>);
|
constructor(options?: Partial<FrequencyEnvelopeOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(FrequencyEnvelope.getDefaults(), arguments, [
|
|
||||||
"attack",
|
|
||||||
"decay",
|
|
||||||
"sustain",
|
|
||||||
"release",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
FrequencyEnvelope.getDefaults(),
|
FrequencyEnvelope.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["attack", "decay", "sustain", "release"]
|
["attack", "decay", "sustain", "release"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._octaves = options.octaves;
|
this._octaves = options.octaves;
|
||||||
this._baseFrequency = this.toFrequency(options.baseFrequency);
|
this._baseFrequency = this.toFrequency(options.baseFrequency);
|
||||||
|
|
|
@ -61,17 +61,12 @@ export class BiquadFilter extends ToneAudioNode<BiquadFilterOptions> {
|
||||||
constructor(frequency?: Frequency, type?: BiquadFilterType);
|
constructor(frequency?: Frequency, type?: BiquadFilterType);
|
||||||
constructor(options?: Partial<BiquadFilterOptions>);
|
constructor(options?: Partial<BiquadFilterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(BiquadFilter.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
BiquadFilter.getDefaults(),
|
BiquadFilter.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "type"]
|
["frequency", "type"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._filter = this.context.createBiquadFilter();
|
this._filter = this.context.createBiquadFilter();
|
||||||
this.input = this.output = this._filter;
|
this.input = this.output = this._filter;
|
||||||
|
|
|
@ -50,17 +50,12 @@ export class Convolver extends ToneAudioNode<ConvolverOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<ConvolverOptions>);
|
constructor(options?: Partial<ConvolverOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Convolver.getDefaults(), arguments, [
|
|
||||||
"url",
|
|
||||||
"onload",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Convolver.getDefaults(),
|
Convolver.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["url", "onload"]
|
["url", "onload"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._buffer = new ToneAudioBuffer(options.url, (buffer) => {
|
this._buffer = new ToneAudioBuffer(options.url, (buffer) => {
|
||||||
this.buffer = buffer;
|
this.buffer = buffer;
|
||||||
|
|
|
@ -90,18 +90,12 @@ export class EQ3 extends ToneAudioNode<EQ3Options> {
|
||||||
constructor(lowLevel?: Decibels, midLevel?: Decibels, highLevel?: Decibels);
|
constructor(lowLevel?: Decibels, midLevel?: Decibels, highLevel?: Decibels);
|
||||||
constructor(options: Partial<EQ3Options>);
|
constructor(options: Partial<EQ3Options>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(EQ3.getDefaults(), arguments, [
|
|
||||||
"low",
|
|
||||||
"mid",
|
|
||||||
"high",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(EQ3.getDefaults(), arguments, [
|
const options = optionsFromArguments(EQ3.getDefaults(), arguments, [
|
||||||
"low",
|
"low",
|
||||||
"mid",
|
"mid",
|
||||||
"high",
|
"high",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = this._multibandSplit = new MultibandSplit({
|
this.input = this._multibandSplit = new MultibandSplit({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -48,17 +48,12 @@ export class FeedbackCombFilter extends ToneAudioWorklet<FeedbackCombFilterOptio
|
||||||
constructor(delayTime?: Time, resonance?: NormalRange);
|
constructor(delayTime?: Time, resonance?: NormalRange);
|
||||||
constructor(options?: RecursivePartial<FeedbackCombFilterOptions>);
|
constructor(options?: RecursivePartial<FeedbackCombFilterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(FeedbackCombFilter.getDefaults(), arguments, [
|
|
||||||
"delayTime",
|
|
||||||
"resonance",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
FeedbackCombFilter.getDefaults(),
|
FeedbackCombFilter.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["delayTime", "resonance"]
|
["delayTime", "resonance"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = new Gain({ context: this.context });
|
this.input = new Gain({ context: this.context });
|
||||||
this.output = new Gain({ context: this.context });
|
this.output = new Gain({ context: this.context });
|
||||||
|
|
|
@ -73,18 +73,12 @@ export class Filter extends ToneAudioNode<FilterOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<FilterOptions>);
|
constructor(options?: Partial<FilterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Filter.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
"rolloff",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Filter.getDefaults(), arguments, [
|
const options = optionsFromArguments(Filter.getDefaults(), arguments, [
|
||||||
"frequency",
|
"frequency",
|
||||||
"type",
|
"type",
|
||||||
"rolloff",
|
"rolloff",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._filters = [];
|
this._filters = [];
|
||||||
|
|
||||||
|
|
|
@ -60,18 +60,12 @@ export class LowpassCombFilter extends ToneAudioNode<LowpassCombFilterOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: RecursivePartial<LowpassCombFilterOptions>);
|
constructor(options?: RecursivePartial<LowpassCombFilterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(LowpassCombFilter.getDefaults(), arguments, [
|
|
||||||
"delayTime",
|
|
||||||
"resonance",
|
|
||||||
"dampening",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
LowpassCombFilter.getDefaults(),
|
LowpassCombFilter.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["delayTime", "resonance", "dampening"]
|
["delayTime", "resonance", "dampening"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._combFilter = this.output = new FeedbackCombFilter({
|
this._combFilter = this.output = new FeedbackCombFilter({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -51,17 +51,12 @@ export class OnePoleFilter extends ToneAudioNode<OnePoleFilterOptions> {
|
||||||
constructor(frequency?: Frequency, type?: OnePoleFilterType);
|
constructor(frequency?: Frequency, type?: OnePoleFilterType);
|
||||||
constructor(options?: Partial<OnePoleFilterOptions>);
|
constructor(options?: Partial<OnePoleFilterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(OnePoleFilter.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
OnePoleFilter.getDefaults(),
|
OnePoleFilter.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "type"]
|
["frequency", "type"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._frequency = options.frequency;
|
this._frequency = options.frequency;
|
||||||
this._type = options.type;
|
this._type = options.type;
|
||||||
|
|
|
@ -80,16 +80,11 @@ export class Clock<TypeName extends "bpm" | "hertz" = "hertz">
|
||||||
constructor(callback?: ClockCallback, frequency?: Frequency);
|
constructor(callback?: ClockCallback, frequency?: Frequency);
|
||||||
constructor(options: Partial<ClockOptions>);
|
constructor(options: Partial<ClockOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Clock.getDefaults(), arguments, [
|
|
||||||
"callback",
|
|
||||||
"frequency",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Clock.getDefaults(), arguments, [
|
const options = optionsFromArguments(Clock.getDefaults(), arguments, [
|
||||||
"callback",
|
"callback",
|
||||||
"frequency",
|
"frequency",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.callback = options.callback;
|
this.callback = options.callback;
|
||||||
this._tickSource = new TickSource({
|
this._tickSource = new TickSource({
|
||||||
|
|
|
@ -44,14 +44,12 @@ export class TickParam<
|
||||||
constructor(value?: number);
|
constructor(value?: number);
|
||||||
constructor(options: Partial<TickParamOptions<TypeName>>);
|
constructor(options: Partial<TickParamOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(TickParam.getDefaults(), arguments, ["value"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
TickParam.getDefaults(),
|
TickParam.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["value"]
|
["value"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
// set the multiplier
|
// set the multiplier
|
||||||
this._multiplier = options.multiplier;
|
this._multiplier = options.multiplier;
|
||||||
|
|
|
@ -36,14 +36,12 @@ export class TickSignal<
|
||||||
constructor(value?: UnitMap[TypeName]);
|
constructor(value?: UnitMap[TypeName]);
|
||||||
constructor(options: Partial<TickSignalOptions<TypeName>>);
|
constructor(options: Partial<TickSignalOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(TickSignal.getDefaults(), arguments, ["value"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
TickSignal.getDefaults(),
|
TickSignal.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["value"]
|
["value"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = this._param = new TickParam({
|
this.input = this._param = new TickParam({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -79,16 +79,12 @@ export class TickSource<
|
||||||
constructor(frequency?: number);
|
constructor(frequency?: number);
|
||||||
constructor(options?: Partial<TickSourceOptions>);
|
constructor(options?: Partial<TickSourceOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(TickSource.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
TickSource.getDefaults(),
|
TickSource.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency"]
|
["frequency"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.frequency = new TickSignal({
|
this.frequency = new TickSignal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -188,11 +188,11 @@ export class TransportClass
|
||||||
|
|
||||||
constructor(options?: Partial<TransportOptions>);
|
constructor(options?: Partial<TransportOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(TransportClass.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
TransportClass.getDefaults(),
|
TransportClass.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
// CLOCK/TEMPO
|
// CLOCK/TEMPO
|
||||||
this._ppq = options.ppq;
|
this._ppq = options.ppq;
|
||||||
|
|
|
@ -54,17 +54,11 @@ export class Delay extends ToneAudioNode<DelayOptions> {
|
||||||
constructor(delayTime?: Time, maxDelay?: Time);
|
constructor(delayTime?: Time, maxDelay?: Time);
|
||||||
constructor(options?: Partial<DelayOptions>);
|
constructor(options?: Partial<DelayOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Delay.getDefaults(), arguments, [
|
|
||||||
"delayTime",
|
|
||||||
"maxDelay",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
const options = optionsFromArguments(Delay.getDefaults(), arguments, [
|
const options = optionsFromArguments(Delay.getDefaults(), arguments, [
|
||||||
"delayTime",
|
"delayTime",
|
||||||
"maxDelay",
|
"maxDelay",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
const maxDelayInSeconds = this.toSeconds(options.maxDelay);
|
const maxDelayInSeconds = this.toSeconds(options.maxDelay);
|
||||||
this._maxDelay = Math.max(
|
this._maxDelay = Math.max(
|
||||||
|
|
|
@ -48,11 +48,11 @@ export class DestinationClass extends ToneAudioNode<DestinationOptions> {
|
||||||
|
|
||||||
constructor(options: Partial<DestinationOptions>);
|
constructor(options: Partial<DestinationOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(DestinationClass.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
DestinationClass.getDefaults(),
|
DestinationClass.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
connectSeries(
|
connectSeries(
|
||||||
this.input,
|
this.input,
|
||||||
|
|
|
@ -56,16 +56,11 @@ export class Gain<
|
||||||
constructor(gain?: UnitMap[TypeName], units?: TypeName);
|
constructor(gain?: UnitMap[TypeName], units?: TypeName);
|
||||||
constructor(options?: Partial<GainOptions<TypeName>>);
|
constructor(options?: Partial<GainOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Gain.getDefaults(), arguments, [
|
|
||||||
"gain",
|
|
||||||
"units",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Gain.getDefaults(), arguments, [
|
const options = optionsFromArguments(Gain.getDefaults(), arguments, [
|
||||||
"gain",
|
"gain",
|
||||||
"units",
|
"units",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.gain = new Param({
|
this.gain = new Param({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -113,19 +113,12 @@ export class Param<TypeName extends UnitName = "number">
|
||||||
constructor(param: AudioParam, units?: TypeName, convert?: boolean);
|
constructor(param: AudioParam, units?: TypeName, convert?: boolean);
|
||||||
constructor(options: Partial<ParamOptions<TypeName>>);
|
constructor(options: Partial<ParamOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Param.getDefaults(), arguments, [
|
|
||||||
"param",
|
|
||||||
"units",
|
|
||||||
"convert",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
const options = optionsFromArguments(Param.getDefaults(), arguments, [
|
const options = optionsFromArguments(Param.getDefaults(), arguments, [
|
||||||
"param",
|
"param",
|
||||||
"units",
|
"units",
|
||||||
"convert",
|
"convert",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
isDefined(options.param) &&
|
isDefined(options.param) &&
|
||||||
|
|
|
@ -50,18 +50,12 @@ export class AutoFilter extends LFOEffect<AutoFilterOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<AutoFilterOptions>);
|
constructor(options?: Partial<AutoFilterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(AutoFilter.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"baseFrequency",
|
|
||||||
"octaves",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
AutoFilter.getDefaults(),
|
AutoFilter.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "baseFrequency", "octaves"]
|
["frequency", "baseFrequency", "octaves"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.filter = new Filter(
|
this.filter = new Filter(
|
||||||
Object.assign(options.filter, {
|
Object.assign(options.filter, {
|
||||||
|
|
|
@ -32,16 +32,12 @@ export class AutoPanner extends LFOEffect<AutoPannerOptions> {
|
||||||
constructor(frequency?: Frequency);
|
constructor(frequency?: Frequency);
|
||||||
constructor(options?: Partial<AutoPannerOptions>);
|
constructor(options?: Partial<AutoPannerOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(AutoPanner.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
AutoPanner.getDefaults(),
|
AutoPanner.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency"]
|
["frequency"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._panner = new Panner({
|
this._panner = new Panner({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -101,18 +101,12 @@ export class AutoWah extends Effect<AutoWahOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<AutoWahOptions>);
|
constructor(options?: Partial<AutoWahOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(AutoWah.getDefaults(), arguments, [
|
|
||||||
"baseFrequency",
|
|
||||||
"octaves",
|
|
||||||
"sensitivity",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(AutoWah.getDefaults(), arguments, [
|
const options = optionsFromArguments(AutoWah.getDefaults(), arguments, [
|
||||||
"baseFrequency",
|
"baseFrequency",
|
||||||
"octaves",
|
"octaves",
|
||||||
"sensitivity",
|
"sensitivity",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._follower = new Follower({
|
this._follower = new Follower({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -44,14 +44,12 @@ export class BitCrusher extends Effect<BitCrusherOptions> {
|
||||||
constructor(bits?: Positive);
|
constructor(bits?: Positive);
|
||||||
constructor(options?: Partial<BitCrusherWorkletOptions>);
|
constructor(options?: Partial<BitCrusherWorkletOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(BitCrusher.getDefaults(), arguments, ["bits"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
BitCrusher.getDefaults(),
|
BitCrusher.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["bits"]
|
["bits"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._bitCrusherWorklet = new BitCrusherWorklet({
|
this._bitCrusherWorklet = new BitCrusherWorklet({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
@ -93,11 +91,11 @@ class BitCrusherWorklet extends ToneAudioWorklet<BitCrusherWorkletOptions> {
|
||||||
|
|
||||||
constructor(options?: Partial<BitCrusherWorkletOptions>);
|
constructor(options?: Partial<BitCrusherWorkletOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(BitCrusherWorklet.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
BitCrusherWorklet.getDefaults(),
|
BitCrusherWorklet.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = new Gain({ context: this.context });
|
this.input = new Gain({ context: this.context });
|
||||||
this.output = new Gain({ context: this.context });
|
this.output = new Gain({ context: this.context });
|
||||||
|
|
|
@ -42,14 +42,12 @@ export class Chebyshev extends Effect<ChebyshevOptions> {
|
||||||
constructor(order?: Positive);
|
constructor(order?: Positive);
|
||||||
constructor(options?: Partial<ChebyshevOptions>);
|
constructor(options?: Partial<ChebyshevOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Chebyshev.getDefaults(), arguments, ["order"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Chebyshev.getDefaults(),
|
Chebyshev.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["order"]
|
["order"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._shaper = new WaveShaper({
|
this._shaper = new WaveShaper({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -88,18 +88,12 @@ export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<ChorusOptions>);
|
constructor(options?: Partial<ChorusOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Chorus.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"delayTime",
|
|
||||||
"depth",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Chorus.getDefaults(), arguments, [
|
const options = optionsFromArguments(Chorus.getDefaults(), arguments, [
|
||||||
"frequency",
|
"frequency",
|
||||||
"delayTime",
|
"delayTime",
|
||||||
"depth",
|
"depth",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._depth = options.depth;
|
this._depth = options.depth;
|
||||||
this._delayTime = options.delayTime / 1000;
|
this._delayTime = options.delayTime / 1000;
|
||||||
|
|
|
@ -36,16 +36,12 @@ export class Distortion extends Effect<DistortionOptions> {
|
||||||
constructor(distortion?: number);
|
constructor(distortion?: number);
|
||||||
constructor(options?: Partial<DistortionOptions>);
|
constructor(options?: Partial<DistortionOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Distortion.getDefaults(), arguments, [
|
|
||||||
"distortion",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Distortion.getDefaults(),
|
Distortion.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["distortion"]
|
["distortion"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._shaper = new WaveShaper({
|
this._shaper = new WaveShaper({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -40,17 +40,12 @@ export class FeedbackDelay extends FeedbackEffect<FeedbackDelayOptions> {
|
||||||
constructor(delayTime?: Time, feedback?: NormalRange);
|
constructor(delayTime?: Time, feedback?: NormalRange);
|
||||||
constructor(options?: Partial<FeedbackDelayOptions>);
|
constructor(options?: Partial<FeedbackDelayOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(FeedbackDelay.getDefaults(), arguments, [
|
|
||||||
"delayTime",
|
|
||||||
"feedback",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
FeedbackDelay.getDefaults(),
|
FeedbackDelay.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["delayTime", "feedback"]
|
["delayTime", "feedback"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._delayNode = new Delay({
|
this._delayNode = new Delay({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -71,17 +71,12 @@ export class Freeverb extends StereoEffect<FreeverbOptions> {
|
||||||
constructor(roomSize?: NormalRange, dampening?: Frequency);
|
constructor(roomSize?: NormalRange, dampening?: Frequency);
|
||||||
constructor(options?: Partial<FreeverbOptions>);
|
constructor(options?: Partial<FreeverbOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Freeverb.getDefaults(), arguments, [
|
|
||||||
"roomSize",
|
|
||||||
"dampening",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Freeverb.getDefaults(),
|
Freeverb.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["roomSize", "dampening"]
|
["roomSize", "dampening"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.roomSize = new Signal({
|
this.roomSize = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -81,16 +81,12 @@ export class FrequencyShifter extends Effect<FrequencyShifterOptions> {
|
||||||
constructor(frequency?: Frequency);
|
constructor(frequency?: Frequency);
|
||||||
constructor(options?: Partial<FrequencyShifterOptions>);
|
constructor(options?: Partial<FrequencyShifterOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(FrequencyShifter.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
FrequencyShifter.getDefaults(),
|
FrequencyShifter.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency"]
|
["frequency"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.frequency = new Signal({
|
this.frequency = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -73,16 +73,12 @@ export class JCReverb extends StereoEffect<JCReverbOptions> {
|
||||||
constructor(roomSize?: NormalRange);
|
constructor(roomSize?: NormalRange);
|
||||||
constructor(options?: Partial<JCReverbOptions>);
|
constructor(options?: Partial<JCReverbOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(JCReverb.getDefaults(), arguments, [
|
|
||||||
"roomSize",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
JCReverb.getDefaults(),
|
JCReverb.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["roomSize"]
|
["roomSize"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.roomSize = new Signal({
|
this.roomSize = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -83,18 +83,12 @@ export class Phaser extends StereoEffect<PhaserOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<PhaserOptions>);
|
constructor(options?: Partial<PhaserOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Phaser.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"octaves",
|
|
||||||
"baseFrequency",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Phaser.getDefaults(), arguments, [
|
const options = optionsFromArguments(Phaser.getDefaults(), arguments, [
|
||||||
"frequency",
|
"frequency",
|
||||||
"octaves",
|
"octaves",
|
||||||
"baseFrequency",
|
"baseFrequency",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._lfoL = new LFO({
|
this._lfoL = new LFO({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -57,17 +57,12 @@ export class PingPongDelay extends StereoXFeedbackEffect<PingPongDelayOptions> {
|
||||||
constructor(delayTime?: Time, feedback?: NormalRange);
|
constructor(delayTime?: Time, feedback?: NormalRange);
|
||||||
constructor(options?: Partial<PingPongDelayOptions>);
|
constructor(options?: Partial<PingPongDelayOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(PingPongDelay.getDefaults(), arguments, [
|
|
||||||
"delayTime",
|
|
||||||
"feedback",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
PingPongDelay.getDefaults(),
|
PingPongDelay.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["delayTime", "feedback"]
|
["delayTime", "feedback"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._leftDelay = new Delay({
|
this._leftDelay = new Delay({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -88,14 +88,12 @@ export class PitchShift extends FeedbackEffect<PitchShiftOptions> {
|
||||||
constructor(pitch?: Interval);
|
constructor(pitch?: Interval);
|
||||||
constructor(options?: Partial<PitchShiftOptions>);
|
constructor(options?: Partial<PitchShiftOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(PitchShift.getDefaults(), arguments, ["pitch"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
PitchShift.getDefaults(),
|
PitchShift.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["pitch"]
|
["pitch"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._frequency = new Signal({ context: this.context });
|
this._frequency = new Signal({ context: this.context });
|
||||||
this._delayA = new Delay({
|
this._delayA = new Delay({
|
||||||
|
|
|
@ -56,10 +56,10 @@ export class Reverb extends Effect<ReverbOptions> {
|
||||||
constructor(decay?: Seconds);
|
constructor(decay?: Seconds);
|
||||||
constructor(options?: Partial<ReverbOptions>);
|
constructor(options?: Partial<ReverbOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Reverb.getDefaults(), arguments, ["decay"]));
|
|
||||||
const options = optionsFromArguments(Reverb.getDefaults(), arguments, [
|
const options = optionsFromArguments(Reverb.getDefaults(), arguments, [
|
||||||
"decay",
|
"decay",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._decay = options.decay;
|
this._decay = options.decay;
|
||||||
this._preDelay = options.preDelay;
|
this._preDelay = options.preDelay;
|
||||||
|
|
|
@ -63,16 +63,13 @@ export class StereoWidener extends MidSideEffect<StereoWidenerOptions> {
|
||||||
constructor(width?: NormalRange);
|
constructor(width?: NormalRange);
|
||||||
constructor(options?: Partial<StereoWidenerOptions>);
|
constructor(options?: Partial<StereoWidenerOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(StereoWidener.getDefaults(), arguments, [
|
|
||||||
"width",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
StereoWidener.getDefaults(),
|
StereoWidener.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["width"]
|
["width"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.width = new Signal({
|
this.width = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
value: options.width,
|
value: options.width,
|
||||||
|
|
|
@ -68,16 +68,11 @@ export class Tremolo extends StereoEffect<TremoloOptions> {
|
||||||
constructor(frequency?: Frequency, depth?: NormalRange);
|
constructor(frequency?: Frequency, depth?: NormalRange);
|
||||||
constructor(options?: Partial<TremoloOptions>);
|
constructor(options?: Partial<TremoloOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Tremolo.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"depth",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Tremolo.getDefaults(), arguments, [
|
const options = optionsFromArguments(Tremolo.getDefaults(), arguments, [
|
||||||
"frequency",
|
"frequency",
|
||||||
"depth",
|
"depth",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._lfoL = new LFO({
|
this._lfoL = new LFO({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -48,16 +48,11 @@ export class Vibrato extends Effect<VibratoOptions> {
|
||||||
constructor(frequency?: Frequency, depth?: NormalRange);
|
constructor(frequency?: Frequency, depth?: NormalRange);
|
||||||
constructor(options?: Partial<VibratoOptions>);
|
constructor(options?: Partial<VibratoOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Vibrato.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"depth",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Vibrato.getDefaults(), arguments, [
|
const options = optionsFromArguments(Vibrato.getDefaults(), arguments, [
|
||||||
"frequency",
|
"frequency",
|
||||||
"depth",
|
"depth",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._delayNode = new Delay({
|
this._delayNode = new Delay({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -59,16 +59,11 @@ export class Loop<
|
||||||
constructor(callback?: (time: Seconds) => void, interval?: Time);
|
constructor(callback?: (time: Seconds) => void, interval?: Time);
|
||||||
constructor(options?: Partial<LoopOptions>);
|
constructor(options?: Partial<LoopOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Loop.getDefaults(), arguments, [
|
|
||||||
"callback",
|
|
||||||
"interval",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Loop.getDefaults(), arguments, [
|
const options = optionsFromArguments(Loop.getDefaults(), arguments, [
|
||||||
"callback",
|
"callback",
|
||||||
"interval",
|
"interval",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._event = new ToneEvent({
|
this._event = new ToneEvent({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -83,16 +83,11 @@ export class Part<ValueType = any> extends ToneEvent<ValueType> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<PartOptions<ValueType>>);
|
constructor(options?: Partial<PartOptions<ValueType>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Part.getDefaults(), arguments, [
|
|
||||||
"callback",
|
|
||||||
"events",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Part.getDefaults(), arguments, [
|
const options = optionsFromArguments(Part.getDefaults(), arguments, [
|
||||||
"callback",
|
"callback",
|
||||||
"events",
|
"events",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
// make sure things are assigned in the right order
|
// make sure things are assigned in the right order
|
||||||
this._state.increasing = true;
|
this._state.increasing = true;
|
||||||
|
|
|
@ -65,18 +65,12 @@ export class Pattern<ValueType> extends Loop<PatternOptions<ValueType>> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<PatternOptions<ValueType>>);
|
constructor(options?: Partial<PatternOptions<ValueType>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Pattern.getDefaults(), arguments, [
|
|
||||||
"callback",
|
|
||||||
"values",
|
|
||||||
"pattern",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Pattern.getDefaults(), arguments, [
|
const options = optionsFromArguments(Pattern.getDefaults(), arguments, [
|
||||||
"callback",
|
"callback",
|
||||||
"values",
|
"values",
|
||||||
"pattern",
|
"pattern",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.callback = options.callback;
|
this.callback = options.callback;
|
||||||
this._values = options.values;
|
this._values = options.values;
|
||||||
|
|
|
@ -75,18 +75,12 @@ export class Sequence<ValueType = any> extends ToneEvent<ValueType> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<SequenceOptions<ValueType>>);
|
constructor(options?: Partial<SequenceOptions<ValueType>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Sequence.getDefaults(), arguments, [
|
|
||||||
"callback",
|
|
||||||
"events",
|
|
||||||
"subdivision",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Sequence.getDefaults(),
|
Sequence.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["callback", "events", "subdivision"]
|
["callback", "events", "subdivision"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._subdivision = this.toTicks(options.subdivision);
|
this._subdivision = this.toTicks(options.subdivision);
|
||||||
|
|
||||||
|
|
|
@ -124,17 +124,12 @@ export class ToneEvent<ValueType = any> extends ToneWithContext<
|
||||||
constructor(callback?: ToneEventCallback<ValueType>, value?: ValueType);
|
constructor(callback?: ToneEventCallback<ValueType>, value?: ValueType);
|
||||||
constructor(options?: Partial<ToneEventOptions<ValueType>>);
|
constructor(options?: Partial<ToneEventOptions<ValueType>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(ToneEvent.getDefaults(), arguments, [
|
|
||||||
"callback",
|
|
||||||
"value",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
ToneEvent.getDefaults(),
|
ToneEvent.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["callback", "value"]
|
["callback", "value"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._loop = options.loop;
|
this._loop = options.loop;
|
||||||
this.callback = options.callback;
|
this.callback = options.callback;
|
||||||
|
|
|
@ -84,8 +84,8 @@ export class DuoSynth extends Monophonic<DuoSynthOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<DuoSynthOptions>);
|
constructor(options?: RecursivePartial<DuoSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(DuoSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(DuoSynth.getDefaults(), arguments);
|
const options = optionsFromArguments(DuoSynth.getDefaults(), arguments);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.voice0 = new MonoSynth(
|
this.voice0 = new MonoSynth(
|
||||||
Object.assign(options.voice0, {
|
Object.assign(options.voice0, {
|
||||||
|
|
|
@ -33,8 +33,8 @@ export class FMSynth extends ModulationSynth<FMSynthOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<FMSynthOptions>);
|
constructor(options?: RecursivePartial<FMSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(FMSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(FMSynth.getDefaults(), arguments);
|
const options = optionsFromArguments(FMSynth.getDefaults(), arguments);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.modulationIndex = new Multiply({
|
this.modulationIndex = new Multiply({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -52,11 +52,11 @@ export abstract class Instrument<
|
||||||
|
|
||||||
constructor(options?: Partial<InstrumentOptions>);
|
constructor(options?: Partial<InstrumentOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Instrument.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Instrument.getDefaults(),
|
Instrument.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._volume = this.output = new Volume({
|
this._volume = this.output = new Volume({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -53,11 +53,11 @@ export class MembraneSynth extends Synth<MembraneSynthOptions> {
|
||||||
*/
|
*/
|
||||||
constructor(options?: RecursivePartial<MembraneSynthOptions>);
|
constructor(options?: RecursivePartial<MembraneSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(MembraneSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
MembraneSynth.getDefaults(),
|
MembraneSynth.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.pitchDecay = options.pitchDecay;
|
this.pitchDecay = options.pitchDecay;
|
||||||
this.octaves = options.octaves;
|
this.octaves = options.octaves;
|
||||||
|
|
|
@ -97,11 +97,11 @@ export class MetalSynth extends Monophonic<MetalSynthOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<MetalSynthOptions>);
|
constructor(options?: RecursivePartial<MetalSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(MetalSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
MetalSynth.getDefaults(),
|
MetalSynth.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.detune = new Signal({
|
this.detune = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -88,11 +88,11 @@ export abstract class ModulationSynth<
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<ModulationSynthOptions>);
|
constructor(options?: RecursivePartial<ModulationSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(ModulationSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
ModulationSynth.getDefaults(),
|
ModulationSynth.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._carrier = new Synth({
|
this._carrier = new Synth({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -77,11 +77,11 @@ export class MonoSynth extends Monophonic<MonoSynthOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<MonoSynthOptions>);
|
constructor(options?: RecursivePartial<MonoSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(MonoSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
MonoSynth.getDefaults(),
|
MonoSynth.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.oscillator = new OmniOscillator(
|
this.oscillator = new OmniOscillator(
|
||||||
Object.assign(options.oscillator, {
|
Object.assign(options.oscillator, {
|
||||||
|
|
|
@ -49,11 +49,11 @@ export abstract class Monophonic<
|
||||||
|
|
||||||
constructor(options?: Partial<MonophonicOptions>);
|
constructor(options?: Partial<MonophonicOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Monophonic.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Monophonic.getDefaults(),
|
Monophonic.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.portamento = options.portamento;
|
this.portamento = options.portamento;
|
||||||
this.onsilence = options.onsilence;
|
this.onsilence = options.onsilence;
|
||||||
|
|
|
@ -43,11 +43,12 @@ export class NoiseSynth extends Instrument<NoiseSynthOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<NoiseSynthOptions>);
|
constructor(options?: RecursivePartial<NoiseSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(NoiseSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
NoiseSynth.getDefaults(),
|
NoiseSynth.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.noise = new Noise(
|
this.noise = new Noise(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,11 +52,11 @@ export class PluckSynth extends Instrument<PluckSynthOptions> {
|
||||||
|
|
||||||
constructor(options?: RecursivePartial<PluckSynthOptions>);
|
constructor(options?: RecursivePartial<PluckSynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(PluckSynth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
PluckSynth.getDefaults(),
|
PluckSynth.getDefaults(),
|
||||||
arguments
|
arguments
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._noise = new Noise({
|
this._noise = new Noise({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -137,17 +137,12 @@ export class PolySynth<
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<PolySynthOptions<Voice>>);
|
constructor(options?: Partial<PolySynthOptions<Voice>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(PolySynth.getDefaults(), arguments, [
|
|
||||||
"voice",
|
|
||||||
"options",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
PolySynth.getDefaults(),
|
PolySynth.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["voice", "options"]
|
["voice", "options"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
// check against the old API (pre 14.3.0)
|
// check against the old API (pre 14.3.0)
|
||||||
assert(
|
assert(
|
||||||
|
|
|
@ -110,20 +110,13 @@ export class Sampler extends Instrument<SamplerOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<SamplerOptions>);
|
constructor(options?: Partial<SamplerOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(
|
|
||||||
Sampler.getDefaults(),
|
|
||||||
arguments,
|
|
||||||
["urls", "onload", "baseUrl"],
|
|
||||||
"urls"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Sampler.getDefaults(),
|
Sampler.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["urls", "onload", "baseUrl"],
|
["urls", "onload", "baseUrl"],
|
||||||
"urls"
|
"urls"
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
const urlMap = {};
|
const urlMap = {};
|
||||||
Object.keys(options.urls).forEach((note) => {
|
Object.keys(options.urls).forEach((note) => {
|
||||||
|
|
|
@ -64,8 +64,8 @@ export class Synth<
|
||||||
*/
|
*/
|
||||||
constructor(options?: RecursivePartial<SynthOptions>);
|
constructor(options?: RecursivePartial<SynthOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Synth.getDefaults(), arguments));
|
|
||||||
const options = optionsFromArguments(Synth.getDefaults(), arguments);
|
const options = optionsFromArguments(Synth.getDefaults(), arguments);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.oscillator = new OmniOscillator(
|
this.oscillator = new OmniOscillator(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
|
|
|
@ -43,11 +43,7 @@ export class Add extends Signal {
|
||||||
constructor(value?: number);
|
constructor(value?: number);
|
||||||
constructor(options?: Partial<SignalOptions<"number">>);
|
constructor(options?: Partial<SignalOptions<"number">>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(optionsFromArguments(Add.getDefaults(), arguments, ["value"]));
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Add.getDefaults(), arguments, ["value"])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
connectSeries(this._constantSource, this._sum);
|
connectSeries(this._constantSource, this._sum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,18 +55,12 @@ export class GreaterThan extends Signal<"number"> {
|
||||||
constructor(value?: number);
|
constructor(value?: number);
|
||||||
constructor(options?: Partial<GreaterThanOptions>);
|
constructor(options?: Partial<GreaterThanOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(GreaterThan.getDefaults(), arguments, [
|
|
||||||
"value",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
GreaterThan.getDefaults(),
|
GreaterThan.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["value"]
|
["value"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._subtract = this.input = new Subtract({
|
this._subtract = this.input = new Subtract({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -35,11 +35,7 @@ export class GreaterThanZero extends SignalOperator<GreaterThanZeroOptions> {
|
||||||
|
|
||||||
constructor(options?: Partial<GreaterThanZeroOptions>);
|
constructor(options?: Partial<GreaterThanZeroOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(optionsFromArguments(GreaterThanZero.getDefaults(), arguments));
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(GreaterThanZero.getDefaults(), arguments)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
this._thresh = this.output = new WaveShaper({
|
this._thresh = this.output = new WaveShaper({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -59,18 +59,12 @@ export class Multiply<
|
||||||
constructor(value?: number);
|
constructor(value?: number);
|
||||||
constructor(options?: Partial<SignalOptions<TypeName>>);
|
constructor(options?: Partial<SignalOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Multiply.getDefaults(), arguments, [
|
|
||||||
"value",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Multiply.getDefaults(),
|
Multiply.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["value"]
|
["value"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._mult =
|
this._mult =
|
||||||
this.input =
|
this.input =
|
||||||
|
|
|
@ -33,14 +33,10 @@ export class Pow extends SignalOperator<PowOptions> {
|
||||||
constructor(value?: number);
|
constructor(value?: number);
|
||||||
constructor(options?: Partial<PowOptions>);
|
constructor(options?: Partial<PowOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Pow.getDefaults(), arguments, ["value"])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Pow.getDefaults(), arguments, [
|
const options = optionsFromArguments(Pow.getDefaults(), arguments, [
|
||||||
"value",
|
"value",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._exponentScaler =
|
this._exponentScaler =
|
||||||
this.input =
|
this.input =
|
||||||
|
|
|
@ -59,18 +59,11 @@ export class Scale<
|
||||||
constructor(min?: number, max?: number);
|
constructor(min?: number, max?: number);
|
||||||
constructor(options?: Partial<ScaleOptions>);
|
constructor(options?: Partial<ScaleOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(Scale.getDefaults(), arguments, [
|
|
||||||
"min",
|
|
||||||
"max",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Scale.getDefaults(), arguments, [
|
const options = optionsFromArguments(Scale.getDefaults(), arguments, [
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
]);
|
]);
|
||||||
|
super(options as Options);
|
||||||
|
|
||||||
this._mult = this.input = new Multiply({
|
this._mult = this.input = new Multiply({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -32,20 +32,12 @@ export class ScaleExp extends Scale<ScaleExpOptions> {
|
||||||
constructor(min?: number, max?: number, exponent?: number);
|
constructor(min?: number, max?: number, exponent?: number);
|
||||||
constructor(options?: Partial<ScaleExpOptions>);
|
constructor(options?: Partial<ScaleExpOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(ScaleExp.getDefaults(), arguments, [
|
|
||||||
"min",
|
|
||||||
"max",
|
|
||||||
"exponent",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
ScaleExp.getDefaults(),
|
ScaleExp.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["min", "max", "exponent"]
|
["min", "max", "exponent"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.input = this._exp = new Pow({
|
this.input = this._exp = new Pow({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -66,17 +66,11 @@ export class Signal<TypeName extends UnitName = "number">
|
||||||
constructor(value?: UnitMap[TypeName], units?: TypeName);
|
constructor(value?: UnitMap[TypeName], units?: TypeName);
|
||||||
constructor(options?: Partial<SignalOptions<TypeName>>);
|
constructor(options?: Partial<SignalOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Signal.getDefaults(), arguments, [
|
|
||||||
"value",
|
|
||||||
"units",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
const options = optionsFromArguments(Signal.getDefaults(), arguments, [
|
const options = optionsFromArguments(Signal.getDefaults(), arguments, [
|
||||||
"value",
|
"value",
|
||||||
"units",
|
"units",
|
||||||
]) as SignalOptions<TypeName>;
|
]) as SignalOptions<TypeName>;
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.output = this._constantSource = new ToneConstantSource({
|
this.output = this._constantSource = new ToneConstantSource({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -17,11 +17,9 @@ export abstract class SignalOperator<
|
||||||
constructor(options?: Partial<Options>);
|
constructor(options?: Partial<Options>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(SignalOperator.getDefaults(), arguments, [
|
optionsFromArguments(SignalOperator.getDefaults(), arguments, [
|
||||||
"context",
|
"context",
|
||||||
])
|
])
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,11 +54,7 @@ export class Subtract extends Signal {
|
||||||
constructor(options?: Partial<SignalOptions<"number">>);
|
constructor(options?: Partial<SignalOptions<"number">>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(
|
||||||
Object.assign(
|
optionsFromArguments(Subtract.getDefaults(), arguments, ["value"])
|
||||||
optionsFromArguments(Subtract.getDefaults(), arguments, [
|
|
||||||
"value",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
connectSeries(this._constantSource, this._neg, this._sum);
|
connectSeries(this._constantSource, this._neg, this._sum);
|
||||||
|
|
|
@ -51,16 +51,11 @@ export class SyncedSignal<
|
||||||
constructor(value?: UnitMap[TypeName], units?: TypeName);
|
constructor(value?: UnitMap[TypeName], units?: TypeName);
|
||||||
constructor(options?: Partial<SignalOptions<TypeName>>);
|
constructor(options?: Partial<SignalOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Signal.getDefaults(), arguments, [
|
|
||||||
"value",
|
|
||||||
"units",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Signal.getDefaults(), arguments, [
|
const options = optionsFromArguments(Signal.getDefaults(), arguments, [
|
||||||
"value",
|
"value",
|
||||||
"units",
|
"units",
|
||||||
]) as SignalOptions<TypeName>;
|
]) as SignalOptions<TypeName>;
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._lastVal = options.value;
|
this._lastVal = options.value;
|
||||||
this._synced = this.context.transport.scheduleRepeat(
|
this._synced = this.context.transport.scheduleRepeat(
|
||||||
|
|
|
@ -42,16 +42,12 @@ export class ToneConstantSource<
|
||||||
constructor(offset: UnitMap[TypeName]);
|
constructor(offset: UnitMap[TypeName]);
|
||||||
constructor(options?: Partial<ToneConstantSourceOptions<TypeName>>);
|
constructor(options?: Partial<ToneConstantSourceOptions<TypeName>>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(ToneConstantSource.getDefaults(), arguments, [
|
|
||||||
"offset",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
ToneConstantSource.getDefaults(),
|
ToneConstantSource.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["offset"]
|
["offset"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
connect(this._source, this._gainNode);
|
connect(this._source, this._gainNode);
|
||||||
|
|
||||||
|
|
|
@ -59,19 +59,12 @@ export class WaveShaper extends SignalOperator<WaveShaperOptions> {
|
||||||
constructor(mapping?: WaveShaperMapping, length?: number);
|
constructor(mapping?: WaveShaperMapping, length?: number);
|
||||||
constructor(options?: Partial<WaveShaperOptions>);
|
constructor(options?: Partial<WaveShaperOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
Object.assign(
|
|
||||||
optionsFromArguments(WaveShaper.getDefaults(), arguments, [
|
|
||||||
"mapping",
|
|
||||||
"length",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
WaveShaper.getDefaults(),
|
WaveShaper.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["mapping", "length"]
|
["mapping", "length"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isArray(options.mapping) ||
|
isArray(options.mapping) ||
|
||||||
|
|
|
@ -33,9 +33,7 @@ export class Zero extends SignalOperator<ToneAudioNodeOptions> {
|
||||||
|
|
||||||
constructor(options?: Partial<ToneAudioNodeOptions>);
|
constructor(options?: Partial<ToneAudioNodeOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
super(optionsFromArguments(Zero.getDefaults(), arguments));
|
||||||
Object.assign(optionsFromArguments(Zero.getDefaults(), arguments))
|
|
||||||
);
|
|
||||||
connect(this.context.getConstant(0), this._gain);
|
connect(this.context.getConstant(0), this._gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,10 @@ export class Noise extends Source<NoiseOptions> {
|
||||||
constructor(type?: NoiseType);
|
constructor(type?: NoiseType);
|
||||||
constructor(options?: Partial<NoiseOptions>);
|
constructor(options?: Partial<NoiseOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(optionsFromArguments(Noise.getDefaults(), arguments, ["type"]));
|
|
||||||
const options = optionsFromArguments(Noise.getDefaults(), arguments, [
|
const options = optionsFromArguments(Noise.getDefaults(), arguments, [
|
||||||
"type",
|
"type",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._playbackRate = options.playbackRate;
|
this._playbackRate = options.playbackRate;
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
|
|
|
@ -73,14 +73,12 @@ export class UserMedia extends ToneAudioNode<UserMediaOptions> {
|
||||||
constructor(volume?: Decibels);
|
constructor(volume?: Decibels);
|
||||||
constructor(options?: Partial<UserMediaOptions>);
|
constructor(options?: Partial<UserMediaOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(UserMedia.getDefaults(), arguments, ["volume"])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
UserMedia.getDefaults(),
|
UserMedia.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["volume"]
|
["volume"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._volume = this.output = new Volume({
|
this._volume = this.output = new Volume({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -92,17 +92,12 @@ export class GrainPlayer extends Source<GrainPlayerOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<GrainPlayerOptions>);
|
constructor(options?: Partial<GrainPlayerOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(GrainPlayer.getDefaults(), arguments, [
|
|
||||||
"url",
|
|
||||||
"onload",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
GrainPlayer.getDefaults(),
|
GrainPlayer.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["url", "onload"]
|
["url", "onload"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.buffer = new ToneAudioBuffer({
|
this.buffer = new ToneAudioBuffer({
|
||||||
onload: options.onload,
|
onload: options.onload,
|
||||||
|
|
|
@ -91,16 +91,11 @@ export class Player extends Source<PlayerOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<PlayerOptions>);
|
constructor(options?: Partial<PlayerOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(Player.getDefaults(), arguments, [
|
|
||||||
"url",
|
|
||||||
"onload",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(Player.getDefaults(), arguments, [
|
const options = optionsFromArguments(Player.getDefaults(), arguments, [
|
||||||
"url",
|
"url",
|
||||||
"onload",
|
"onload",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._buffer = new ToneAudioBuffer({
|
this._buffer = new ToneAudioBuffer({
|
||||||
onload: this._onload.bind(this, options.onload),
|
onload: this._onload.bind(this, options.onload),
|
||||||
|
|
|
@ -87,20 +87,13 @@ export class Players extends ToneAudioNode<PlayersOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<PlayersOptions>);
|
constructor(options?: Partial<PlayersOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(
|
|
||||||
Players.getDefaults(),
|
|
||||||
arguments,
|
|
||||||
["urls", "onload"],
|
|
||||||
"urls"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
Players.getDefaults(),
|
Players.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["urls", "onload"],
|
["urls", "onload"],
|
||||||
"urls"
|
"urls"
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output volume node
|
* The output volume node
|
||||||
|
|
|
@ -67,17 +67,12 @@ export class ToneBufferSource extends OneShotSource<ToneBufferSourceOptions> {
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<ToneBufferSourceOptions>);
|
constructor(options?: Partial<ToneBufferSourceOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(ToneBufferSource.getDefaults(), arguments, [
|
|
||||||
"url",
|
|
||||||
"onload",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
ToneBufferSource.getDefaults(),
|
ToneBufferSource.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["url", "onload"]
|
["url", "onload"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
connect(this._source, this._gainNode);
|
connect(this._source, this._gainNode);
|
||||||
this._source.onended = () => this._stopSource();
|
this._source.onended = () => this._stopSource();
|
||||||
|
|
|
@ -97,18 +97,12 @@ export class AMOscillator
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<AMConstructorOptions>);
|
constructor(options?: Partial<AMConstructorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(AMOscillator.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
"modulationType",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
AMOscillator.getDefaults(),
|
AMOscillator.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "type", "modulationType"]
|
["frequency", "type", "modulationType"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._carrier = new Oscillator({
|
this._carrier = new Oscillator({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -99,18 +99,12 @@ export class FMOscillator
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<FMConstructorOptions>);
|
constructor(options?: Partial<FMConstructorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(FMOscillator.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
"modulationType",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
FMOscillator.getDefaults(),
|
FMOscillator.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "type", "modulationType"]
|
["frequency", "type", "modulationType"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._carrier = new Oscillator({
|
this._carrier = new Oscillator({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -79,18 +79,12 @@ export class FatOscillator
|
||||||
);
|
);
|
||||||
constructor(options?: Partial<FatConstructorOptions>);
|
constructor(options?: Partial<FatConstructorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(FatOscillator.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
"spread",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
FatOscillator.getDefaults(),
|
FatOscillator.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "type", "spread"]
|
["frequency", "type", "spread"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.frequency = new Signal({
|
this.frequency = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
|
@ -124,18 +124,12 @@ export class LFO extends ToneAudioNode<LFOOptions> {
|
||||||
constructor(frequency?: Frequency, min?: number, max?: number);
|
constructor(frequency?: Frequency, min?: number, max?: number);
|
||||||
constructor(options?: Partial<LFOOptions>);
|
constructor(options?: Partial<LFOOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(LFO.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"min",
|
|
||||||
"max",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(LFO.getDefaults(), arguments, [
|
const options = optionsFromArguments(LFO.getDefaults(), arguments, [
|
||||||
"frequency",
|
"frequency",
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
]);
|
]);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this._oscillator = new Oscillator(
|
this._oscillator = new Oscillator(
|
||||||
options as ToneOscillatorConstructorOptions
|
options as ToneOscillatorConstructorOptions
|
||||||
|
|
|
@ -114,17 +114,12 @@ export class OmniOscillator<OscType extends AnyOscillator>
|
||||||
constructor(frequency?: Frequency, type?: OmniOscillatorType);
|
constructor(frequency?: Frequency, type?: OmniOscillatorType);
|
||||||
constructor(options?: Partial<OmniOscillatorOptions>);
|
constructor(options?: Partial<OmniOscillatorOptions>);
|
||||||
constructor() {
|
constructor() {
|
||||||
super(
|
|
||||||
optionsFromArguments(OmniOscillator.getDefaults(), arguments, [
|
|
||||||
"frequency",
|
|
||||||
"type",
|
|
||||||
])
|
|
||||||
);
|
|
||||||
const options = optionsFromArguments(
|
const options = optionsFromArguments(
|
||||||
OmniOscillator.getDefaults(),
|
OmniOscillator.getDefaults(),
|
||||||
arguments,
|
arguments,
|
||||||
["frequency", "type"]
|
["frequency", "type"]
|
||||||
);
|
);
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.frequency = new Signal({
|
this.frequency = new Signal({
|
||||||
context: this.context,
|
context: this.context,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue