Add check for negative bpm & ppqn
This commit is contained in:
@ -127,7 +127,7 @@ export class Clock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set bpm(bpm: number) {
|
set bpm(bpm: number) {
|
||||||
if(this._bpm !== bpm) {
|
if(bpm>0 && this._bpm !== bpm) {
|
||||||
this._bpm = bpm;
|
this._bpm = bpm;
|
||||||
this.transportNode?.setBPM(bpm);
|
this.transportNode?.setBPM(bpm);
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ export class Clock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set ppqn(ppqn: number) {
|
set ppqn(ppqn: number) {
|
||||||
if(this._ppqn !== ppqn) {
|
if(ppqn>0 && this._ppqn !== ppqn) {
|
||||||
this._ppqn = ppqn;
|
this._ppqn = ppqn;
|
||||||
this.transportNode?.setPPQN(ppqn);
|
this.transportNode?.setPPQN(ppqn);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class TransportProcessor extends AudioWorkletProcessor {
|
|||||||
this.currentPulsePosition = 0;
|
this.currentPulsePosition = 0;
|
||||||
} else if(message.data.type === 'ppqn') {
|
} else if(message.data.type === 'ppqn') {
|
||||||
this.ppqn = message.data.value;
|
this.ppqn = message.data.value;
|
||||||
|
this.currentPulsePosition = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user