Mercurial > hg > beaglert
comparison examples/basic_midi/render.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:21:21 +0100 |
parents | e4392164b458 |
children | 9dc5a0ccad25 |
comparison
equal
deleted
inserted
replaced
307:ff5f346a293e | 308:1feb9c23ac57 |
---|---|
131 // and asks the pedal to return the status of the LED | 131 // and asks the pedal to return the status of the LED |
132 // using MIDI control changes | 132 // using MIDI control changes |
133 for(unsigned int n = 0; n < context->analogFrames; n++){ | 133 for(unsigned int n = 0; n < context->analogFrames; n++){ |
134 static int count = 0; | 134 static int count = 0; |
135 static bool state = 0; | 135 static bool state = 0; |
136 analogWriteFrameOnce(context, n, 1, state); | 136 analogWriteOnce(context, n, 1, state); |
137 if(count % 40000 == 0){ | 137 if(count % 40000 == 0){ |
138 state = !state; | 138 state = !state; |
139 midi_byte_t bytes[6] = {176, 30, (char)(state*127), 176, 67, 30}; // toggle the OWL led and ask for the led status | 139 midi_byte_t bytes[6] = {176, 30, (char)(state*127), 176, 67, 30}; // toggle the OWL led and ask for the led status |
140 midi.writeOutput(bytes, 6); | 140 midi.writeOutput(bytes, 6); |
141 } | 141 } |
146 static float phase = 0; | 146 static float phase = 0; |
147 phase += gPhaseIncrement; | 147 phase += gPhaseIncrement; |
148 if(phase > 2 * M_PI) | 148 if(phase > 2 * M_PI) |
149 phase -= 2 * M_PI; | 149 phase -= 2 * M_PI; |
150 float value = sinf(phase) * gVelocity/128.0f; | 150 float value = sinf(phase) * gVelocity/128.0f; |
151 audioWriteFrame(context, n, 0, value); | 151 audioWrite(context, n, 0, value); |
152 audioWriteFrame(context, n, 1, value); | 152 audioWrite(context, n, 1, value); |
153 } else { | 153 } else { |
154 audioWriteFrame(context, n, 0, 0); | 154 audioWrite(context, n, 0, 0); |
155 audioWriteFrame(context, n, 1, 0); | 155 audioWrite(context, n, 1, 0); |
156 } | 156 } |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 // cleanup() is called once at the end, after the audio has stopped. | 160 // cleanup() is called once at the end, after the audio has stopped. |