@d-healey Thanks! this is great but it still has the same issue, it doesn't get to 100% each time, is there no way to normalise this and have each sample make the bar hit 100% once it's finished loading?
Posts
-
RE: Loading Bar
-
Loading Bar
Hi! Just wondering if anyone knows of a way to make a loading bar function within a set range, say 0 - 1 whilst say a sample is loading in to the VST, is this even possible?
i've seen some set to timers and built one of those myself, but when i link it up to the loading callback it just counts until the file is finished loading, giving me values of 60 or 140% complete.
Here's my code if anyone's interested :)
//PROGRESS PANEL const var pnlProgress = Content.getComponent("pnlProgress"); pnlProgress.setValue(0); //PAINT ROUTINE pnlProgress.setPaintRoutine(function(g) { g.fillAll(C); var a = [this.getWidth() / 2 - 400 / 2, this.getHeight() / 2 - 20 / 2, 400, 20]; g.setColour(0x005995C9); g.fillRoundedRectangle(a, 5); var v = this.getValue() / 10; g.setColour(Colours.white); g.fillRoundedRectangle([a[0], a[1], a[2] * v , a[3]], 5); v < 0.1 ? g.setColour(Colours.transparentWhite) : g.setColour(Colours.black); g.drawAlignedText(v * 100 + "%", a, "centred"); }); var preloading; pnlProgress.setTimerCallback(function() { var v = (this.getValueNormalized()+1); Console.print(v); this.setValue(v); this.repaint(); }); pnlProgress.setLoadingCallback(function(isPreloading) { if(isPreloading ){ preloading = 1; Console.print(preloading); pnlProgress.startTimer(200); }else{ preloading = 0; Console.print(preloading); pnlProgress.setValue(0); pnlProgress.stopTimer(); } });
Please help!
-
RE: Keyboard to display only active keys?
@Christoph-Hart @d-healey This is what we went with in the end! thanks for all your help guys i really appreciate it :)
-
RE: Keyboard to display only active keys?
@d-healey Hi!
Thanks for all your help so far, here's how i think i understand this.
{ for (i = 0; i < 128; i++) { if (i >=40 && i <=95) Engine.setKeyColour(i, Colours.withAlpha(Colours.white, 0.0)); else Engine.setKeyColour(i, Colours.withAlpha(Colours.black, 0.4)); } }
The for loop iterates through the set 128 note numbers.
For each note it's checking if it falls between the range i set of 40 - 95 it then calls the engine.setKeyColour() function, and makes them white, or in this case, transparent as i've set the value to 0.0, so, normal key colour.
If the note doesn't fall within my set range, it's coloured transparent black?
I've tried this in my project and it works!
I need to figure out how to get this to work with the different samplemaps within my combo box still.
-
RE: Keyboard to display only active keys?
@d-healey Thanks for replying, wow that's a lot of code, i've brough it in to a blank project to try understand your script and go through it with my friend, and i'm getting this error;
Master Chain:! Line 55, column 6: Can't declare var statement in inline function {SW50ZXJmYWNlfG9uSW5pdCgpfDE1ODB8NTV8Ng==}
Is this a problem on my end?
-
RE: Keyboard to display only active keys?
@d-healey This is what my friend came back with, he has extensive experience with coding languages but obviously not with hise.
I'm not as well versed as you are with this program, i'm still trying to learn and figure this stuff out as i go. -
RE: Keyboard to display only active keys?
Hi! i've been trying to work on this all day with my friend and i'm not sure where i'm going wrong.
The console is saying getLayerContainer - function not found, and i can't seem to find a replacement for this in the API, am i just working with outdated information and need to learn the new functions? or is it not possible to do what i'm trying to do like this anymore? please help!Content.makeFrontInterface(670,400); //Declarations const var layer; const var numSamples; const var sample; const var rootKey; //Sampler const var GoatScream = Synth.getChildSynth("GoatScream"); const var goatsampler = GoatScream.asSampler(); goatsampler.enableRoundRobin(false); //Sample maps array const var sampleMaps = Sampler.getSampleMapList(); const var cmbSampleMap = Content.getComponent("cmbSampleMap"); //Combo box cmbSampleMap.set("items", sampleMaps.join("\n")); inline function oncmbSampleMapControl(component, value) { //Console.print(value); GoatScream.asSampler().loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("cmbSampleMap").setControlCallback(oncmbSampleMapControl); const var notes = []; // Loop through each layer in the sample map for (var i = 0; i < cmbSampleMap.getLayerContainer().getNumLayers(); i++) { layer = cmbSampleMap.getLayerContainer().getLayer(i); numSamples = layer.getNumSamples(); // Loop through each sample in the layer for (var j = 0; j < numSamples; j++) { sample = layer.getSample(j); if (sample != null) { // Get the root key of the sample rootKey = sample.getRootKey(); // Set the key color of the note to 0x22ffffff cmbSampleMap.setKeyColor(rootKey, 0x22ffffff); // Add the root key to the notes array notes.push(rootKey); } else { // Set the key color of the null sample to 0x88000000 cmbSampleMap.setKeyColor(j, 0x88000000); } } } // Print the notes array to the console Console.print(notes); Synth.addToFront(true);
-
RE: Keyboard to display only active keys?
@d-healey Ah okay, Thanks for your help i'll see if i can figure this out :)
-
RE: Keyboard to display only active keys?
@d-healey I have several different Sample Maps that have several different key ranges, i just realised i followed your tutorial to learn how to switch between these! Hi! haha.
-
RE: Keyboard to display only active keys?
@d-healey Sure!
This is pretty broke as im new to this and have had to find bits from all over the internet here.
Content.makeFrontInterface(670,400); //Sampler const var Sampler1 = Synth.getChildSynth("Sampler1"); const var thesampler = Sampler1.asSampler(); thesampler.enableRoundRobin(false); //Sample maps array const var sampleMaps = Sampler.getSampleMapList(); const var cmbSampleMap = Content.getComponent("cmbSampleMap"); //Combo box cmbSampleMap.set("items", sampleMaps.join("\n")); //AquireKeys const var map = sampler.LoadSampleMap(); const var noteRange = map.getNoteRange(); const var firstKey = Engine.getKeyForNoteNumber(noteRange.getStart()); const var lastKey = Engine.getKeyForNoteNumber(noteRange.getEnd()); for (i = firstKey; i <= lastKey; i++) { if (map.getKeyForNoteNumber(Engine.getNoteNumberForMidiPitch(i)) != -1) { if (Engine.getNoteNumberForMidiPitch(i) < 50) Engine.setKeyColour(i, 0x88000000); else if (Engine.getNoteNumberForMidiPitch(i) < 90) Engine.setKeyColour(i, 0x22ffffff); else Engine.setKeyColour(i, 0x88000000); } } inline function oncmbSampleMapControl(component, value) { //Console.print(value); Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("cmbSampleMap").setControlCallback(oncmbSampleMapControl); Synth.addToFront(true);
-
RE: Keyboard to display only active keys?
@Christoph-Hart @d-healey I can't seem to make this work using a callback, i think i'm missing some vital functions/have old information, could you offer an example of how this would work please?
-
RE: Keyboard to display only active keys?
@Christoph-Hart Awesome, thanks guys i'll give this a go!
-
Keyboard to display only active keys?
Hi! i'm new here and learning how to use this awesome software!
I'm just wondering if there's a way i can get the keyboard to only show the active keys on a sampler?
For instance;
I have a sampler than only has a one octave range, i would only want it to show that one octave on the keyboard? the rest could be greyed out or simply not shown?Thanks for your time :)