HISE Logo Forum
    • Categories
    • Register
    • Login

    snex custom interaction help?

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 313 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.
    • giftliftG
      giftlift
      last edited by

      I can't figure out how to get the script to interact with the knob that "set" creates.
      Ive tried to create "const float Gain = 0" at the beginning but the value doesn't update.
      Also tried Gain.newValue()? IDK what I'm doing?
      I don't know how to pass Gain to the processFrame function?

      void prepare(double sampleRate, int blockSize, int numChannels)
      {
      	
      }
      
      float setGain(double newValue)
      {
          return newValue;
      }
      
      void processFrame(block frame)
      {
          frame[0]=frame[0]*Gain;
      }
      
      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        You need to declare a variable outside the function and set its value. Also the return type of a setX function has to be void. You are just returning the value which doesn't do anything.

        
        float gain = 1.0f;
        
        void setGain(double newValue)
        {
            gain = (float)newValue;
        }
        
        void processFrame(block frame)
        {
            frame[0]=frame[0]*gain;
        }
        
        giftliftG 1 Reply Last reply Reply Quote 1
        • giftliftG
          giftlift @Christoph Hart
          last edited by

          @Christoph-Hart thank you (:

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

          43

          Online

          1.7k

          Users

          11.7k

          Topics

          101.9k

          Posts