• 2D array... What am I doing wrong?

    6
    0 Votes
    6 Posts
    812 Views
    d.healeyD

    @dustbro Here's a full paging system that will work with any number of pages and it's only 31 lines including comments.

    HiseSnippet 1219.3ocsWs0aaaCElxIJsVadnEX+.HJ1C1Hco1YsYCHKnN14xL5RhvbZ2.JJBnknrIhLoAEUpMJBv9mr+J6mTGvdYOscnDkkThyEGfom7gmaemK7vickBOZTjPhrpd5rITj0WZ2eFWMp6HBii5sGx5w1tRZDUg5LaBIJh5irrV4PMWqpqhR997q6PBIbOZ9QHz6DLO5OyFyT4m519MrvvCH9zSYiKH8Ka2ySv6JBEw.RVwtIZBw6bxP5wDsXUrQVqsuOSIj8UDEMBjoiveV+QhOxSk+crH1fPplnEpOXnziQcGwB8cyhxHDxZU27XdkzX9qsOh4yleddr+jDF3bMJlCrpTFRqVBRstIHcfHzWafa.dVEf2pov6o188jrIpbNZr8E183JpLf.o8hvJUVTk+ZE6tBPBtZiwjyoGHAh4ZTeqlMeN9UMa1X6ZN0bfjejBeAQhO9sGcl6tGtee7N3M2F+hWb5HJlGOd.UhEA3IPMIBOSDiGQtfpUEjPfifz.EXxogQXB2GOHVo.aVzxFt6fe+G1t34FQyXns3gTEVMpjA0NN2pABItNCTo41XF9GyQMPt95Mp47oZNX3K0.um8APzrjwPppqX7DAGHp+LWsDOaclNOn0v3haSkAJtKflEpzFQZQ4JoHrKILb.zEW2He2NMz4ycihXC4XOCWbPL2SwDbrRXriykoYA27P95hWygwCYbZt9ycScuT.7bH8FFSyyF4IVF2mNUWO0DFWv3EnfjtTRlgqmVFFZToQpgBE.dLFYmLM1Hg9jfL2mkbx78Ow7oXHLR6gRO8NqiZgLnuT8biH3dlIQWOfDFQarchTWV1o5qi34wPbDiOrbLqCg.oXLlRjgLprbeilcYeojwZWc47ztferPQOgWugymbp5boyU4DDrHVF6ERkKhqd5n7VTqd5MxrJrQNXfQ4IRqc+lH4k1lWPPAuGmoNYB0PmOyp0BlYgL2SzCWM.DDUkL65IlYWv8mAhNhoHludzUFYKTRDT7cCzUMwWYLQmjZVhApZmRrLp2ODZ.kIp+H62vECdf91w1bSq4U0+yuF81d6QTD8XbSNAxSSnRESWNr1idA7lX5P8p16QiNWIljjzLCWfRVpeqkMxW2Hl3V3YX8uahll6vuo8rhDej4qFgrrs9GfbDkMbjRS82.kUkq6i6rzLs3C24d5O+01iIS0VVSMgHAiVv5yAJpvg12iRYA2sUA28660994iGcGotVOrT2EYWZfW7st4PZAsWEbWuh4u92X.0pT.s18oGLoP7GPonP7bXaEcpwpvXuVHIwmINTJhmjcG9ZosayKsJ4EaKF3iRdXyq4gHX8fdbyliPpCc80ZfkqD9wgDU4MtzqVZX.y7JsZid8EdDSMq3ctkXMrlKbMrENR6dB2mZ6xTdiVLdqr.7puJ9+LdMK0Vyd+f.pmJGrqZevu8P2fcIfxuHhUv6rGQTRltu433w8g858n.R352U0sPUzCaSoalMJoOk6mP7uvmgYKMskgYqLlnwDOo3LylF50lebxI.l3I+igp1Goowymwqw8XXW9y77zIhuEP9h0XykViuao03kKsFuZo0XqkViueo03GtEMz+wociUhwoWKfCb2O4sQKq84DnqJoCD8e5FL6VC
  • Print array index

    19
    0 Votes
    19 Posts
    2k Views
    Christoph HartC

    Good to know ;)

  • Celtic Harp

    7
    2 Votes
    7 Posts
    804 Views
    Dan KorneffD

    oops! That worked :)

  • getValueNormalized()

    2
    0 Votes
    2 Posts
    357 Views
    Christoph HartC

    It works for Knobs:

    const var Knob1 = Content.getComponent("Knob1"); Knob1.setRange(-12, 1, 0.1); Knob1.set("saveInPreset", false); Knob1.setValue(-2.0); Console.print("Range: " + Knob1.getValue()); // -2 Console.print("Normalized: " + Knob1.getValueNormalized()); // 0.33

    Haven't checked the other controls :)

  • setPropertiesFromJSON()

    2
    0 Votes
    2 Posts
    469 Views
    Christoph HartC

    I think it's a mistake in the API doc - it's created automatically by using the inheritance hierarchy of the C++ classes and this one might slipped in to the wrong place. Content.setPropertiesFromJSON() is definitely the go-to option.

    However, the missing link might be a method like Control.getName() so you can call it without having to store the String name somewhere.

  • Slider middle position formula

    1
    0 Votes
    1 Posts
    352 Views
    No one has replied
  • Can somebody help clear a couple of things up for me?

    9
    1 Votes
    9 Posts
    1k Views
    d.healeyD

    @cuttybang Sampler settings >> voice settings might do it.

    0_1534113677163_Screenshot from 2018-08-12 23-41-04.png

  • panel.changed() recursion

    5
    0 Votes
    5 Posts
    783 Views
    d.healeyD

    @christoph-hart Going to build now :)

  • playNoteWithStartOffset

    21
    0 Votes
    21 Posts
    3k Views
    Christoph HartC

    Well, you waited long enough :)

  • Copy entire UI

    7
    0 Votes
    7 Posts
    861 Views
    staiffS

    yes you can also doing that

    copying in an external text file permit you to not opening the 1rst project each time you want to copy something; But only in the case you re-use a lot the same interface script. If just re-using it 1 time your solution is better

  • Floating tile edge of plugin

    3
    0 Votes
    3 Posts
    742 Views
    JayJ

    @christoph-hart said in Floating tile edge of plugin:

    HiseSnippet 797.3ocsUs0aSCCE1tsFw5XHFZ7dTepSZLktaf.gnqcqnJnaUzoIda3431XsD6HGmUJSS7yh+V7O.rykkVV1zBRjmx4x2474yE6gRAgFFJj.3xmLKfBfOAMZFW410Ey3f9G.fOEM.GpnRqDUclEfCCoN.Hr5GLJfKUCD+8q22A6g4DZtJ.3TAiP+Dymox0901ej440C6POg4Om26ztOQv6J7DQZ9TEYCBvjKvSnGgMtUAAtjQmFBf1ns2ZS4EsN+66u4e8MniqV23E0CHQRIkqNUCG.Qveq+fnCcXJgbjBqn5XVsivY1HWwTdRpOkExN2iZDZAFo4ThZPWWlmyvrxVH..qMLuHVMoHtFZ.ygci97h4yhMXkiX9xIrxhTp1BTp0cQodBOGS.tC5Amid0Rn2pnQDIKPkawvskQ84597XrtCNOsR7ET4XHpqP6AWsoO9BZOoV3FDM2y1dCqcssW+sqTek559Xnx5RrzJAcOOAVw3SNg4QaY8Nqr.Mgp5J7CDbsPyFE3aij3UfkMCMXiCyAXEt4UMLGtFuwpwPIUaqiTLMjJabsIBii3DESvsD7iDJ5w7lqW+p5KU+5aYY73hLYRjT34QkEY0LFKuGXM4Q9mSkanKHdQzL+zsiE62O5g0uIIG54bTv6yYpiCnox4SDsJXh.jV0LyFoDT6pJdx34oSFTGytRfPp.LGynQlXKP7YX9U7r3oyQ.UpXzvjHm1V0mqGbr+lY6DoC4LyOqo+YJyQ4FK.A.WJahqxH8SPw4XMzsmThyxKJvPZ9.Y4CjmurS2r1Y4LUS6ezFb6EJ8ZsvIxCqVbW2b+XpA87vBKUlEGdHSMa96OKwE.1EdAPgs6GHcWEMjoHtEy2JEvWcG3+MeSuNcEzgiGSIpbxVC06K+q2cVBp7YQjYXY.VIYlYkih7GoebhP0LgyodglwlJlUfDY6rwnQTtic1SMoFaYjgoFakYD3iIRwYjjEQypyii0n4DO9Yukzu+pkstYyyvae8qHmQHlBwK0LuXDaUZDaWZD6TZD6VZD6UZDupzHd88fv7j89QJgexZA.7GHt97oC

    after running this snippet my preview got really small

  • Enter data address in item (combobox)

    8
    0 Votes
    8 Posts
    2k Views
    JayJ

    @dark-boubou It doesn't load anything

  • set ComboBox index

    3
    0 Votes
    3 Posts
    687 Views
    Christoph HartC

    Yes, that is correct. Be aware that the value starts with 1 (so in order to set it to the first item, call setValue(1);). Zero is reserved for no entry.

    If you use the combobox for a control that's supposed to be stored in a preset (aka saveInPreset = true), you don't need to explicitely call this, just make sure you save the patch with the right value.

  • How can I add effects to a childsynths in script?

    1
    0 Votes
    1 Posts
    725 Views
    No one has replied
  • MPE

    10
    0 Votes
    10 Posts
    2k Views
    A

    @christoph-hart if you have a chance play with equator, as on some presets with lots of release you will be able to hear it. (Alternatively just fire up your favourite midi monitor utility).

    Would be good to confirm this behaviour, as your unit may be newer than mine. (Assuming it's hardware related- silent refresh etc)

  • Make an Array

    6
    0 Votes
    6 Posts
    941 Views
    ulrikU

    @christoph-hart Ok, I think I understand a little bit, I will try to follow your suggestions. Thanks a lot!

  • onControl nested functions?

    6
    0 Votes
    6 Posts
    965 Views
    ulrikU

    @christoph-hart This works beautiful, I even made a compliment to this using 5 leds that lights up for each button, however I than had to make the ledStates with 5 columns instead of 4, and use:
    "for(i = 0; i <5; i++)
    {
    Lamps[i].setValue(!value == 1 - lampStates[index][i]);
    }
    and it works fine.

    Now to another question, I have 3 different states of the keyboard as well, and I want to set them with the same buttons as the samplers (I have key switches on some keys with coloured keys, and I want to show them and also the key range for that instrument, only in one of the buttons states.
    Is there some tutorial or document around that I can study for this matter?

  • Design patterns

    6
    0 Votes
    6 Posts
    1k Views
    d.healeyD

    For my current project I've settled on the following design (which is kind of a modular view-model controller approach).

    I have the "main" file which is a thin controller that brings the other files together and handles the callbacks. It also has a project wide namespace that all of the other files can access.

    Then I have a bunch of smaller files each with its own namespace. I have a manifest file which is basically a large JSON object that holds various info for all of the different presets (in my case each preset is a different orchestral instrument with its own set of articulations, keyswitches, key ranges, etc.).

    The next file is the theme file which holds all of the styling information for the UI. Having this in one file allows me to apply a different look to the whole UI by editing a single file.

    Then I have a paintRoutines file which holds all of the various panel paint routines and SVG data - There are no images on my interface, it's all vectors.

    The next file is the preset handler. The functions in here take the current preset name, look up the data for the preset in the Manifest file and applies the correct settings, loads sample maps etc.

    Then I have the bulk of the scripts which is spread over six files. I have a header with all of its controls at the top of the UI, and a footer with all of its controls at the bottom of the UI. The next 3 files are for the main parts of the UI, an articulation handler, a mixer, and a CC handler. The last file is for a settings window. Each of these six files sets up its own view (GUI) and assigns callbacks for the controls, this is why I call them view-models. Some of them also have functions that can be called in the controller's onNote and onController callbacks.

    Now although this seems like a lot of code the majority of those files have less than 100 lines and there is probably less than 1000 lines in total. I've chosen this approach because having a lot of specific files with a small amount of code in each allows me to very easily track down bugs, maintain my code, and reuse the code in other projects.

  • Getting the processor ID in a control callback

    1
    1 Votes
    1 Posts
    378 Views
    No one has replied
  • how to make a simple note hold toggle?

    11
    0 Votes
    11 Posts
    2k Views
    Christoph HartC

    Of course you can use it in the function itself, just be cautious that you don't create cyclic references by doing something stupid :)

    This parameter gets incredibly handy when you use one callback function for multiple controls:

    const var buttons = []; for(i = 0; i < 128; i++) { buttons.push(Content.getComponent("button" + i); } inline function printMyIndex(component, value) { local index = buttons.indexOf(component); Console.print("You clicked button " + index); }; for(b in buttons) b.setControlCallback(printMyIndex);

    I've been using this paradigm in literally every project I am working on since it heavily reduces boilerplate code. Although it comes with a slight performance overhead because it needs to look up the index in the array, so if it's a time critical function, better code it manually...

44

Online

1.7k

Users

11.7k

Topics

101.6k

Posts