Oscillator phase & SetCycle()
Posted: Sun Feb 10, 2019 8:51 pm
I'm using the AnalogOscillator & DigitalOscillator classes as LFOs. But I can't figure out how to set their phase, or the point where the waveform starts.
When I create a new oscillator, set the frequency, and start reading the values, the DigitalOscillator always starts from the beginning of the cycle, and the AnalogOscillator from a more or less random position (I guess it's simulating a freerunning osc?). The GetCycle() method runs from 0 to 1 when the oscillator completes one cycle, which makes sense. One would assume that SetCycle(x) would then set the position in the cycle (or phase), but no matter how much I call it, it seems to do absolutely nothing... the oscillator just keeps running.
Did I miss something obvious here? Help!
(BTW, is there a reason why the methods of the VM classes start with a capital letter? My understanding is that the standard is to start with a lowercase letter, ie. setCycle() instead of SetCycle(). Not a biggie, just interested... I constantly write it wrong in my code. Old habits... )
When I create a new oscillator, set the frequency, and start reading the values, the DigitalOscillator always starts from the beginning of the cycle, and the AnalogOscillator from a more or less random position (I guess it's simulating a freerunning osc?). The GetCycle() method runs from 0 to 1 when the oscillator completes one cycle, which makes sense. One would assume that SetCycle(x) would then set the position in the cycle (or phase), but no matter how much I call it, it seems to do absolutely nothing... the oscillator just keeps running.
Did I miss something obvious here? Help!
(BTW, is there a reason why the methods of the VM classes start with a capital letter? My understanding is that the standard is to start with a lowercase letter, ie. setCycle() instead of SetCycle(). Not a biggie, just interested... I constantly write it wrong in my code. Old habits... )