Commit 1fd8ee19 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Rename macro

parent aa200bc0
...@@ -76,7 +76,7 @@ program_change(uint8_t pgm) ...@@ -76,7 +76,7 @@ program_change(uint8_t pgm)
current_program = pgm; current_program = pgm;
each_voice(v) { for_each_voice(v) {
gate_off(v); gate_off(v);
} }
......
...@@ -41,7 +41,7 @@ mono_note_on(uint8_t n) ...@@ -41,7 +41,7 @@ mono_note_on(uint8_t n)
l_push(notes, n); l_push(notes, n);
mono_set_pitch(); mono_set_pitch();
each_voice(v) { for_each_voice(v) {
gate_on(v); gate_on(v);
} }
} }
...@@ -54,7 +54,7 @@ mono_set_pitch(void) ...@@ -54,7 +54,7 @@ mono_set_pitch(void)
} }
uint8_t n = l_first(notes); uint8_t n = l_first(notes);
each_voice(v) { for_each_voice(v) {
int16_t detune = detune_factor[v] * detune_amount; int16_t detune = detune_factor[v] * detune_amount;
detune += vibrato_detune(); detune += vibrato_detune();
dac_set_note2(v, n, detune, current_bend); dac_set_note2(v, n, detune, current_bend);
...@@ -71,7 +71,7 @@ mono_note_off(uint8_t n) ...@@ -71,7 +71,7 @@ mono_note_off(uint8_t n)
l_delete(notes, n); l_delete(notes, n);
if (l_empty(notes)) { if (l_empty(notes)) {
each_voice(v) { for_each_voice(v) {
gate_off(v); gate_off(v);
} }
return; return;
......
...@@ -38,7 +38,7 @@ poly_note_on(uint8_t note) ...@@ -38,7 +38,7 @@ poly_note_on(uint8_t note)
void void
poly_note_off(uint8_t note) poly_note_off(uint8_t note)
{ {
each_voice(v) { for_each_voice(v) {
if (notes[v] == note) { if (notes[v] == note) {
voice_release(v); voice_release(v);
gate_off(v); gate_off(v);
...@@ -63,7 +63,7 @@ void ...@@ -63,7 +63,7 @@ void
poly_pitch_bend(uint16_t bend) poly_pitch_bend(uint16_t bend)
{ {
current_bend = bend; current_bend = bend;
each_voice(v) { for_each_voice(v) {
poly_set_pitch(v, notes[v]); poly_set_pitch(v, notes[v]);
} }
} }
...@@ -72,7 +72,7 @@ void ...@@ -72,7 +72,7 @@ void
poly_update_clock(uint8_t delta) poly_update_clock(uint8_t delta)
{ {
vibrato_update(delta); vibrato_update(delta);
each_voice(v) { for_each_voice(v) {
poly_set_pitch(v, notes[v]); poly_set_pitch(v, notes[v]);
} }
} }
...@@ -20,7 +20,7 @@ poly2_init(void) ...@@ -20,7 +20,7 @@ poly2_init(void)
{ {
l_flush(want_play); l_flush(want_play);
l_flush(avail); l_flush(avail);
each_voice(i) { for_each_voice(i) {
playing[i] = NUM_NOTES; playing[i] = NUM_NOTES;
l_push(avail, i); l_push(avail, i);
} }
...@@ -48,7 +48,7 @@ poly2_note_on(uint8_t note) ...@@ -48,7 +48,7 @@ poly2_note_on(uint8_t note)
static uint8_t static uint8_t
poly2_is_playing(uint8_t note) poly2_is_playing(uint8_t note)
{ {
each_voice(v) { for_each_voice(v) {
if (playing[v] == note) { if (playing[v] == note) {
return 1; return 1;
} }
...@@ -60,7 +60,7 @@ poly2_is_playing(uint8_t note) ...@@ -60,7 +60,7 @@ poly2_is_playing(uint8_t note)
void void
poly2_update_playing(void) poly2_update_playing(void)
{ {
each_voice(v) { for_each_voice(v) {
if ((playing[v] < NUM_NOTES) && !(l_index(want_play, playing[v]) < NUM_VOICES)) { if ((playing[v] < NUM_NOTES) && !(l_index(want_play, playing[v]) < NUM_VOICES)) {
gate_off(v); gate_off(v);
playing[v] = NUM_NOTES; playing[v] = NUM_NOTES;
...@@ -115,7 +115,7 @@ void ...@@ -115,7 +115,7 @@ void
poly2_pitch_bend(uint16_t bend) poly2_pitch_bend(uint16_t bend)
{ {
current_bend = bend; current_bend = bend;
each_voice(v) { for_each_voice(v) {
poly2_set_pitch(v, playing[v]); poly2_set_pitch(v, playing[v]);
} }
} }
...@@ -124,7 +124,7 @@ void ...@@ -124,7 +124,7 @@ void
poly2_update_clock(uint8_t delta) poly2_update_clock(uint8_t delta)
{ {
vibrato_update(delta); vibrato_update(delta);
each_voice(v) { for_each_voice(v) {
poly2_set_pitch(v, playing[v]); poly2_set_pitch(v, playing[v]);
} }
} }
...@@ -86,7 +86,7 @@ void ...@@ -86,7 +86,7 @@ void
voice_init(void) voice_init(void)
{ {
l_flush(avail); l_flush(avail);
each_voice(i) { for_each_voice(i) {
avail_enqueue(i); avail_enqueue(i);
} }
......
...@@ -11,7 +11,7 @@ enum _voices { ...@@ -11,7 +11,7 @@ enum _voices {
NUM_VOICES, // dual use: number of voices, but also the "not found" or "empty" response NUM_VOICES, // dual use: number of voices, but also the "not found" or "empty" response
}; };
#define each_voice(var) for (uint8_t var = 0; var < NUM_VOICES; var++) #define for_each_voice(var) for (uint8_t var = 0; var < NUM_VOICES; var++)
void voice_init(void); void voice_init(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment