@Felix-W said in Sampler.setSoundPropertyForSelection(); seems to have a bug.:
@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.😹
Wow, this method is so cool! Thank you for the code comments; they really enlightened me.