HISE Logo Forum
    • Categories
    • Register
    • Login

    How to change gain with a button in a sampler script

    Scheduled Pinned Locked Moved General Questions
    4 Posts 2 Posters 402 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.
    • lijas90L
      lijas90
      last edited by

      Hi, does anyone know how I can modify the gain of a Gain when pressing a button? I tried with

      Engine.setAttribute(sampler.Gain, -6);
      

      but it doesn’t work. Thanks.

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @lijas90
        last edited by

        @lijas90 said in How to change gain with a button in a sampler script:

        Hi, does anyone know how I can modify the gain of a Gain when pressing a button? I tried with

        Engine.setAttribute(sampler.Gain, -6);
        

        but it doesn’t work. Thanks.

        you need to set an attribute on the sampler itself - not Engine, so the best way to manage Gain in any "sound generating" back end processor (sampler, synth, loop player etc.) is to add a a simple gain to the FX section, then get a reference to it and set the gain there like this:

        const var VoiceGain1 = Synth.getEffect("VoiceGain1");
        
        // now set it in a call back....
        
        inline function onVoiceGainControl(component, value)
        {
               VoiceGain1.setAttribute(VoiceGain1.Gain, value);
        };
        
        

        can I recommend you to start with Dave's scripting course(s)

        HISE Development for hire.
        www.channelrobot.com

        lijas90L 1 Reply Last reply Reply Quote 1
        • lijas90L
          lijas90 @Lindon
          last edited by

          @Lindon said in How to change gain with a button in a sampler script:

          VoiceGain1.setAttribute(VoiceGain1.Gain, value);

          It works! Thank you so much.😊

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @lijas90
            last edited by

            @lijas90 said in How to change gain with a button in a sampler script:

            @Lindon said in How to change gain with a button in a sampler script:

            VoiceGain1.setAttribute(VoiceGain1.Gain, value);

            It works! Thank you so much.😊

            ..do the course.

            HISE Development for hire.
            www.channelrobot.com

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

            36

            Online

            2.0k

            Users

            12.6k

            Topics

            109.4k

            Posts