Sampler.setSoundPropertyForSelection(); seems to have a bug.
-
Sampler.setSoundPropertyForSelection(); seems to have a bug.
When I changed the values of Root, LoKey, and HiKey in the sample from larger to smaller values, the HiKey value with the code 4 did not take effect.

-
@CatABC Use constants instead of magic numbers
-
@d-healey There are some rare cases that .setAttribute gives an error if I use param ID instead of a number. Gives an error on only certain things error: "expected int" I think the error is. I'll specifically note them next time and tell you.
-
@Chazrox said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:
@d-healey There are some rare cases that .setAttribute gives an error if I use param ID instead of a number. Gives an error on only certain things error: "expected int" I think the error is. I'll specifically note them next time and tell you.
That means the constant is invalid
-
@CatABC if you change both the low and the highkey downwards you need to change the lo key first and then the hi key, cause it’s not possible to set the hi key below the lowkey
-
@d-healey said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:
@CatABC Use constants instead of magic numbers
Sadly, I tried using constants, but the problem persists. Also, if I swap the positions of HIGH_KEY and LOW_KEY, and need to move the smaller value to the larger value, the contradiction still occurs.
const var ComboBox1 = Content.getComponent("ComboBox1"); const var ROOT = 2; const var LOW_KEY = 3; const var HIGH_KEY = 4; const var C1 = 36; const var D1 = 38; const var E1 = 40; const var B3 = 71; inline function onComboBox1Control(component, value) { Sampler.selectSounds("C3"); if (value == 1) { Sampler.setSoundPropertyForSelection(ROOT, C1); Sampler.setSoundPropertyForSelection(HIGH_KEY, C1); Sampler.setSoundPropertyForSelection(LOW_KEY, C1); } if (value == 2) { Sampler.setSoundPropertyForSelection(ROOT, D1); Sampler.setSoundPropertyForSelection(HIGH_KEY,D1); Sampler.setSoundPropertyForSelection(LOW_KEY, D1); } if (value == 3) { Sampler.setSoundPropertyForSelection(ROOT, E1); Sampler.setSoundPropertyForSelection(HIGH_KEY,E1); Sampler.setSoundPropertyForSelection(LOW_KEY, E1); } if (value == 4) { Sampler.setSoundPropertyForSelection(ROOT, B3); Sampler.setSoundPropertyForSelection(LOW_KEY, B3); Sampler.setSoundPropertyForSelection(HIGH_KEY, B3); } }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control); -
@CatABC said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:
@d-healey said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:
@CatABC Use constants instead of magic numbers
Sadly, I tried using constants, but the problem persists. Also, if I swap the positions of HIGH_KEY and LOW_KEY, and need to move the smaller value to the larger value, the contradiction still occurs.
const var ComboBox1 = Content.getComponent("ComboBox1"); const var ROOT = 2; const var LOW_KEY = 3; const var HIGH_KEY = 4; const var C1 = 36; const var D1 = 38; const var E1 = 40; const var B3 = 71; inline function onComboBox1Control(component, value) { Sampler.selectSounds("C3"); if (value == 1) { Sampler.setSoundPropertyForSelection(ROOT, C1); Sampler.setSoundPropertyForSelection(HIGH_KEY, C1); Sampler.setSoundPropertyForSelection(LOW_KEY, C1); } if (value == 2) { Sampler.setSoundPropertyForSelection(ROOT, D1); Sampler.setSoundPropertyForSelection(HIGH_KEY,D1); Sampler.setSoundPropertyForSelection(LOW_KEY, D1); } if (value == 3) { Sampler.setSoundPropertyForSelection(ROOT, E1); Sampler.setSoundPropertyForSelection(HIGH_KEY,E1); Sampler.setSoundPropertyForSelection(LOW_KEY, E1); } if (value == 4) { Sampler.setSoundPropertyForSelection(ROOT, B3); Sampler.setSoundPropertyForSelection(LOW_KEY, B3); Sampler.setSoundPropertyForSelection(HIGH_KEY, B3); } }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);Ultimately, I set up two methods to call different methods depending on whether the value in the combobox increases or decreases.
