Phase 16: persist sample-timed effect automation and add expressive MIDI controls
This commit is contained in:
parent
f72314b5a3
commit
7fac0a4f6a
23 changed files with 374 additions and 39 deletions
|
|
@ -32,7 +32,7 @@ static xtc_result instrument(void *state, const xtc_native_block *b)
|
|||
if (m->type == XTC_MIDI_NOTE_ON) {
|
||||
v->pitch = m->pitch; v->velocity = (float)m->velocity / 127.0f;
|
||||
v->frequency = 440.0 * pow(2.0, ((double)m->pitch - 69.0) / 12.0);
|
||||
} else if (m->type == XTC_MIDI_ALL_OFF || m->pitch == v->pitch) v->velocity = 0;
|
||||
} else if (m->type == XTC_MIDI_ALL_OFF || (m->type == XTC_MIDI_NOTE_OFF && m->pitch == v->pitch)) v->velocity = 0;
|
||||
}
|
||||
b->output[i] = (float)sin(v->phase) * v->velocity * v->gain;
|
||||
v->phase = fmod(v->phase + 6.283185307179586 * v->frequency / v->rate, 6.283185307179586);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue