HISE Logo Forum
    • Categories
    • Register
    • Login

    How to get rid rid of {EXP::...}

    Scheduled Pinned Locked Moved General Questions
    13 Posts 3 Posters 362 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.
    • ?
      A Former User
      last edited by

      I have an array full of SampleMaps from expansions... looks somewhat like this:

      [
          "{EXP::LIGHTER}UB_TH_ACM_KITCHEN GLITCH",
          "{EXP::LIGHTER}Lighter",
          "{EXP::LIGHTER}GIO_TEXTURES",
          "{EXP::LIGHTER}Ghosts in the Machines"
        ]
      

      Now I want my viewport to show the names of the SampleMap only, without the {EXP::...LIGHTER} in front of it... How do I do that? Probably a little for loop... but what to put in there? Thanks for any advice on this!

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @A Former User
        last edited by ustk

        @UrsBollhalder

        var myString = "{EXP::LIGHTER}UB_TH_ACM_KITCHEN GLITCH";
        myString = myString.replace("{EXP::LIGHTER}", "");
        

        Can't help pressing F5 in the forum...

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @ustk
          last edited by

          @ustk Thanks!!! Now. I've been fiddling around but can't figure out how to do that with the whole array?! I am trying something like this but obviously it doesn't work:

          
              inline function loadSampleFromViewport(component, value)
              {
                 var name = expSampleMaps[value].join("\n"); // this is an array of 4 names... and not a string...
                 name = name.replace("{EXP::LIGHTER}", ""); 
                 
                 ViewportsExp[1].set("items", name.join("\n"));  
              }
              
              ViewportsExp[0].setControlCallback(loadSampleFromViewport);
          
          ustkU 1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @A Former User
            last edited by

            @UrsBollhalder
            I can't test right now, but try this:

            inline function loadSampleFromViewport(component, value)
            {
                for (n in name)
                    n.replace("{EXP::LIGHTER}", ""); 
                   
                ViewportsExp[1].set("items", name.join("\n"));  
            }
                
            ViewportsExp[0].setControlCallback(loadSampleFromViewport);
            

            Can't help pressing F5 in the forum...

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @ustk
              last edited by

              @ustk Awesome! Thanks so much. I’ll give it a go and can do some more digging if necessary!! 🙏💪🥳

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

                How are you populating the array initially?

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

                ? 1 Reply Last reply Reply Quote 0
                • ?
                  A Former User @d.healey
                  last edited by

                  @d-healey said in How to get rid rid of {EXP::...}:

                  How are you populating the array initially?

                  for(e in expHandler.getExpansionList()){
                              expansionNames.push(e.getProperties().Name);
                              expSampleMaps.push(e.getSampleMapList()); 
                          }
                  

                  Like this.

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

                    @UrsBollhalder Good :)

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

                    ? 2 Replies Last reply Reply Quote 0
                    • ?
                      A Former User @d.healey
                      last edited by

                      @d-healey said in How to get rid rid of {EXP::...}:

                      @UrsBollhalder Good :)

                      :grinning_face_with_sweat:

                      1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User @d.healey
                        last edited by A Former User

                        @d-healey @ustk Maybe not the most elegant, but it works... couldn't make the replace function working! So I split....

                            const var ViewportsExp = [Content.getComponent("vwpExp"),
                                                  Content.getComponent("vwpSampleMaps")];
                        
                        
                            ViewportsExp[0].set("useList", true);
                            ViewportsExp[1].set("useList", true);
                            ViewportsExp[0].set("items", expansionNames.join("\n"));
                            
                            const var namesExp = [];
                            
                            inline function loadSampleFromViewport(component, value)
                            {
                               namesExp.clear();
                               var name = expSampleMaps[value]; 
                            
                               for (n in name){
                                   
                                   var sp = n.split("}");          
                                   namesExp.push(sp[1]);
                               }
                              
                               ViewportsExp[1].set("items", namesExp.join("\n"));  
                            }
                            
                            ViewportsExp[0].setControlCallback(loadSampleFromViewport);
                        
                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @A Former User
                          last edited by

                          @UrsBollhalder Yeah replace won't work unless all of the sample maps are from the same expansion. You could also use substring().

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

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

                            @d-healey @UrsBollhalder I don't know very much expansions, but I thought there was a way to get the expansion name like:

                            n.replace("{EXP::" + getExpansionName() + "}", ""); 
                            

                            Can't help pressing F5 in the forum...

                            ? 1 Reply Last reply Reply Quote 1
                            • ?
                              A Former User @ustk
                              last edited by

                              @ustk That looks rather solid as well tbh! 🤔

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

                              18

                              Online

                              1.8k

                              Users

                              12.0k

                              Topics

                              104.3k

                              Posts