Work in progress :-)
Posts
-
RE: Preparing for HISE 2.0
#define FEATUREREQUESTMODE_H_ bool syncedOscilators = true; #endif
-
RE: AAX dosen't recognized in Pro tools 2018
Is it AAX 64? ProTools 2018 does only 64 Bit AAX.
-
RE: Add/Remove "Sound Generators" at runtime using scripting
@christoph-hart: Your assumption is right and thank you for the offer. I think we can work something out here (which works constructive in both directions), i'll contact you as soon as i get back to the office.
-
RE: Get name of attribute
I'm trying to get a list of all available attributes from a processor (in this case a waveform generator). Trying to build a custom user control that dynamically builds up a display of all available configuration parameters. So it would be nice if i could query a processor and tell it to give me all its attributes with name and current value. :)
So in an ideal world i would like to be able to do something like this:
var attributeCount = WaveformGenerator1.getNumAttributes(); for(var attributeIndex=0; attributeIndex < attributeCount; attributeIndex++){ Console.print("Name: " + WaveformGenerator1.getAttributeName(attributeIndex)); Console.print("Value: " + WaveformGenerator1.getAttribute(attributeIndex)); }
But, as i don't have a way to get the attribute name, i run the following code:
var attributeCount = WaveformGenerator1.getNumAttributes(); for(var attributeIndex=0; attributeIndex < attributeCount; attributeIndex++){ Console.print(WaveformGenerator1.getAttribute(attributeIndex)); }
And it outputs:
Interface: 0.25 Interface: 0 Interface: 256 Interface: 20 Interface: 5 Interface: 2 Interface: 0 Interface: 0 Interface: 0 Interface: 3 Interface: 0 Interface: 0 Interface: 0.5 Interface: 1 Interface: 0.5 Interface: 0.5
So getNumAttributes() return 16, and as you can see i can get the values of all 16 attributes. But which parameter index is which knob in the UI? I have been able to get this list of parameters from the Waveform Generator C++ source:
parameterNames.add("OctaveTranspose1"); parameterNames.add("WaveForm1"); parameterNames.add("Detune1"); parameterNames.add("Pan1"); parameterNames.add("OctaveTranspose2"); parameterNames.add("WaveForm2"); parameterNames.add("Detune2"); parameterNames.add("Pan2"); parameterNames.add("Mix"); parameterNames.add("EnableSecondOscillator"); parameterNames.add("PulseWidth1"); parameterNames.add("PulseWidth2");
But those are only 12 parameters, and i found out that the first parameter in this list is Index 4 in the list of Attributes which i see in Javascript. So what are those 4 preceding attributes? That's why i think a method like getAttributeName(int attributeIndex) that returns something like "OctaveTranspose1" would be very handy :)
Ps. sorry for my noobish questions, second day of HISE programming ;)
-
RE: New operator support in Javascript engine?
So i have been reading the "best practices" guide. I like the namespacing concept, but those are just static objects for as far as i understand and mainly have the purpose of reducing code clutter. At some point, in the code i'm planning to write, I need some sort of object instantiation to prevent duplicate code and that things getting really messy (me = chairman at the federation of pizza lovers against duplicate code).
I need to simulate an LCD display on a scripting panel, and therefore I would like to write a few "classes" that mimic certain "on-screen" display controls like ADSR graphs and other visual elements that you'll normally find in settings pages of traditional 90's rack synthesizer units. I would like to be able to re-use these virtual controls code wise. No fast refresh rates are needed and i'm planning to buffer certain areas so that the painting routines are doing minimal as possible.
So in my first attempt to work Object Oriented in HISE "Javascript" without using the new operator I came up with the following structure to mimic the behaviour of Classes:
function MyClass(options){ /* Store constructor argument in private property */ this.options = options; return { otherFunction: function(){ Console.print("Console print from other function"); }, foo: function(){ /* Calling other function in class, just for illustration */ this.otherFunction(); /* Example on how to access properties of the options object */ Console.print(options.rect.top); Console.print(options.enabled ? "true" : "false"); }, printRectTop: function(){ Console.print(options.rect.top); } } } /* Construct first object */ var object1 = MyClass({ enabled: false, rect: { top: 500 }, }); /* Call method on first object, which works as expected */ object1.printRectTop(); /* outputs 500 */ /* Construct second object, and set alternative top value */ var object2 = MyClass({ enabled: false, rect: { top: 1000 }, }); /* Call method on second object, which also works as expected */ object2.printRectTop(); /* outputs 1000 */ /* Call method on first object again, which will now outputs 1000 which is not as expected */ object1.printRectTop(); /* outputs 1000 */
As you can see this clearly does not work, the first object was mutated. So I came up with another solution, which does work:
function ObjectManager(){ this.objects = []; return { construct: function(options){ var instance = {}; instance.options = options; instance.otherMethod = function(){ Console.print("Other method on class, just for illustration.."); }; objects.push(instance); return instance; } } } /* Construct first object and call method, works like expected */ var object1 = ObjectManager().construct({rect: {top: 500}}); Console.print(object1.options.rect.top); /* 500 */ /* Construct second object and call method, works like expected */ var object2 = ObjectManager().construct({rect: {top: 1000}}); Console.print(object2.options.rect.top); /* 1000 */ /* Call method again on first object, works like expected because the value of its property is unchanged */ Console.print(object1.options.rect.top); /* 500 */
It compiles and works for as far as i can see. I don't know how this will impact performance, still needs to measure it and compare it to some other writing styles. I'm just posting it here, so it maybe can help other users, or even to illustrate how to not write your code. Just experimenting how far I can go with the HISE "Javascript" engine, if performance gets in the way I'll probably need to switch to the C++ API and hope that allows me to implement custom painting routines for the UI.