HISE Logo Forum
    • Categories
    • Register
    • Login

    Factory Preset Creator

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    45 Posts 3 Posters 10.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by

      The namespace idea is good. The problem with storing the attributes of the MIDI processors is there are a lot of MIDI processors in some of my instruments, if there was a way to iterate through all of the attributes of each MIDI processor then that would be practical as it could then easily be automated in a loop but currently I'd have to do it manually for each processor and it would vary between projects.

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        Well, you can just create arrays with values that have the same length as the MIDI processor has attributes and go crazy with for loops:

        HiseSnippet 1137.3oc0X0kaaaDDdojXSDSUPSQO.D5IYDWYRQEmebMrMciMbS8OnJvn.FFoTjKsVDpcEVtzotA9fj25Qnu1iPetWjdCZmkjxjThRPxHFnl.ZA2YluY+1YmYAGcBm4hCCYbjxid6UivHkuTs2UTwfcG3PnnC9djxiUOzITf45IhruZjSXH1ConTceo.k50PwO+yV1NANTWblHD5TFwE+ijgDQlzeY62PBB1ywC+VxvbV2c6CbYzcYArHfOUUMPibbeuyE3ibjlUQEcIA+gPjhgpUm172a1+21o8DO6GM.F8A4WdgUWlmEFlhbi3bLUbJ.Gonp7uvih5q8HBFumvQfAeV0l4cUuArOPSV5SIgj9AX4DSTOfSIhQ6NfD3cx3vVHBoT6jrfX0jf32ndHwibi7rf4WEqPOCQ9voRkhTpVAJYNKJsGKvS5fYPup4nWsD58D0dtbxHQlFI295ToyfcIJQU9iZpvoTnP+RGttOgGJ1QeS8yLZarptQaS4Pmy2ng1DFYmXzKk5egb34RixaVHFd2aZmIGrJ5wDSm1kxg0mzu6IWdvz3751WfEENaZ0LVeyUJr.8hWf4.JwfXT4fYGIDLpbKrKiJfLt1NddIBa0LUYyU06.6NSiU1Pas0zO6G5c7QiAdt1XbgX4oyHLWPvg6wYCklk2GergltdyPmKwGPOgiA6a9JcemfP7pwZ3NdD19bVzHPdSylMztNcAWqvJVB+smG+sg01b8YrArWvMf8msMfMrA7intBBipynGwD3iosVQ6iZ00tdJM99koRRYNKH.yKSq7NJ9bf0hFMrOluJD.Chvw1Q7SEpu4liCzqzPqNrkqW2GReHPD1XCch92kVA0N.SuPL.D8zmJsLwz5wolxP4NBAmzORfaQVMExYjyg3Q85WCVVheSqllgiSRemxyofx6Z4OLbnLO5au7z2dgnu8sg9YtFXObjAWAV7dUsE6dU2jL4bFxnGPIhiGguYdR91XIFnaxyxKJK+Juz37pRLKSzzWliRqtf2Vza0efZ7oPoWkapnlq3+MTV+hU9RIsZJGg5U4MxPXcB.clEhNw2SzoTPVyBjE.xpS5J8+tx5xxkdzmmbIi65bo4+QBY4UJUSgBuIhSqdbZZUu.hGliHfS9BU4gEJNxj+i8PK.1GDisSAv+9m9zet0hC1ZRv+0VKb4vCUSt6nz5A+655gmYdKpGLJuHp6r.0E.0c86SEQZ2SJhlagSs6mENKL3tE.usk0eWVUGzfCyKJvQTrqGYmhoJfDjBEeGHCfgDwU46jbIZExnzVgLK6vZAo6STOgHbGTNeqTBegS+6Z9l1XYC0W66icEYjsl5d+7ssKxkfJ+DKRPnWbnC74V+JzC8QQC6Aso6hAlPovGHJ6qthLSNYtgbtLxzCS8LF2zcpRS4bkTkliUhF53xYuyMIgT155Cik.bhF+G.TW8P4bcywYhRdOD5K6cttx.w2BLubDcVZDVKMhtKMhmszHVeoQ77kFwKlCBYSv6DIXCSJKPn+C..59Q1
        
        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by

          Thanks for the code example. I think though that this still requires that I know in advance how many attributes each script processor has and I need to keep track of these manually. If we could do a for loop type thing to iterate over an arbitrary number of attributes then a few lines of code could handle any number of scripts with any number of attributes and the values of the attributes could be saved automatically into the user preset. Maybe I'm looking at this the wrong way though, I'll play around some more with your script example.

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            You need to know the number of attributes anyway when you create the preset data, or am I missing the point?

            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by d.healey

              Yes currently I would need to know the number of attributes, but if we had a function that could give us the number of attributes for a script then I could do something like this.

              for (s in scripts)
              {
              	for (i = 0; i < s.numAttributes; i++)
              	{
              		presetData[i] = s.getAttribute(i);
              	}
              }
              

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                Ah yes, that makes sense (I thought you're creating those by hand, but for this approach, you'll need a getNumAttributes() method). I'll add this tomorrow.

                1 Reply Last reply Reply Quote 1
                • d.healeyD
                  d.healey
                  last edited by

                  Thanks Christoph, should be very useful :)

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey
                    last edited by d.healey

                    Could this getNumAttributes() function also work for other modules such as effects, modulators, and envelopes too?

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart
                      last edited by

                      Yes of course...

                      1 Reply Last reply Reply Quote 1
                      • Christoph HartC
                        Christoph Hart
                        last edited by

                        Alright, the changes are pushed to the repository.

                        1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey
                          last edited by

                          Excellent, building now!

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey
                            last edited by

                            Seems to work perfectly, this is awesome. I'll be putting together a namespace version of this preset script soon which should be much more reliable and easier to use. Thanks again!

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            1 Reply Last reply Reply Quote 1
                            • Christoph HartC
                              Christoph Hart
                              last edited by

                              I noticed one caveat with this method: if you are restoring custom scripts by iterating over all attributes, it will ignore the saveInPreset property (so everything gets restored). This is because the index is just the order of declaration and if I skip non-saveInPreset parameters, there would be a mismatch between those numbers which will cause all types of problems.

                              However the saveInPreset property just makes sense on the main interface script anyway so it shouldn't be too much of a restriction.

                              Also note that you can only use float numbers in the method setAttribute(value). And if your module has a table or a sliderpack that needs to be restored, you're also out of luck and need to go back to exportState / restoreState.

                              BTW, the current implementation of restoreState for scripted modules loads the stored script and recompiles it. I could add another function (eg. restoreContent) which doesn't recompile things, but only restore the values of the preexisting script interface (which is much more lightweight and not causing issues with multithread locking).

                              1 Reply Last reply Reply Quote 1
                              • d.healeyD
                                d.healey
                                last edited by

                                That would be very helpful and sounds like a very good companion function for the others we have.

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                1 Reply Last reply Reply Quote 0
                                • Christoph HartC
                                  Christoph Hart
                                  last edited by

                                  Done. I've called them exportScriptControls / restoreScriptControls so that it's pretty clear that this works only for script modules.

                                  1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey
                                    last edited by

                                    Brilliant, I'll add these to my new script now and it should be good to go...

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey
                                      last edited by d.healey

                                      What other styleData do we have available for the preset browser? Is it possible to scale the window contents so if I make the preset browser smaller the text becomes smaller too?

                                      Libre Wave - Freedom respecting instruments and effects
                                      My Patreon - HISE tutorials
                                      YouTube Channel - Public HISE tutorials

                                      1 Reply Last reply Reply Quote 0
                                      • Christoph HartC
                                        Christoph Hart
                                        last edited by

                                        Not yet, but the idea is to make this as flexible as needed. Currently you can only set the text / icon colour and the background colour:

                                        Content.makeFrontInterface(600, 500);
                                        
                                          const var PresetBrowserTile = Content.addFloatingTile("PresetBrowserTile", 3, 2);
                                          
                                          // [JSON PresetBrowserTile]
                                          Content.setPropertiesFromJSON("PresetBrowserTile", {
                                            "width": 550,
                                            "height": 349,
                                            "parentComponent": "BrowsePanel"
                                          });
                                          // [/JSON PresetBrowserTile]
                                          
                                          const var presetBrowserData = 
                                          {
                                              "Type": "PresetBrowser",
                                              "ColourData":
                                              {
                                                  "bgColour": "0xFF111111",
                                                  "itemColour1": "0xFFBBE9FF"
                                              }
                                          };
                                          
                                          PresetBrowserTile.setContentData(presetBrowserData);
                                        

                                        But the system is pretty extendable without too much effort, so anything that makes sense and is requested can be added (eg. font type, font colour, etc).

                                        1 Reply Last reply Reply Quote 1
                                        • d.healeyD
                                          d.healey
                                          last edited by

                                          This is the size I need the preset browser to be to fit on my interface but as you can see it doesn't fit nicely. I'd like to be able to change the font size, or just rescale the whole interface.

                                          0_1501704493894_Capture.PNG

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

                                          1 Reply Last reply Reply Quote 0
                                          • Christoph HartC
                                            Christoph Hart
                                            last edited by

                                            Wow, that's a real small interface - all projects I am working on correctly have at least something like 1000 x 700 px...

                                            I could add a font size property to the preset browser (along with a font name since this might also be subject of customization).

                                            However you can also choose to put the preset browser over the virtual keyboard which gives you additional 72px of preset browsing (remember, the old layout with the topbar and the fixed keyboard on the bottom is gone and you can put those pieces together as you like).

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            47

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.9k

                                            Posts