Sample Editor Functions + UI Control
-
Hey HISE Gang,
Has anyone been able to get the Sample Editor functions to be editable by knob/slider/cmbox (Sample Start/End, Loop Start/End, LoopXfade)? I feel this is the only way to save these functions in presets + allow user customization, correct?
-
I dug the forum again and found a little trick about naming the Sampler for instances of 2 const var calls.
Im horrible with scripting and new to this so excuse the shitty code, but hey, it did the job! Here is the code if anybody wants to try it out. It allows you to control the editing functions of the sampler (Loop Enable, Reverse, Loop Start/Stop, etc).
HISE SNIPPET:
HiseSnippet 2171.3oc4Z0sbaabEFPRPIj1owIStn2jYvvoWPkQVgT1wtM+TSQJoLbhjLCorSlwMSxRfkjvFbWLKVpeZGOSeD56Pauu8MvOB8t9Z365ktm8G.rfBjBRwIwSKuQd28bN624Cm8bNXg6wnd33XJyxtxwmGgsruoyfyI7IclfBHVc20xtpyQ3Sc6P8wVsOOBEGi8srsW8KEqaWYMK4uW9f1nPDwCmMkk0ioAd3CBlFvylsWquJHLbejO93foFRe2Vc8njNzP5L.Kq5zvJB48LzX7QHgXq3XYu9d9AbJa.GwwwV1q0l5e9fIzSIJ4ebPbvvPrXPSqAfgTSuOMzWfXwrVclDD52Kwmisrrc5kw.qpXfOv4v.+fz4yXhaIWvMSCS9vdk7va0bvqoI7ZX.uBfjsAjVSAo2yYfGKHhmsh.O2voKgiYiPd4eznj0Zk+dUmNTPBBeqonmg2mACR0ndysazXS262nwFeV0pe7GOXmC6cvd8ca5t+iNpywce3QCpVEdjDycOAwbGflFEhYMc+BWY7wViwb8b0qkrXMsoTCAScasdt.qv3teEgNrZ.ILffcGMi3wCnDWJQIiTDAdYzv5dzoQTBf7MgcObFdip+optvuQTV8X2.RJd1xigABe.NDKMW8Za8Q01XCovJUD+BodnP2P.7QHVLFHg5wBOnt1Lao96dD+M.WHQq3shufHRTpAk6G4FpE+4UeN35IrMX4NINPB6HUr1FBSpcxNnvvgPPd8hXfExj.FWNOBB7FOKBhjwgau8u6N2+dklHAcWNMlQ.WjDOfRiVdvnPhKMTrhfAQWW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0mdZOjuOD4UV8FfQLuIsQr1zYDegm9D0BIrlhkLVs5ysNUP.voL6+lsk0Dbv3Ihyb1qYak6bxaU5xKYmP9gyLyM9D8A8JIxaEkzaPWeQRmjNzrfl7gfCNVOuVb+b3oRoqTsH770sztdx44enUh6mLymmlPDLoqvlkCyURfvxx7un5hK.uV+dMXVWJbIS5aVu7LyjtETzJIY5xS7ewqG8VNGR8mEh34usVwUTqW.REk6JREWCJbRketokm+JbWqbWg6xug4xB22yoW.2aRw3ckBvKzjwO03Ueg3uiydiFAucbFXWyY+uco298qcn7gJn79NC3P1roPNIcfu9aTjdL30v2nHpzeiBnDq7k4B9iFh8hVsmA7EK+r+iVxsZmoPtub6kF48wQXD+PwmYIcw2tU+9eIiNKZdsd4CjAKGyfW3CnByERN2a3icXz33Qf6HsUr4R8lwFK3prYRy0YLmn10DDgfCEudlsHw7ihEMhxC7NDwYA45IQtKMNFIeduhiZby4Fu8biuybiu6bi+j4Feu4Fe+rwouZsHxHoiq4eIyJk6kLAqzCA9sgjsCFmtCpYLihS4ZIdL97TeCzrzHJapgkFf4h15hMlpfOGz5+T8Ep9YM81O9rwud9fZURv3f.UUoSfSvvLBL99vqjIq4jLa9rIGRIznITRfW9yKP7+3wXlI1Kzg1gygiqYy7As5C8YhhMNv+aZcP.A5gJeZfqDWz7J+wEK740u1QAWWQJP2+2nJ5p+eeUzkQcyciAuY+b9lNxr9tx2U+WHn1mNSj9No.nCTkb.zYfG1rV4Jh5upwMDiE.Z.l3KG7J3mdwlIEVEK1LYQKuDSA9l9eKeOb6UwpOjfn4vPnjcnYHcLz+g.RPwveVP4TjGi98dpKOSf02VNCfRh7+8FUbNTL1sYxMl43zXqFVSgZUeumm3fvsAFtXc19ZnyctF5b2qgNex0Pm6cMz49WCc9sKUGQaB6LiSmpRRBSzaOUfk8doAVqZ8eY0VljD
SCRIPT:
Content.makeFrontInterface(1200, 700); //SAMPLER 1 FUNCTIONS const var Sampler1 = Synth.getSampler("Sampler1"); //Sampler 1 - Sample Start Knob inline function onSampleStartControl(component, value) { for(s in Sampler1.createSelection(".*")) { local l = parseInt(s.get(Sampler.SampleEnd)); s.set(Sampler.SampleStart, value * l); } }; Content.getComponent("SampleStart").setControlCallback(onSampleStartControl); //Sampler 1 - Sample End Knob inline function onSampleEndControl(component, value) { for(s in Sampler1.createSelection(".*")) { local l = parseInt(s.get(Sampler.SampleEnd)); s.set(Sampler.SampleEnd, value * 229376); } }; Content.getComponent("SampleEnd").setControlCallback(onSampleEndControl); //Sampler 1 - Loop Start Knob inline function onLoopStartControl(component, value) { for(a in Sampler1.createSelection(".*")) { local r = parseInt(a.get(Sampler.SampleEnd)); a.set(Sampler.LoopStart, value * r); } }; Content.getComponent("LoopStart").setControlCallback(onLoopStartControl); //Sampler 1 - Loop End Knob inline function onLoopEndControl(component, value) { for(s in Sampler1.createSelection(".*")) { local l = parseInt(s.get(Sampler.SampleEnd)); s.set(Sampler.LoopEnd, value * l); } }; Content.getComponent("LoopEnd").setControlCallback(onLoopEndControl); //Sampler 1 - Loop XFade Knob inline function onLoopXFadeControl(component, value) { for(s in Sampler1.createSelection(".*")) { local l = parseInt(s.get(Sampler.SampleEnd)); s.set(Sampler.LoopXFade, value * l); } }; Content.getComponent("LoopXFade").setControlCallback(onLoopXFadeControl); //Sampler 1 - Loop Enabled Button inline function onLoopButtonControl(component, value) { for(s in Sampler1.createSelection(".*")) { local l = parseInt(s.get(Sampler.SampleEnd)); s.set(Sampler1.LoopEnabled, value * l); } }; Content.getComponent("LoopButton").setControlCallback(onLoopButtonControl); //Call "wrong" Sampler for SampleMaps const var Sampler11 = Synth.getChildSynth("Sampler1"); //samplemaps const var sampleMaps = Sampler.getSampleMapList(); //combobox note: cmb = name of combobox const var Samplescmb = Content.getComponent("Samplescmb"); Samplescmb.set("items", sampleMaps.join("\n")); //Note: Sampler = name of Sampler inline function onSamplescmbControl(component, value) { Sampler1.loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("Samplescmb").setControlCallback(onSamplescmbControl);