@ryohey/wavelet
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -15,2 +15,3 @@ import { logger } from "./logger"; | ||
modulation: 0, | ||
hold: false, | ||
}); | ||
@@ -75,3 +76,8 @@ const RHYTHM_CHANNEL = 9; | ||
if (!osc.isNoteOff) { | ||
osc.noteOff(); | ||
if (state.hold) { | ||
osc.isHold = true; | ||
} | ||
else { | ||
osc.noteOff(); | ||
} | ||
} | ||
@@ -111,5 +117,11 @@ } | ||
const state = this.getChannelState(channel); | ||
state.hold = hold; | ||
if (hold) { | ||
return; | ||
} | ||
for (const key in state.oscillators) { | ||
for (const osc of state.oscillators[key]) { | ||
osc.setHold(hold); | ||
if (osc.isHold) { | ||
osc.noteOff(); | ||
} | ||
} | ||
@@ -116,0 +128,0 @@ } |
@@ -7,3 +7,2 @@ import { SampleData } from "../SynthEvent"; | ||
private _isNoteOff; | ||
private isHold; | ||
private baseSpeed; | ||
@@ -18,2 +17,3 @@ private readonly envelope; | ||
pan: number; | ||
isHold: boolean; | ||
constructor(sample: SampleData<Float32Array>); | ||
@@ -24,3 +24,2 @@ noteOn(pitch: number, velocity: number): void; | ||
process(outputs: Float32Array[]): void; | ||
setHold(hold: boolean): void; | ||
get isPlaying(): boolean; | ||
@@ -27,0 +26,0 @@ get isNoteOff(): boolean; |
@@ -8,3 +8,2 @@ import { AmplitudeEnvelope } from "./AmplitudeEnvelope"; | ||
_isNoteOff = false; | ||
isHold = false; | ||
baseSpeed = 1; | ||
@@ -23,2 +22,4 @@ envelope; | ||
pan = 0; | ||
// This oscillator should be note off when hold pedal off | ||
isHold = false; | ||
constructor(sample) { | ||
@@ -37,5 +38,2 @@ this.sample = sample; | ||
noteOff() { | ||
if (this.isHold) { | ||
return; | ||
} | ||
this.envelope.noteOff(); | ||
@@ -87,8 +85,2 @@ this._isNoteOff = true; | ||
} | ||
setHold(hold) { | ||
this.isHold = hold; | ||
if (!hold && !this._isNoteOff) { | ||
this.noteOff(); | ||
} | ||
} | ||
get isPlaying() { | ||
@@ -95,0 +87,0 @@ return this._isPlaying && this.envelope.isPlaying; |
@@ -455,3 +455,2 @@ (function () { | ||
_isNoteOff = false; | ||
isHold = false; | ||
baseSpeed = 1; | ||
@@ -470,2 +469,4 @@ envelope; | ||
pan = 0; | ||
// This oscillator should be note off when hold pedal off | ||
isHold = false; | ||
constructor(sample) { | ||
@@ -484,5 +485,2 @@ this.sample = sample; | ||
noteOff() { | ||
if (this.isHold) { | ||
return; | ||
} | ||
this.envelope.noteOff(); | ||
@@ -534,8 +532,2 @@ this._isNoteOff = true; | ||
} | ||
setHold(hold) { | ||
this.isHold = hold; | ||
if (!hold && !this._isNoteOff) { | ||
this.noteOff(); | ||
} | ||
} | ||
get isPlaying() { | ||
@@ -562,2 +554,3 @@ return this._isPlaying && this.envelope.isPlaying; | ||
modulation: 0, | ||
hold: false, | ||
}); | ||
@@ -622,3 +615,8 @@ const RHYTHM_CHANNEL = 9; | ||
if (!osc.isNoteOff) { | ||
osc.noteOff(); | ||
if (state.hold) { | ||
osc.isHold = true; | ||
} | ||
else { | ||
osc.noteOff(); | ||
} | ||
} | ||
@@ -658,5 +656,11 @@ } | ||
const state = this.getChannelState(channel); | ||
state.hold = hold; | ||
if (hold) { | ||
return; | ||
} | ||
for (const key in state.oscillators) { | ||
for (const osc of state.oscillators[key]) { | ||
osc.setHold(hold); | ||
if (osc.isHold) { | ||
osc.noteOff(); | ||
} | ||
} | ||
@@ -663,0 +667,0 @@ } |
@@ -7,3 +7,2 @@ import { SampleData } from "../SynthEvent"; | ||
private _isNoteOff; | ||
private isHold; | ||
private baseSpeed; | ||
@@ -18,2 +17,3 @@ private readonly envelope; | ||
pan: number; | ||
isHold: boolean; | ||
constructor(sample: SampleData<Float32Array>); | ||
@@ -24,3 +24,2 @@ noteOn(pitch: number, velocity: number): void; | ||
process(outputs: Float32Array[]): void; | ||
setHold(hold: boolean): void; | ||
get isPlaying(): boolean; | ||
@@ -27,0 +26,0 @@ get isNoteOff(): boolean; |
{ | ||
"name": "@ryohey/wavelet", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A wavetable synthesizer that never stops the UI thread created by AudioWorklet.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,2 +17,3 @@ import { SampleData, SynthEvent } from "../SynthEvent" | ||
oscillators: { [key: number]: WavetableOscillator[] } | ||
hold: boolean | ||
} | ||
@@ -30,2 +31,3 @@ | ||
modulation: 0, | ||
hold: false, | ||
}) | ||
@@ -121,3 +123,7 @@ | ||
if (!osc.isNoteOff) { | ||
osc.noteOff() | ||
if (state.hold) { | ||
osc.isHold = true | ||
} else { | ||
osc.noteOff() | ||
} | ||
} | ||
@@ -165,6 +171,13 @@ } | ||
const state = this.getChannelState(channel) | ||
state.hold = hold | ||
if (hold) { | ||
return | ||
} | ||
for (const key in state.oscillators) { | ||
for (const osc of state.oscillators[key]) { | ||
osc.setHold(hold) | ||
if (osc.isHold) { | ||
osc.noteOff() | ||
} | ||
} | ||
@@ -171,0 +184,0 @@ } |
@@ -10,3 +10,2 @@ import { SampleData } from "../SynthEvent" | ||
private _isNoteOff = false | ||
private isHold = false | ||
private baseSpeed = 1 | ||
@@ -30,2 +29,5 @@ private readonly envelope: AmplitudeEnvelope | ||
// This oscillator should be note off when hold pedal off | ||
isHold = false | ||
constructor(sample: SampleData<Float32Array>) { | ||
@@ -49,6 +51,2 @@ this.sample = sample | ||
noteOff() { | ||
if (this.isHold) { | ||
return | ||
} | ||
this.envelope.noteOff() | ||
@@ -117,10 +115,2 @@ this._isNoteOff = true | ||
setHold(hold: boolean) { | ||
this.isHold = hold | ||
if (!hold && !this._isNoteOff) { | ||
this.noteOff() | ||
} | ||
} | ||
get isPlaying() { | ||
@@ -127,0 +117,0 @@ return this._isPlaying && this.envelope.isPlaying |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
365804
3437