mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-13 12:28:47 +00:00
updating omnioscillator options
This commit is contained in:
parent
a58f326e41
commit
ed8bb4ddcf
5 changed files with 10 additions and 19 deletions
|
@ -140,7 +140,7 @@ export abstract class ModulationSynth<Options extends ModulationSynthOptions> ex
|
|||
{
|
||||
type: "sine"
|
||||
}
|
||||
),
|
||||
) as OmniOscillatorSynthOptions,
|
||||
envelope: Object.assign(
|
||||
omitFromObject(
|
||||
Envelope.getDefaults(),
|
||||
|
@ -162,7 +162,7 @@ export abstract class ModulationSynth<Options extends ModulationSynthOptions> ex
|
|||
{
|
||||
type: "square"
|
||||
}
|
||||
),
|
||||
) as OmniOscillatorSynthOptions,
|
||||
modulationEnvelope: Object.assign(
|
||||
omitFromObject(
|
||||
Envelope.getDefaults(),
|
||||
|
|
|
@ -131,7 +131,7 @@ export class MonoSynth extends Monophonic<MonoSynthOptions> {
|
|||
{
|
||||
type: "sawtooth",
|
||||
},
|
||||
),
|
||||
) as OmniOscillatorSynthOptions,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import { readOnly } from "../core/util/Interface";
|
|||
import { RecursivePartial } from "../core/util/Interface";
|
||||
import { Signal } from "../signal/Signal";
|
||||
import { OmniOscillator } from "../source/oscillator/OmniOscillator";
|
||||
import { OmniOscillatorSynthOptions } from "../source/oscillator/OscillatorInterface";
|
||||
import { OmniOscillatorOptions, OmniOscillatorSynthOptions } from "../source/oscillator/OscillatorInterface";
|
||||
import { Source } from "../source/Source";
|
||||
import { Monophonic, MonophonicOptions } from "./Monophonic";
|
||||
|
||||
|
@ -94,7 +94,7 @@ export class Synth<Options extends SynthOptions = SynthOptions> extends Monophon
|
|||
{
|
||||
type: "triangle",
|
||||
},
|
||||
),
|
||||
) as OmniOscillatorOptions,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { FMOscillator } from "./FMOscillator";
|
|||
import { Oscillator } from "./Oscillator";
|
||||
import {
|
||||
generateWaveform,
|
||||
OmniOscillatorConstructorOptions, OmniOscillatorOptions,
|
||||
OmniOscillatorOptions,
|
||||
OmniOscillatorType, ToneOscillatorInterface, ToneOscillatorType
|
||||
} from "./OscillatorInterface";
|
||||
import { PulseOscillator } from "./PulseOscillator";
|
||||
|
@ -69,7 +69,7 @@ const OmniOscillatorSourceMap: {
|
|||
* @category Source
|
||||
*/
|
||||
export class OmniOscillator<OscType extends AnyOscillator>
|
||||
extends Source<OmniOscillatorConstructorOptions>
|
||||
extends Source<OmniOscillatorOptions>
|
||||
implements Omit<ToneOscillatorInterface, "type"> {
|
||||
|
||||
readonly name: string = "OmniOscillator";
|
||||
|
@ -92,7 +92,7 @@ export class OmniOscillator<OscType extends AnyOscillator>
|
|||
* @param type The type of the oscillator.
|
||||
*/
|
||||
constructor(frequency?: Frequency, type?: OmniOscillatorType);
|
||||
constructor(options?: Partial<OmniOscillatorConstructorOptions>);
|
||||
constructor(options?: Partial<OmniOscillatorOptions>);
|
||||
constructor() {
|
||||
|
||||
super(optionsFromArguments(OmniOscillator.getDefaults(), arguments, ["frequency", "type"]));
|
||||
|
@ -212,7 +212,7 @@ export class OmniOscillator<OscType extends AnyOscillator>
|
|||
}
|
||||
}
|
||||
|
||||
set(props: Partial<OmniOscillatorConstructorOptions>): this {
|
||||
set(props: Partial<OmniOscillatorOptions>): this {
|
||||
// make sure the type is set first
|
||||
if (Reflect.has(props, "type") && props.type) {
|
||||
this.type = props.type;
|
||||
|
|
|
@ -442,22 +442,13 @@ export type OmniOscillatorType =
|
|||
"amsine" | "amsquare" | "amsawtooth" | "amtriangle" | "amcustom" | AMTypeWithPartials |
|
||||
TypeWithPartials | OscillatorType | "pulse" | "pwm";
|
||||
|
||||
export type OmniOscillatorConstructorOptions =
|
||||
export type OmniOscillatorOptions =
|
||||
PulseOscillatorOptions | PWMOscillatorOptions |
|
||||
OmniFatCustomOscillatorOptions | OmniFatTypeOscillatorOptions | OmniFatPartialsOscillatorOptions |
|
||||
OmniFMCustomOscillatorOptions | OmniFMTypeOscillatorOptions | OmniFMPartialsOscillatorOptions |
|
||||
OmniAMCustomOscillatorOptions | OmniAMTypeOscillatorOptions | OmniAMPartialsOscillatorOptions |
|
||||
ToneOscillatorConstructorOptions;
|
||||
|
||||
// export type OmniOscillatorSourceOptions = OmniOscillatorConstructorOptions & SourceOptions;
|
||||
|
||||
export type OmniOscillatorOptions =
|
||||
PulseOscillatorOptions & PWMOscillatorOptions &
|
||||
OmniFatCustomOscillatorOptions & OmniFatTypeOscillatorOptions & OmniFatPartialsOscillatorOptions &
|
||||
OmniFMCustomOscillatorOptions & OmniFMTypeOscillatorOptions & OmniFMPartialsOscillatorOptions &
|
||||
OmniAMCustomOscillatorOptions & OmniAMTypeOscillatorOptions & OmniAMPartialsOscillatorOptions &
|
||||
ToneOscillatorConstructorOptions;
|
||||
|
||||
type OmitSourceOptions<T extends BaseOscillatorOptions> = Omit<T, "frequency" | "detune" | "context">;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue