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