From 85914b7337384b642244d93713f5e4542b302735 Mon Sep 17 00:00:00 2001 From: Benjamin Dehli Date: Fri, 24 May 2024 23:26:40 +0200 Subject: [PATCH] Add getters --- src/classes/Keyboard.js | 3 +++ src/classes/Modulators.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/classes/Keyboard.js b/src/classes/Keyboard.js index 8ae7c11..8b7ca34 100644 --- a/src/classes/Keyboard.js +++ b/src/classes/Keyboard.js @@ -41,6 +41,9 @@ export class Keyboard { getFirstColorItem() { return this.childElements.find((childElement) => childElement instanceof Color); } + getColorItemByIndex(index) { + return this.getColorItems()[index]; + } addColorItem(props) { this.childElements.push(new Color(props, "group", this.hierarchyPath)); } diff --git a/src/classes/Modulators.js b/src/classes/Modulators.js index 09d6dac..22901db 100644 --- a/src/classes/Modulators.js +++ b/src/classes/Modulators.js @@ -36,6 +36,12 @@ export class Modulators { !!childElement?.init && childElement.init(decentSampler); }); } + getChildElements() { + return this.childElements; + } + getChildElementByIndex(index) { + return this.childElements[index]; + } getLfoItems() { return this.childElements?.filter((childElement) => childElement instanceof Lfo); }