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
How to asign AnalogOscillator() output to a jack?
Re: How to asign AnalogOscillator() output to a jack?
I figured it out.
Put this inside
Put this inside
Code: Select all
ProcessSample()
Code: Select all
outputJack1.SetValue(osc1.GetPulseValue());
osc1.AdvanceSample();
-
- Posts: 146
- Joined: Sun Jan 22, 2023 5:18 am
- Location: Melbourne
- Contact:
Re: How to asign AnalogOscillator() output to a jack?
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();
}
-
- Posts: 146
- Joined: Sun Jan 22, 2023 5:18 am
- Location: Melbourne
- Contact: