Support for chords when using Sequence, use nested arrays to use chords

This commit is contained in:
Ale Camus 2023-11-27 16:49:05 +01:00
parent 08df7ad68c
commit 2ce0d6ffa0

View file

@ -191,7 +191,12 @@ export class Sequence<ValueType = any> extends ToneEvent<ValueType> {
sequence.forEach((value, index) => {
const eventOffset = index * (subdivision) + startOffset;
if (isArray(value)) {
this._rescheduleSequence(value, subdivision / value.length, eventOffset);
if (value.length === 1 && isArray(value[0])){
const startTime = new TicksClass(this.context, eventOffset, "i").toSeconds();
this._part.add(startTime, value.flat());
} else {
this._rescheduleSequence(value, subdivision / value.length, eventOffset);
}
} else {
const startTime = new TicksClass(this.context, eventOffset, "i").toSeconds();
this._part.add(startTime, value);