omiting synth options on each individual options object

instead of on the entire object which caused some issues
This commit is contained in:
Yotam Mann 2019-08-14 13:16:23 -04:00
parent ed88e6bf10
commit 77806402b6
2 changed files with 15 additions and 10 deletions

View file

@ -7,20 +7,12 @@ import { readOnly } from "../core/util/Interface";
import { RecursivePartial } from "../core/util/Interface";
import { Signal } from "../signal/Signal";
import { OmniOscillator } from "../source/oscillator/OmniOscillator";
import { OmniOscillatorConstructorOptions } from "../source/oscillator/OscillatorInterface";
import { OmniOscillatorConstructorOptions, OmniOscillatorSynthOptions } from "../source/oscillator/OscillatorInterface";
import { Source, SourceOptions } from "../source/Source";
import { Monophonic, MonophonicOptions } from "./Monophonic";
/**
* The settable oscillator options. Does not include optiosn like
* "context" and "frequency" since those are controlled by the synth
*/
type LimitedOscillatorOptions = Omit<
Omit<OmniOscillatorConstructorOptions, keyof SourceOptions>,
"frequency" | "detune">;
export interface SynthOptions extends MonophonicOptions {
oscillator: LimitedOscillatorOptions;
oscillator: OmniOscillatorSynthOptions;
envelope: Omit<EnvelopeOptions, keyof ToneAudioNodeOptions>;
}

View file

@ -1,5 +1,6 @@
// tslint:disable: max-line-length
import { AudioRange, Cents, Degrees, Frequency, Positive } from "../../core/type/Units";
import { Omit } from "../../core/util/Interface";
import { Signal } from "../../signal/Signal";
import { SourceOptions } from "../Source";
@ -351,3 +352,15 @@ export type OmniOscillatorOptions =
OmniFMCustomOscillatorOptions & OmniFMTypeOscillatorOptions & OmniFMPartialsOscillatorOptions &
OmniAMCustomOscillatorOptions & OmniAMTypeOscillatorOptions & OmniAMPartialsOscillatorOptions &
ToneOscillatorConstructorOptions;
type OmitSourceOptions<T extends BaseOscillatorOptions> = Omit<T, "frequency" | "detune" | "context">;
/**
* The settable options for the omni oscillator inside of the source which excludes certain attributes that are defined by the parent class
*/
export type OmniOscillatorSynthOptions =
OmitSourceOptions<PulseOscillatorOptions> | OmitSourceOptions<PWMOscillatorOptions> |
OmitSourceOptions<OmniFatCustomOscillatorOptions> | OmitSourceOptions<OmniFatTypeOscillatorOptions> | OmitSourceOptions<OmniFatPartialsOscillatorOptions> |
OmitSourceOptions<OmniFMCustomOscillatorOptions> | OmitSourceOptions<OmniFMTypeOscillatorOptions> | OmitSourceOptions<OmniFMPartialsOscillatorOptions> |
OmitSourceOptions<OmniAMCustomOscillatorOptions> | OmitSourceOptions<OmniAMTypeOscillatorOptions> | OmitSourceOptions<OmniAMPartialsOscillatorOptions> |
OmitSourceOptions<ToneOscillatorConstructorOptions>;