mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-14 15:57:08 +00:00
removing positive number restriction on frequency envelope octaves
This commit is contained in:
parent
66b377e1b5
commit
944fa51466
2 changed files with 9 additions and 4 deletions
|
@ -60,6 +60,12 @@ describe("FrequencyEnvelope", () => {
|
|||
env1.dispose();
|
||||
});
|
||||
|
||||
it("can set a negative octave", () => {
|
||||
const freqEnv = new FrequencyEnvelope();
|
||||
freqEnv.octaves = -2;
|
||||
freqEnv.dispose();
|
||||
});
|
||||
|
||||
it("goes to the scaled range", async () => {
|
||||
const e = {
|
||||
attack: 0.01,
|
||||
|
|
|
@ -37,7 +37,7 @@ export class FrequencyEnvelope extends Envelope {
|
|||
/**
|
||||
* The number of octaves
|
||||
*/
|
||||
private _octaves: Positive;
|
||||
private _octaves: number;
|
||||
|
||||
/**
|
||||
* Internal scaler from 0-1 to the final output range
|
||||
|
@ -104,11 +104,10 @@ export class FrequencyEnvelope extends Envelope {
|
|||
* The number of octaves above the baseFrequency that the
|
||||
* envelope will scale to.
|
||||
*/
|
||||
get octaves(): Positive {
|
||||
get octaves(): number {
|
||||
return this._octaves;
|
||||
}
|
||||
set octaves(octaves: Positive) {
|
||||
assertRange(octaves, 0);
|
||||
set octaves(octaves: number) {
|
||||
this._octaves = octaves;
|
||||
this._scale.max = this._baseFrequency * Math.pow(2, octaves);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue