HISE Logo Forum
    • Categories
    • Register
    • Login

    Populate samplemaps based on folder choice(almost working)

    Scheduled Pinned Locked Moved Scripting
    25 Posts 5 Posters 1.3k 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.
    • ten7kurT
      ten7kur
      last edited by

      @ten7kur said in Populate samplemaps based on folder choice(almost working):

      setMouseCallback

      I cant manage to find any example with viewports and clickEvents.
      Can you point to an example?

      LindonL ustkU 2 Replies Last reply Reply Quote 0
      • LindonL
        Lindon @ten7kur
        last edited by

        @ten7kur viewports dont have mouse call backs - only panels do - read the documentation:

        Link Preview Image
        HISE | Docs

        favicon

        (docs.hise.audio)

        HISE Development for hire.
        www.channelrobot.com

        1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @ten7kur
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • ten7kurT
            ten7kur
            last edited by

            So how come the SamplemapList viewport is not populating on Category viewport selection?
            Only populates on INIT.

            Im doing this in onCATControl

            if(items[value] == "A"){	    
            	    SamplemapList.set("items", "");
                    SMLdir_select = "Folder1/Sub-folderA";
            	    SamplemapList.set("items", formattedSamplemaps.join("\n"));
            
            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @ten7kur
              last edited by

              @ten7kur Have a look at the watchtable, the samplemaps names and start/end are looking weird...

              ten7kurT 1 Reply Last reply Reply Quote 0
              • ten7kurT
                ten7kur @ustk
                last edited by

                @ustk said in Populate samplemaps based on folder choice(almost working):

                @ten7kur Have a look at the watchtable, the samplemaps names and start/end are looking weird...

                Yea oops messed up along the way somewhere.
                This works, but still only populates on INIT.

                Im trying to send the SMLdir_select from onCATControl back through the script to show the new formatedSamplemaps.

                global SamplemapList = Content.getComponent("SamplemapList");
                
                const var Sampler = Synth.getSampler("Sampler");
                const var sampleMapList = Sampler.getSampleMapList();
                
                global SMLdir_select = "Folder1/Sub-folderA";;
                global formattedSamplemaps = [];
                
                global SMLdir_start = sampleMapList.indexOf(SMLdir_select + "/0");
                global SMLdir_end = sampleMapList.indexOf(SMLdir_select + "/zzz");
                
                
                    for (i = SMLdir_start+1; i < SMLdir_end; i++){
                    var newName = sampleMapList[i];
                    newName = newName.substring(10, 100);
                    formattedSamplemaps.push(newName);
                }
                SamplemapList.set("items", formattedSamplemaps.join("\n"));
                

                Would this solely have to be inside the onCATControl?


                I did this before. It works half way. It populates Samplemaplist based on CAT Item selected but its not clearing the SamplemapList viewport. So everytime i select a CAT Item it just adds and adds to the SampemapList.

                inline function onCATControl(component, value)
                {
                    var items = component.get("items").split("\n");
                	
                	if(items[value] == "A"){
                	    SMLdir_select = "Folder1/Sub-folderA";
                	    
                	    global SMLdir_start = sampleMapList.indexOf(SMLdir_select + "/0");
                            global SMLdir_end = sampleMapList.indexOf(SMLdir_select + "/zzz");
                
                    
                    for (i = SMLdir_start+1; i < SMLdir_end; i++){
                    global newName = sampleMapList[i];
                    newName = newName.substring(10, 100);
                    formattedSamplemaps.push(newName);
                }
                    }
                    else
                    if(items[value] == "B"){
                	    SMLdir_select = "Folder1/Sub-folderB";
                	    
                	    global SMLdir_start = sampleMapList.indexOf(SMLdir_select + "/0");
                            global SMLdir_end = sampleMapList.indexOf(SMLdir_select + "/zzz");
                
                    
                    for (i = SMLdir_start+1; i < SMLdir_end; i++){
                    global newName = sampleMapList[i];
                    newName = newName.substring(10, 100);
                    formattedSamplemaps.push(newName);
                }
                    }
                    //else
                            
                	//SamplemapList.set("items", "");	    
                	SamplemapList.set("items", formattedSamplemaps.join("\n"));
                      
                };
                Content.getComponent("CAT").setControlCallback(onCATControl);
                
                
                
                1 Reply Last reply Reply Quote 0
                • ten7kurT
                  ten7kur
                  last edited by

                  bump.
                  Anyone?

                  At least the simplest of question;
                  Why wont a viewport clear its items with:

                  Viewport.set("items", "");
                  

                  ??
                  Thanks

                  d.healeyD C 2 Replies Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @ten7kur
                    last edited by

                    @ten7kur said in Populate samplemaps based on folder choice(almost working):

                    bump.
                    Anyone?

                    At least the simplest of question;
                    Why wont a viewport clear its items with:

                    Viewport.set("items", "");
                    

                    ??
                    Thanks

                    I think it's a bug. i just did a simple test and you're right, it doesn't work.

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

                    ustkU ten7kurT 2 Replies Last reply Reply Quote 0
                    • C
                      coreyu21 @ten7kur
                      last edited by

                      @ten7kur possibly try to insert viewport.changed somewhere in the code to tell the component to initiate the callback and update item list. I believe I had the viewport updating not to long ago, just not in an if statement. Might not work, just trying to help🙂

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

                        @d-healey Apparently, you need to have at least something as a workaround,
                        like Viewport.set("items", "-"); or Viewport.set("items", "Select a category");

                        I think .isNotEmpty() is the cause:

                        void ScriptingApi::Content::ScriptedViewport::setScriptObjectPropertyWithChangeMessage(const Identifier &id, var newValue, NotificationType notifyEditor /* = sendNotification */)
                        {
                        	if (id == getIdFor(Items))
                        	{
                        		jassert(isCorrectlyInitialised(Items));
                        
                        		if (newValue.toString().isNotEmpty())
                        		{
                        			currentItems = StringArray::fromLines(newValue.toString());
                        		}
                        	}
                        
                        	ScriptComponent::setScriptObjectPropertyWithChangeMessage(id, newValue, notifyEditor);
                        }
                        

                        I'll try to remove it...

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

                          @coreyu21 said in Populate samplemaps based on folder choice(almost working):

                          possibly try to insert viewport.changed somewhere in the code to tell the component to initiate the callback and update item list

                          Tried it but no luck..
                          I looked in the API, found "changed()" but it seems like it exists for all components Besides the Viewport..

                          @ustk said in Populate samplemaps based on folder choice(almost working):

                          I'll try to remove it...

                          🙏 🙏

                          ustkU 1 Reply Last reply Reply Quote 0
                          • ustkU
                            ustk @ten7kur
                            last edited by

                            It works by commenting out the .isNotEmpty() condition
                            @d-healey I'll make a pull request to your fork in a moment if you want this fix of course...
                            The fact is that I don't know if it can involve a wrong behavior somewhere else in Hise, so, be warned if you use it!

                            1 Reply Last reply Reply Quote 0
                            • ustkU
                              ustk
                              last edited by

                              @d-healey What branch should I use in your fork? The develop seems more recent than the scriptnode one...

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

                                @ustk yeah the develop one

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

                                1 Reply Last reply Reply Quote 1
                                • ten7kurT
                                  ten7kur
                                  last edited by ten7kur

                                  ☺
                                  @ustk You're a beast! for goin nitty gritty!
                                  Wish i could be more code efficient!..not yet!

                                  ustkU 1 Reply Last reply Reply Quote 1
                                  • ustkU
                                    ustk @ten7kur
                                    last edited by

                                    @ten7kur It's pushed on Dave's repo, you can compile it and test ;)
                                    https://github.com/davidhealey/HISE/tree/develop

                                    ten7kurT 1 Reply Last reply Reply Quote 1
                                    • ten7kurT
                                      ten7kur @ustk
                                      last edited by

                                      @ustk said in Populate samplemaps based on folder choice(almost working):

                                      @ten7kur It's pushed on Dave's repo, you can compile it and test ;)
                                      https://github.com/davidhealey/HISE/tree/develop

                                      Awesome stuff! Just compiled and tested it!
                                      Thanks so much for taking your time to fix this!!👑

                                      Hopefully now i can finish my script

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

                                      24

                                      Online

                                      1.7k

                                      Users

                                      11.8k

                                      Topics

                                      102.5k

                                      Posts