Page 1 of 1

How to asign AnalogOscillator() output to a jack?

Posted: Mon May 15, 2023 11:28 pm
by jugwine1
Hi. I've entered the world of module development. I'm working my way through the documentation.. which is OK.. but I'm struggling to figure out how to connect the output of an AnalogOscillator to an outputJack.

Could someone provide a code snippet? Thanks

Re: How to asign AnalogOscillator() output to a jack?

Posted: Tue May 16, 2023 1:49 am
by jugwine1
I figured it out.

Put this inside

Code: Select all

ProcessSample()

Code: Select all

    outputJack1.SetValue(osc1.GetPulseValue());
    osc1.AdvanceSample();

Re: How to asign AnalogOscillator() output to a jack?

Posted: Tue May 16, 2023 2:12 am
by Centripidity
Have a look at the Sample Module LFO Demo that comes with the Voltage Developer Kit.

Code: Select all

   public void ProcessSample()
   {
      // add your own code here

      // If the rateValue variable has changed since the last sample,
      // set the oscillator to the new frequency.
      if (rateValue != lastRateValue)
      {
         osc.SetFrequency(rateValue);
         lastRateValue = rateValue;      
      }

      // Get the square wave output from the oscillator
      double squareValue = osc.GetSquareValue();
      
      // If the square wave is positive, turn the LED on.
      // If the square wave is negative, turn the LED off.
      if (LEDOn == false && squareValue > 0)
      {
         // This turns the LED on (by setting its value to 1.0)
         rateLED.SetValue(1.0, true);
         LEDOn = true;
      }
      else if (LEDOn == true && squareValue <= 0)
      {
         // This turns the LED off (by setting its value to 1.0)
         rateLED.SetValue(0, true);
         LEDOn = false;   
      }
      

      // This places the square wave signal onto any wires connected
      // to the Square Out output jack.
      squareOut.SetValue(squareValue);
      
      // This places the triangle wave signal onto any wires connected
      // to the Triangle Out output jack.
      triangleOut.SetValue(osc.GetTriangleValue());

      // Advance the oscillator to the next sample
      osc.AdvanceSample();               
   }

Re: How to asign AnalogOscillator() output to a jack?

Posted: Tue May 16, 2023 2:15 am
by Centripidity
You also might want to check out this VERY generous thread.

viewtopic.php?t=2354

Re: How to asign AnalogOscillator() output to a jack?

Posted: Tue May 16, 2023 12:46 pm
by jugwine1
thank you