HISE Logo Forum
    • Categories
    • Register
    • Login

    Viewport

    Scheduled Pinned Locked Moved Scripting
    73 Posts 9 Posters 7.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.
    • M
      mwplugs @Christoph Hart
      last edited by

      @Christoph-Hart the object created "sorted" does contain the proper data but there is no reference as to how to split to cats and maps into arrays to be used the viewports. ive looked at every post and reply in the whole forum with the words samplemaps and also viewports. there is one involving parsing characters from BD ludwig etc and displaying by filtering names but it is not relevant. i cannot get the data in the object into a list or array for it to be used in vp

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

        @mwplugs You don't need arrays, you have an object ;)

        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

          This turns the object into a flat key list:

          const var obj = {}; // some object
          
          const var keyArray = [];
          
          for(k in obj)
              keyArray.push(k);
          

          Put the keyArray into the left viewport, and set the items on the right viewport by fetching the instrument list from the obj using the value of the left callback. In the right callback, assemble the samplemap name from the two viewports and load it in the sampler.

          M 1 Reply Last reply Reply Quote 0
          • M
            mwplugs @Christoph Hart
            last edited by

            @Christoph-Hart Line 10, column 37: Unknown function 'join'

            const var s = Synth.getSampler("MySampler");
            const var list = Sampler.getSampleMapList();
            const var Viewport1 = Content.getComponent("Viewport1");
            Viewport1.set("useList", true);
            Viewport1.set("items", list.join("\n"));
            const var Viewport2 = Content.getComponent("Viewport2");
            Viewport2.set("useList", true);
            Viewport2.set("items", keyArray.join("\n"));
            
            
            inline function loadSampleFromViewport(component, value)
            {
                s.loadSampleMap(list[value]);
            }
            
            Viewport1.setControlCallback(loadSampleFromViewport);
            
            inline function createTwoLevelHierarchy()
            {
                local allList = Sampler.getSampleMapList();
                local obj = {};
                
                for(id in allList)
                {
                    local tokens = id.split("/");
                    local key = tokens[0];
                    local value = tokens[1];
                    
                    if(obj[key])
                        obj[key].push(value);
                    else
                        obj[key] = [value];
                }
                
                return obj;
            }
            
            const var sorted = createTwoLevelHierarchy();
            
            const var obj = {}; // some object
            
            const var keyArray = [];
            
            for(k in obj)
                keyArray.push(k);
            
            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by

              You've called your sampler variable s, not Sampler.

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

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

                @d-healey fixed that. still says the same thing

                Content.makeFrontInterface(1024, 768);
                
                
                
                const var Sampler = Synth.getSampler("MySampler");
                const var list = Sampler.getSampleMapList();
                const var Viewport1 = Content.getComponent("Viewport1");
                Viewport1.set("useList", true);
                Viewport1.set("items", list.join("\n"));
                const var Viewport2 = Content.getComponent("Viewport2");
                Viewport2.set("useList", true);
                Viewport2.set("items", keyArray.join("\n"));
                
                inline function loadSampleFromViewport(component, value)
                {
                    Sampler.loadSampleMap(list[value]);
                }
                
                Viewport1.setControlCallback(loadSampleFromViewport);
                
                inline function createTwoLevelHierarchy()
                {
                    local allList = Sampler.getSampleMapList();
                    local obj = {};
                    
                    for(id in allList)
                    {
                        local tokens = id.split("/");
                        local key = tokens[0];
                        local value = tokens[1];
                        
                        if(obj[key])
                            obj[key].push(value);
                        else
                            obj[key] = [value];
                    }
                    
                    return obj;
                }
                
                const var sorted = createTwoLevelHierarchy();
                
                const var obj = {}; // some object
                
                const var keyArray = [];
                
                for(k in obj)
                    keyArray.push(k);
                

                and with the code as is the keyArray is only [] there is no data in it

                M 1 Reply Last reply Reply Quote 0
                • M
                  mwplugs @mwplugs
                  last edited by

                  @mwplugs said in Viewport:

                  keyArray.join("\n"));

                  no matter what i do this never works. keyArray.join("\n")); whatever i try to replace list with

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

                    Probably not a good idea to call your sampler variable Sampler, as that is a class used by HISE.

                    keyArray.join("\n")); will never work, you have too many closed parenthesis.

                    Edit: I just realised you copied that from a larger function call, so it will be fine.

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

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

                      @d-healey this was taken from @Christoph-Hart example codeabove mar 19

                      const var s = Synth.getSampler("MySampler");
                      const var list = Sampler.getSampleMapList();
                      const var Viewport1 = Content.getComponent("Viewport1");
                      Viewport1.set("useList", true);
                      Viewport1.set("items", list.join("\n"));
                      
                      inline function loadSampleFromViewport(component, value)
                      {
                          s.loadSampleMap(list[value]);
                      }
                      
                      Viewport1.setControlCallback(loadSampleFromViewport);
                      
                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @mwplugs
                        last edited by

                        @mwplugs Oh I see now.

                        Do you have a sampler called MySampler and a viewport called Viewport1 in your project? And does you project contain at least 1 sample map?

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

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

                          @d-healey there are 18 as of now and yes there are Viewport1 and i just changed the sampler to Voice1

                          changed code to match

                          Content.makeFrontInterface(1024, 768);
                          
                          const var Voice1 = Synth.getSampler("Voice1");
                          const var list = Voice1.getSampleMapList();
                          const var Viewport1 = Content.getComponent("Viewport1");
                          Viewport1.set("useList", true);
                          Viewport1.set("items", list.join("\n"));
                          const var Viewport2 = Content.getComponent("Viewport2");
                          Viewport2.set("useList", true);
                          Viewport2.set("items", keyArray.join("\n"));
                          
                          inline function loadSampleFromViewport(component, value)
                          {
                              Voice1.loadSampleMap(list[value]);
                          }
                          
                          Viewport1.setControlCallback(loadSampleFromViewport);
                          
                          inline function createTwoLevelHierarchy()
                          {
                              local allList = Voice1.getSampleMapList();
                              local obj = {};
                              
                              for(id in allList)
                              {
                                  local tokens = id.split("/");
                                  local key = tokens[0];
                                  local value = tokens[1];
                                  
                                  if(obj[key])
                                      obj[key].push(value);
                                  else
                                      obj[key] = [value];
                              }
                              
                              return obj;
                          }
                          
                          const var sorted = createTwoLevelHierarchy();
                          
                          const var obj = {}; // some object
                          
                          const var keyArray = [];
                          
                          for(k in obj)
                              keyArray.push(k);
                          
                          1 Reply Last reply Reply Quote 0
                          • M
                            mwplugs
                            last edited by

                            we are attempting to take categories (subfolders) of samplemaps on left veiwport (viewport2) and the right viewport (viewport1) display the samplemaps in that category and make them loadable.

                            the sorted object is throwing out the right data in the watcher

                            {
                              "Brass": [
                                "FreshHornStaccato"
                              ],
                              "Guitar": [
                                "AcousticCampfire"
                              ],
                              "Keys": [
                                "DeepFuzzVibe",
                                "HorrorPianoFuzz"
                              ],
                              "Piano": [
                                "CloudyJazzPno",
                                "GoldenPiano",
                                "RustyPiano"
                              ],
                              "Strings": [
                                "ChamberTremelo",
                                "ChamberViolinPizz",
                                "ChamberViolinSpiccati",
                                "ChamberViolinTremble",
                                "MidMedSoloString",
                                "MovieStringStacc",
                                "SoloViolinLeg",
                                "ViolinPizz1",
                                "ViolinStaccato",
                                "ViolinStaccatoB"
                              ],
                              "Vox": [
                                "WhooMaleVox"
                              ]
                            }
                            
                            

                            however the keyArray is simply spitting out []

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

                              Try this

                              HiseSnippet 924.3ocsV01iSaDDdctXDwsWUQp+.rtOkS55ImVfVUDp2kjKGoPNhvWSqDBg1a8Dx1Xuq050G3Cw+Y9GPm0qSbB0ffH07oLOyK9YFO6y5oJICxxjJhSmKKRAhy25FVHzKFrfxEjwCINem6DZlFT9Vn9EozrLHh33r24F.mNsIk+d+u2mFSELnFhPlI4L3I7DttFc5IOlGGOhFAWxS1H56dxXlTLPFKyQ9rma.IkxVReEbA0DVKWhysNKhqkpPMUCYXL8kQEgKjuVXieFOieULXL5QBwBYgICVviiltpWyHDm1Sq678rc9O3NgGwWiWOA99RG90Yr4Lvo01Tp8VTp2mhRijwQlB7InmyFzqskd2wMjo3o5ZOFt8MtiE3Km4TbruIsrwRZcxdtCjXDB8wIzkvHEZrNit2OH3H+6EDb3C12aeOb3mo8ulp7kW8O9Oz+sd99GzWg07fey+4nAZNRAYKdjTIv9kwnZ4AH9KNxD444bMUUG5oLYdllyFPSRmyUPcjOFJ1njCAHcT9M2LieEbvQVL7InjpobpPZbUmZITctCvcknh+fdyMSQ3pjO2LaE1HqfdFxjBKx5REpUbwq1fH3a7jq.0kJHAhWmZE5LtLliEEISSNBS4lwAuQmlJh6.q7gaSSfHytfkBqwkWyAKT4zcEtIRagdBrN3Z9zaan0uXZDsec+OS9l5d+uVHkSnwfAzDg269nUhkPwoJEs.2Kd9Kdfm2bop6RetvrqbXYMVEwwo4YK5tzrSYf22CW.yjwvwoXmo6pUlMuUAenc0yadtfo4RrbhKjZ3ohtG58VuNduyy+icMedi9Lq4JYbLnZzsQpQ84RrqH27F6Hraiyg0Ahm+19.9s9xNfyrm51HPoXrfqeZJTYWKAzqAI.R0wV7e+43gTM0nJTggwkBJM2PGmgv0nDqUini6PHaoVlhhr+GADTFSFkGiKAaosYDwqbfyisDQLBEhLttXSQ9uBAufFE7Zra+Bo6cbmx0rEMy2VMvWbp8+Meqt9Xe2ylOGX5Zx11czeuq2U7UPkmIy0njwDJpb7Fhi6E4Ig3MnL.YhP.w3Cx0okYixZGXrMSlPPDUZ7A7WkydFamJm8V4jjPYJ4KY1SJlKntcIBxIQ4cycvOR.s86QJO8f44Fbb.IAu27kLlYT7iH2aNmeZGx4m2gbt6Njy81gbt+NjyurC47qe1bLexxo4ZYh8XBBL8rRYDGmyDTbKqbij7ufXii6F
                              

                              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

                                Oh, there's your problem

                                const var obj = {}; // some object
                                
                                const var keyArray = [];
                                
                                for(k in obj)
                                    keyArray.push(k);
                                

                                You are declaring an empty object which you are using in the for loop. So the output will be empty.

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

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

                                  @d-healey im assuming its supposed to be pulling from the sorted object. so do i replace the word object with sorted?

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

                                    Yeah, if that's what you want it to do. And you can delete the other keyarray stuff.

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

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mwplugs
                                      last edited by

                                      ok now the keyArray has the categories. but when i changed the line:

                                      Viewport2.set("items", list.join("\n"));
                                      

                                      to

                                      Viewport2.set("items", keyArray.join("\n"));
                                      

                                      it says
                                      Line 10, column 37: Unknown function 'join'

                                      like usual

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

                                        @mwplugs What does keyArray contain?

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

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

                                          @d-healey ```
                                          [
                                          "Brass",
                                          "Guitar",
                                          "Keys",
                                          "Piano",
                                          "Strings",
                                          "Vox"
                                          ]

                                          M 1 Reply Last reply Reply Quote 0
                                          • M
                                            mwplugs @mwplugs
                                            last edited by

                                            @mwplugs as desired it shows the categories

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

                                            14

                                            Online

                                            1.7k

                                            Users

                                            11.9k

                                            Topics

                                            103.4k

                                            Posts