HISE Logo Forum
    • Categories
    • Register
    • Login

    How to make it

    Scheduled Pinned Locked Moved General Questions
    16 Posts 4 Posters 871 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.
    • pluginboiP
      pluginboi @Jay
      last edited by

      @Jay Do you have different sub Preset folders set up in your Userpreset project folder? and then edit this line to be the names of each folder

      var presetFolders = ["Factory", "User"];  // update this with your actual folder names
      
      
      JayJ 3 Replies Last reply Reply Quote 0
      • JayJ
        Jay @pluginboi
        last edited by

        @pluginboi Thanks a lot.

        Joansi Villalona

        1 Reply Last reply Reply Quote 1
        • JayJ
          Jay @pluginboi
          last edited by

          @pluginboi what to add, to make it show the selected preset on a label?

          Joansi Villalona

          1 Reply Last reply Reply Quote 0
          • JayJ
            Jay @Jay
            last edited by

            @Jay I figure it out

            Joansi Villalona

            1 Reply Last reply Reply Quote 0
            • JayJ
              Jay @pluginboi
              last edited by

              @pluginboi I was wondering if you know how to save a preset to a file because I'm using this and is not working

              inline function onsaveOkControl(component, value)
              {
              Engine.saveUserPreset(presetNametoSave);
              };
              Content.getComponent("saveOk").setControlCallback(onsaveOkControl);

              any idea why?

              Thanks in advance!!!

              Joansi Villalona

              pluginboiP 1 Reply Last reply Reply Quote 0
              • pluginboiP
                pluginboi @Jay
                last edited by pluginboi

                @Jay this is how i save them to the 'user' sub folder but you could get rid of the child folder to make it general. I found this in an old thread I think @Dan-Korneff posted about out so he may have more info if you're doing more customization

                var pre_folder = FileSystem.getFolder(FileSystem.UserPresets).getChildFile("User");
                	
                	function save(file)
                	{
                	    Engine.saveUserPreset(file);
                	}
                
                
                //// Save as Button
                inline function onSaveasBTNControl(component, value)
                	{
                	if (value)
                	    	
                	 FileSystem.browse(pre_folder, true, "*.preset", save);   
                	 
                	 PresetHandler.init();
                	 populatePanel1(); 
                	          
                	 UpdatePresetLabel();    	  
                	};
                	
                Content.getComponent("SaveasBTN").setControlCallback(onSaveasBTNControl);
                
                
                JayJ 1 Reply Last reply Reply Quote 0
                • JayJ
                  Jay @pluginboi
                  last edited by

                  @pluginboi T h a n k Y o u

                  Joansi Villalona

                  1 Reply Last reply Reply Quote 0
                  • JayJ
                    Jay
                    last edited by

                    @pluginboi

                    This is always showing one preset name behind it. Do you think you can help me with this?
                    note: it's doing it in both examples

                    namespace UserPresetWidgets
                    {
                    	inline function createPresetButton(name, x, y, up)
                    	{
                    		local widget = Content.addPanel(name, x, y);
                        
                    		Content.setPropertiesFromJSON(name, {
                    		"width": 10,
                    		"height": 15,
                    		"saveInPreset": false,
                    		"allowCallbacks": "Clicks & Hover"
                    		});
                        
                    		widget.data.up = up;
                        
                    		widget.setPaintRoutine(function(g)
                    		{
                    			g.setColour(this.data.hover ? 0xFF65B17c : 0xFF2C4433);
                    			g.fillTriangle([0, 0, this.getWidth(), this.getHeight()], this.data.up ? Math.PI/2 : 1.5 * Math.PI);
                    		});
                        
                    		widget.setMouseCallback(function(event)
                    		{
                    			this.data.hover = event.hover;
                        	
                    			if(event.clicked)
                    			{
                    				if(this.data.up)
                    				{
                    					convoLbl1.set("text", Engine.getCurrentUserPresetName());
                    					Engine.loadNextUserPreset(true);
                    				}
                    				else
                    				{
                    					convoLbl1.set("text", Engine.getCurrentUserPresetName());
                    					Engine.loadPreviousUserPreset(true);
                    				}
                    			}
                    			this.repaint();
                    		});
                    		return widget;
                    	};
                    }
                    
                    const var UpButton = UserPresetWidgets.createPresetButton("UpButton", 749, 10, true);
                    const var DownButton = UserPresetWidgets.createPresetButton("DownButton", 736, 10, false);
                    
                    
                    
                    
                    
                    // ============== second attemp
                    
                    // next
                    inline function onnextBtnControl(component, value)
                    {
                    	convoLbl1.set("text", Engine.getCurrentUserPresetName());
                    	Engine.loadNextUserPreset(true);
                    };
                    Content.getComponent("nextBtn").setControlCallback(onnextBtnControl);
                    
                    // prev
                    inline function onprevBtnControl(component, value)
                    {
                    	convoLbl1.set("text", Engine.getCurrentUserPresetName());
                    	Engine.loadPreviousUserPreset(true);
                    };
                    Content.getComponent("prevBtn").setControlCallback(onprevBtnControl);
                    

                    Joansi Villalona

                    ulrikU 1 Reply Last reply Reply Quote 0
                    • ulrikU
                      ulrik @Jay
                      last edited by

                      @Jay You have to load the preset first, then get the name, you have it the other way around

                      if(this.data.up)
                      				{
                      					//	First load the preset
                      					Engine.loadNextUserPreset(true);
                      					//	Then get the loaded preset name
                      					convoLbl1.set("text", Engine.getCurrentUserPresetName());
                      				}
                      

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

                      JayJ 1 Reply Last reply Reply Quote 0
                      • JayJ
                        Jay @ulrik
                        last edited by

                        @ulrik Thank you so much, you're right

                        Joansi Villalona

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

                        31

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.3k

                        Posts