HISE Logo Forum
    • Categories
    • Register
    • Login

    Run Script In Expansion

    Scheduled Pinned Locked Moved Scripting
    42 Posts 4 Posters 1.8k 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.
    • CasmatC
      Casmat
      last edited by

      Hey!

      To set up expansions when importing, I want to run a script in my expansions AdditionalSourceCode folder, how would I implement this? Is there a way that I can get the expansion name from the .hr1 files that are being imported so that I can navigate to the script in the source code folder? Or am I thinking about this all wrong..

      Thanks!

      i make music

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

        @Casmat

        Or am I thinking about this all wrong..

        Maybe, what's the overall goal?

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

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

          @d-healey really, I just want to import an expansion into the plugin, when this happens, I want it to update files in the UserPresets folder by making folders/adding preset files in the correct location. I also want it to update my samplemap browser by adding records into an object, there may also be expansions that require some extra code to configure ui elements and placement of files

          i make music

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

            @Casmat Have you tried using the built in expansion installer?

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

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

              @d-healey I've so far tried a button callback which locates the .hr1 file and runs the ExpansionHandler.installExpansionFromPackage()

              i make music

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

                @Casmat Yup that's the way to go, depending on what you want to achieve you may want to show a file browser when the button is clicked so the user can choose the hr file. When the hr extracts it will automatically install the files in the correct place including the presets. The sample maps are embedded within the hxi file.

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

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

                  @d-healey My preset browser is based on a custom file structure in the user presets folder and thered be subfolders that I'd need to manually add to the user presets folder, right? or will it just create the subfolders if there are none and add presets if there are none? And yeah forgot to mention the file browser part too. how would I call a script in the expansion though? Do i use includes()?

                  i make music

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

                    @Casmat

                    I'd need to manually add to the user presets folder, right? or will it just create the subfolders if there are none and add presets

                    No idea, see what happens with the expansion installer. If it doesn't do what you want then we can work on it.

                    And yeah forgot to mention the file browser part too. how would I call a script in the expansion though? Do i use includes()?

                    You don't need to call it from the expansion. You're calling it from your player/installer in order to install the expansion.

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

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

                      @d-healey huh, could you give me an example?

                      i make music

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

                        @Casmat

                        I assume you have a button in your player called something like btnInstallExpansion

                        When the user clicks this button you show a file browser and allow them to select the hr file.

                        Now that you have the file you can call the installExpansionFromPackage function

                        Once the expansion has been installed you can call Expansion.rebuildUserPresets() although I'm not sure if this is necessary.

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

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

                          @d-healey got you! But I’m also trying to do some other things with the main plugin for each expansion, for example my samplemap swapping. Basically, I have three samplers and for each sampler, you can mix and match samplemaps from all the expansions the user has. I’ve made this browser for each sampler that lets you select samplemaps with two viewports, one viewport for tags and categories (All, Pad, Chord, Pluck) and the second (with a label to search the viewport) for seeing the available samplemaps and selecting them to change the samplemap for that layer. To accomplish this, I’ve set made an object which has multiple objects inside (these are the tags and categories). In those objects, I’ve put in an object for each samplemap entry. So this object system acts as a file system where the objects are kind of the directories. (Is this a good system, first thing to come in mind to try, but I feel like there may be a better one) Basically, each expansion I add would come with a set amount of samplemaps and there would need to be a script which pushes the samplemap objects into the main object if that makes any sense. To do this, wouldn’t I need to somehow run the script after installing from the hr1 package?

                          i make music

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

                            @Casmat I'm not sure it's possible to load sample maps from multiple expansions since only one expansion can be loaded at a time.

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

                            CasmatC LindonL 2 Replies Last reply Reply Quote 0
                            • CasmatC
                              Casmat @d.healey
                              last edited by

                              @d-healey Ohhhhhh noooo… that’s a major problem for me, since the plugin is heavily reliant on being able to mix and match said samplemaps, is there a workaround to this or a fix I can make?

                              i make music

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

                                @Casmat Try it first, because I could be wrong. I haven't used regular expansions for quite a while.

                                But if it doesn't work I think the solution would be to include all the sample maps in the main plugin. There might be another solution but I can't think of one at the moment.

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

                                CasmatC 2 Replies Last reply Reply Quote 0
                                • CasmatC
                                  Casmat @d.healey
                                  last edited by

                                  @d-healey yeah, just tried it, the samplemap from the other expansion when the sampler is clicked on turns pink/purple and no sound is outputted, don’t know what it means though

                                  i make music

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

                                    @d-healey yeah, hopefully the samples aren’t tied to it as well.. so id need to make a script which copies the samplemap in the expansion and put it into the main samplemap folder?

                                    i make music

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

                                      @d-healey said in Run Script In Expansion:

                                      @Casmat I'm not sure it's possible to load sample maps from multiple expansions since only one expansion can be loaded at a time.

                                      Yes you can - just refer to the expansion in the load - you can combine any sample map from any expansion with any other...

                                      HISE Development for hire.
                                      www.channelrobot.com

                                      LindonL 1 Reply Last reply Reply Quote 0
                                      • LindonL
                                        Lindon @Lindon
                                        last edited by Lindon

                                        Ok so how I handle expansions;

                                        1. std expansion folder structure
                                        2. Samples all get put into the AppData LinkFile location
                                          2.a All expansion presets get put in the User Presets folder
                                        3. A custom piece of json that ships with each expansion - read by the plugin on init - that says the name of the sample map - and which expansion its in (as well as some sound tags for a tag-based browser - but that's entirely optional.
                                        4. when the user selects a sound from the browser - look up its expansion and load it...
                                        TheSamplers[pos].loadSampleMap("{EXP::" + vox.VoiceLocation +"}" + vox.VoiceMapName);
                                        

                                        All of this is installed using a simple set of zip files - so I dont use the "std" expansion hxi system at all...

                                        HISE Development for hire.
                                        www.channelrobot.com

                                        Christoph HartC CasmatC 2 Replies Last reply Reply Quote 1
                                        • Christoph HartC
                                          Christoph Hart @Lindon
                                          last edited by

                                          Yes you can - just refer to the expansion in the load - you can combine any sample map from any expansion with any other...

                                          This is only true if you're using regular expansions - if you're running in Full Instrument Expansion mode, then the expansions become encapsulated entities that can't load content from other expansions.

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

                                            @Casmat

                                            and put it into the main samplemap folder

                                            There is no sample map folder for compiled projects. The sample maps are embedded in the binary or the expansions. Lindon's solution is the way to go.

                                            You can simplify it a little bit though by using the getWildcardReference function.

                                            bb7b45b4-51b7-4b38-a5c9-72b6f63ec6fb-image.png

                                            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

                                            39

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.2k

                                            Posts