HISE Logo Forum
    • Categories
    • Register
    • Login

    Expansion User Presets

    Scheduled Pinned Locked Moved C++ Development
    60 Posts 5 Posters 4.2k 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 d.healey

      I'm still tinkering with custom floating tiles. I'm exploring the expansion system.

      ExpansionHandler& exp = mc->getExpansionHandler();
      std::cout << "NUM EXPANSIONS: " << exp.getNumExpansions() << std::endl;
      

      The code compiles but always shows there are 0 expansions when it should show 1. Am I doing something wrong? And why are there almost no comments in your code :p How do you remember what everything does.

      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

        Most of the class / method names are pretty self-explanatory, if not then I can take a quick look at the implementation :)

        If this method returns 0 you have probably not called ExpansionHandler.createAvailableExpansions() which scans the folder and adds an expansion per folder.

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

          @Christoph-Hart I did call that function, but then I changed some code and removed it again, so I probably screwed something in the meantime :) I'll re-add that function call and try again, thanks!

          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

            Nope that didn't make a difference. Something fishy going on. This shows that it's definitely looking in the correct place and I checked and the test expansion folder is in there - I'm using the one from the example project (Backend Expansion Vol).

            std::cout << "EXPANSION FOLDER: " << handler.getExpansionFolder().getFullPathName() << std::endl;

            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

              Meh, I think I'll just stick with a customized preset browser. Seems simpler :)

              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

                Turns out I still need this functionality even with a custom preset browser, so I'm persevering!

                if (Helpers::isValidExpansion(f)) The ExpansionList isn't being populated because this function keeps returning false. Not sure why as it's finding the directory ok and I'm using the expansion from the example project. But I'll keep exploring.

                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

                  Aha, I found the problem HI_ENABLE_EXPANSION_EDITING!

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

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

                    How can I get the standard preset browser to display the presets of a specific expansion? I tried presetBrowser->loadPresetDatabase(file) then rebuilding but no luck.

                    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

                      HI_ENABLE_EXPANSION_EDITING

                      Ah that one, it's the gate-keeper so that "normal" plugins will not be cluttered with all this expansion stuff.

                      Alright, small homework assignment in C++ coming in...

                      You need to somehow redirect the folder that the user preset browser is "listening" to - just like most things in HISE (and JUCE) it follows the listener paradigm). In order to do so, you need to register the preset browser to the expansion handler to be notified when an expansion is changed and then rebuild the preset list:

                      1. Inherit the PresetBrowser class from hise::ExpansionHandler::Listener
                      2. Register it to the global ExpansionHandler in the constructor of the preset browser (and deregister it in the destructor)
                      3. overload expansionLoaded() and set the rootFile to the user preset directory of the currently loaded expansion (currentExpansion->getSubDirectory(FileHandlerBase::UserPresets) is your friend
                      4. Call rebuildAllUserPresets() to recreate the preset structure.

                      Disclaimer: I am not sure this is enough, but just from looking at the source code it might work.

                      Make sure that it compiles with the HI_ENABLE_EXPANSION_EDITING flag disabled (you will need to ifdef your additions).

                      The master class is to make this a property of the floating tile (with the default being deactivated) so that you can turn it on and off depending on whether you want it or not...

                      d.healeyD 1 Reply Last reply Reply Quote 2
                      • d.healeyD
                        d.healey @Christoph Hart
                        last edited by

                        @Christoph-Hart Thanks for the detailed explanation. I shall get to work!

                        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

                          @Christoph-Hart

                          It bloomin works!

                          The missing piece to get the preset browser columns to refresh properly

                          File cat = PresetBrowserColumn::getChildDirectory(rootFile, 2, 2);
                          File preset = PresetBrowserColumn::getChildDirectory(rootFile, 3, 3);
                          bankColumn->setNewRootDirectory(rootFile);
                          categoryColumn->setNewRootDirectory(cat);
                          presetColumn->setNewRootDirectory(preset);
                          

                          Tomorrow I will tackle the ifdef part and see if I can make this thing accessible through the scripting API so I can get back to my beloved HISEScript.

                          I'm thinking the HISE_ENABLE_EXPANSIONS flag would be more appropriate than the expansion editing one, but tell me if you think otherwise.

                          Peek 2019-09-13 01-38.gif

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

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

                            @d-healey said in Expansion User Presets:

                            and see if I can make this thing accessible through the scripting API so I can get back to my beloved HISEScript.

                            Well it turns out that was easy to do! But how do I get my new function to show up in the API collection in HISE?

                            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

                              I am using this batch script that runs doxygen over the scripting Cpp files and converts the XML output to a ValueTree that will be embedded into HISE.

                              It's only available for Windows (where I do the bulk of development) though

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

                                @Christoph-Hart Shall I make a pull request once I've finished tinkering and tested everything? Then it will be picked up next time you run your script.

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

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

                                  Seems that Engine.getExpansionList(); doesn't work if callbacks are deferred, what is the reason for this?

                                  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

                                    False alarm, it seems that it's just being weird and complaining sometimes when I open the project. If I can pin it down to something specific I shall let you know.

                                    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

                                      It might be possible that ExpansionHandler::createAvailableExpansions() is being executed after the deferred script execution.

                                      What you could do is to add some logging code to this function as well as to the script function wrapper around the getNumExpansion() function to see in which order they are executed and if this varies if the scripting callback is busy with a complex onInit function (btw, I saw you using std::cout, but the JUCE way for logging stuff is the DBG macro).

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

                                        @Christoph-Hart Ok cool, I'll run some tests.

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

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

                                          Do expansion sample maps need to be loaded in a special way?

                                          Inside my HISE project it seems to find them just fine but when I run the exported application I'm getting errors

                                          WARNING: Not found: {EXP::Kazbek}duduk_staccato.xml
                                          JUCE Assertion failure in ExternalFilePool.h:1124
                                          JUCE Assertion failure in ModulatorSamplerData.cpp:762
                                          

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

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

                                            @Christoph-Hart said in Expansion User Presets:

                                            It might be possible that ExpansionHandler::createAvailableExpansions() is being executed after the deferred script execution.

                                            I did some simple tests and it seems that everything is fine, I also haven't noticed the problem in my project happening again so I think it was some mistake I was making.

                                            Get list always seems to be called after create available :)

                                            CREATE AVAILABLE EXPANSIONS
                                            GET LIST OF EXPANSIONS
                                            GET LIST OF EXPANSIONS
                                            Resizing interface
                                            Change scale factor
                                            GET LIST OF EXPANSIONS
                                            

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

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

                                            14

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.6k

                                            Posts