Forum

    • Register
    • Login
    • Search
    • Categories

    snex custom interaction help?

    Scripting Forum
    2
    3
    118
    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.
    • giftlift
      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 Hart
        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;
        }
        
        giftlift 1 Reply Last reply Reply Quote 1
        • giftlift
          giftlift @Christoph Hart last edited by

          @Christoph-Hart thank you 🙂

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

          7
          Online

          1.1k
          Users

          7.0k
          Topics

          64.7k
          Posts