I don't understand this: http://www.pjrc.com/teensy/td_libs_AudioNewObjects.html says:
The built-in synth functions do not do this, such as AudioSynthWaveformSine just modifies phase_increment, phase_accumulator, and magnitude directly, and then AudioSynthWaveformSine::update uses the phase_increment and magnitude values directly. But when I try to update these in the middle of the update() function, it doesn't work:
The waveform still pulses on and off at the block size, 2.9 ms, not at 1 ms when I change the magnitude variable. Why is this?
(I don't actually need to pulse it on and off at 1 ms; my goal is just to learn how the variable modifications work.)
Normally sketch-called function should use __disable_irq() and __enable_irq() to temporarily disable all interrupts while reading or writing a set of variables that are used used by update().
The built-in synth functions do not do this, such as AudioSynthWaveformSine just modifies phase_increment, phase_accumulator, and magnitude directly, and then AudioSynthWaveformSine::update uses the phase_increment and magnitude values directly. But when I try to update these in the middle of the update() function, it doesn't work:
Code:
void loop()
{
waveform.amplitude(1);
delay(1);
waveform.amplitude(0);
delay(1);
}
The waveform still pulses on and off at the block size, 2.9 ms, not at 1 ms when I change the magnitude variable. Why is this?
(I don't actually need to pulse it on and off at 1 ms; my goal is just to learn how the variable modifications work.)