converts tabs to spaces
This commit is contained in:
parent
73228f5e5d
commit
e89b806b85
2 changed files with 47 additions and 47 deletions
|
@ -6,55 +6,55 @@ extern float note_timbre;
|
||||||
voice_type voice = default_voice;
|
voice_type voice = default_voice;
|
||||||
|
|
||||||
void set_voice(voice_type v) {
|
void set_voice(voice_type v) {
|
||||||
voice = v;
|
voice = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
float voice_envelope(float frequency) {
|
float voice_envelope(float frequency) {
|
||||||
// envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
|
// envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
|
||||||
uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
|
uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
|
||||||
|
|
||||||
switch (voice) {
|
switch (voice) {
|
||||||
case default_voice:
|
case default_voice:
|
||||||
// nothing here on purpose
|
// nothing here on purpose
|
||||||
break;
|
break;
|
||||||
case butts_fader:
|
case butts_fader:
|
||||||
switch (compensated_index) {
|
switch (compensated_index) {
|
||||||
case 0 ... 9:
|
case 0 ... 9:
|
||||||
frequency = frequency / 4;
|
frequency = frequency / 4;
|
||||||
note_timbre = TIMBRE_12;
|
note_timbre = TIMBRE_12;
|
||||||
break;
|
break;
|
||||||
case 10 ... 19:
|
case 10 ... 19:
|
||||||
frequency = frequency / 2;
|
frequency = frequency / 2;
|
||||||
note_timbre = TIMBRE_12;
|
note_timbre = TIMBRE_12;
|
||||||
break;
|
break;
|
||||||
case 20 ... 200:
|
case 20 ... 200:
|
||||||
note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
|
note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
note_timbre = 0;
|
note_timbre = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case octave_crunch:
|
case octave_crunch:
|
||||||
switch (compensated_index) {
|
switch (compensated_index) {
|
||||||
case 0 ... 9:
|
case 0 ... 9:
|
||||||
case 20 ... 24:
|
case 20 ... 24:
|
||||||
case 30 ... 32:
|
case 30 ... 32:
|
||||||
frequency = frequency / 2;
|
frequency = frequency / 2;
|
||||||
note_timbre = TIMBRE_12;
|
note_timbre = TIMBRE_12;
|
||||||
break;
|
break;
|
||||||
case 10 ... 19:
|
case 10 ... 19:
|
||||||
case 25 ... 29:
|
case 25 ... 29:
|
||||||
case 33 ... 35:
|
case 33 ... 35:
|
||||||
frequency = frequency * 2;
|
frequency = frequency * 2;
|
||||||
note_timbre = TIMBRE_12;
|
note_timbre = TIMBRE_12;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
note_timbre = TIMBRE_12;
|
note_timbre = TIMBRE_12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return frequency;
|
return frequency;
|
||||||
}
|
}
|
|
@ -11,9 +11,9 @@
|
||||||
float voice_envelope(float frequency);
|
float voice_envelope(float frequency);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
default_voice,
|
default_voice,
|
||||||
butts_fader,
|
butts_fader,
|
||||||
octave_crunch
|
octave_crunch
|
||||||
} voice_type;
|
} voice_type;
|
||||||
|
|
||||||
void set_voice(voice_type v);
|
void set_voice(voice_type v);
|
||||||
|
|
Loading…
Reference in a new issue