comparison projects/basic_analog_output/render.cpp @ 5:09f03ac40fcc

API improvements and cleanups. Now all common audio command-line options can be parsed automatically.
author andrewm
date Sat, 08 Nov 2014 16:16:55 +0100
parents 8a575ba3ab52
children a6beeba3a648
comparison
equal deleted inserted replaced
4:f34c63568523 5:09f03ac40fcc
60 for(int channel = 0; channel < 8; channel++) { 60 for(int channel = 0; channel < 8; channel++) {
61 float out = kMinimumAmplitude + kAmplitudeRange * 0.5f * (1.0f + sinf(gPhase + relativePhase)); 61 float out = kMinimumAmplitude + kAmplitudeRange * 0.5f * (1.0f + sinf(gPhase + relativePhase));
62 if(out > MATRIX_MAX) 62 if(out > MATRIX_MAX)
63 out = MATRIX_MAX; 63 out = MATRIX_MAX;
64 64
65 matrixOut[n * 8 + channel] = (uint16_t)out; 65 analogWrite(channel, n, out);
66 66
67 // Advance by pi/4 (1/8 of a full rotation) for each channel 67 // Advance by pi/4 (1/8 of a full rotation) for each channel
68 relativePhase += M_PI * 0.25; 68 relativePhase += M_PI * 0.25;
69 } 69 }
70 70