HISE Logo Forum
    • Categories
    • Register
    • Login

    Multi Sampler Enabled Buttons

    Scheduled Pinned Locked Moved General Questions
    buttonscallbackssamplers
    4 Posts 2 Posters 302 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.
    • trillbillyT
      trillbilly
      last edited by

      Hey Gang,

      I've got 4 samplers in the Strings section, each with a power button on the UI. Im using another power button on UI to be a "Master Power" for that section.

      I've got the Individual power buttons working just fine. However, the Master Power button will turn off the buttons on the UI but not actually turn off the samplers. Can anyone see what Im doing wrong?

      //SECTION POWER BLACKOUTS
      //Strings
      const var Blackoutimg1 = Content.getComponent("Blackoutimg1");
      
      inline function onSectionPowerbtn1Control(component, value)
      {
      	Blackoutimg1.showControl(value);
      	Content.getComponent("Powerbtn0").setValue(!value);
      	Content.getComponent("Powerbtn1").setValue(!value);
      	Content.getComponent("Powerbtn2").setValue(!value);
      	Content.getComponent("Powerbtn3").setValue(!value);
      	
      
      	
      };
      
      Content.getComponent("SectionPowerbtn1").setControlCallback(onSectionPowerbtn1Control);
      
      Matt_SFM 1 Reply Last reply Reply Quote 0
      • Matt_SFM
        Matt_SF @trillbilly
        last edited by

        @trillbilly

        const var Blackoutimg1 = Content.getComponent("Blackoutimg1");
        
        // better use an array
        const grpBtn = [Content.getComponent("Powerbtn0"),
        		Content.getComponent("Powerbtn1"),
        		Content.getComponent("Powerbtn2"),
        		Content.getComponent("Powerbtn3")];
        
        inline function onSectionPowerbtn1Control(component, value)
        {
        	Blackoutimg1.showControl(value);
        	
        	// better use a for... loop
        	for(b in grpBtn)
        	{
        	    // call this function to change 
                    //the value of the buttons
                    b.setValue(!value);
        
        	    // call this function to trigger their callbacks 
                    //and actually turn off the samplers
        	    b.changed();
        	}
        };
        
        Content.getComponent("SectionPowerbtn1").setControlCallback(onSectionPowerbtn1Control);
        

        Develop branch
        Win10 & VS17 / Ventura & Xcode 14. 3

        trillbillyT 2 Replies Last reply Reply Quote 3
        • trillbillyT
          trillbilly @Matt_SF
          last edited by

          @Matt_SF Ahhhh, great, thank you!

          1 Reply Last reply Reply Quote 0
          • trillbillyT
            trillbilly @Matt_SF
            last edited by trillbilly

            @Matt_SF So now that this is implemented and I save a preset, the preset always turns the buttons back on no matter if it was off when saved. I do have "Save In Preset" parameter turned ON for each power button. Any idea what may be going on?

            I have a feeling that the preset saves correctly but this "Master Sectional Power" button triggers after the preset is loaded? I think that makes sense.

            EDIT: Im a little thrown off by "UserPresetHander.presetCallback"

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

            16

            Online

            1.7k

            Users

            11.8k

            Topics

            102.4k

            Posts