not quite good enough MIDI
This commit is contained in:
parent
99339d6aef
commit
b32579e6e1
@ -37,8 +37,8 @@ void AlphaOsc::run(const float **, float **outputs, uint32_t frames, const MidiE
|
||||
bzero(outputs[0], sizeof(float) * frames);
|
||||
|
||||
// cast unused parameters to void for now to stop the compiler complaining
|
||||
(void)midiEventCount;
|
||||
(void)midiEvents;
|
||||
//(void)midiEventCount;
|
||||
//(void)midiEvents;
|
||||
|
||||
uint32_t i;
|
||||
uint32_t osc;
|
||||
@ -53,6 +53,20 @@ void AlphaOsc::run(const float **, float **outputs, uint32_t frames, const MidiE
|
||||
float out, in;
|
||||
|
||||
// handle any MIDI events
|
||||
for(i=0; i<midiEventCount; i++) {
|
||||
if (midiEvents[i].data[0] == 0x90) {
|
||||
// note on
|
||||
note = midiEvents[i].data[1];
|
||||
freq = 130.81*powf(2, (note-48)/12.0f);
|
||||
gate = 1;
|
||||
}
|
||||
|
||||
if (midiEvents[i].data[0] == 0x80 && midiEvents[1].data[1] == note) {
|
||||
// note off for same note
|
||||
gate = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// steeply "logarithmic" curve similar to the Juno 106 LFO rate curve
|
||||
// goes from about 0.1Hz to about 60Hz because this "feels about right"
|
||||
@ -194,7 +208,7 @@ void AlphaOsc::run(const float **, float **outputs, uint32_t frames, const MidiE
|
||||
hpfy = out;
|
||||
|
||||
// scale the output and write it to the buffer
|
||||
outputs[0][i] = out * 0.5;
|
||||
outputs[0][i] = gate * out * 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user