|
|
@ -39,14 +39,14 @@ mdaEPiano::mdaEPiano() // mdaEPiano::mdaEPiano(audioMasterCallback audioMaster) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//fill patches...
|
|
|
|
//fill patches...
|
|
|
|
int32_t i = 0; |
|
|
|
int32_t i = 0; |
|
|
|
fillpatch(i++, "Default", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "Default", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "Bright", 0.500f, 0.500f, 1.000f, 0.800f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.500f); |
|
|
|
fillpatch(i++, "Bright", 0.500f, 0.500f, 1.000f, 0.800f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.146f, 0.500f); |
|
|
|
fillpatch(i++, "Mellow", 0.500f, 0.500f, 0.000f, 0.000f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.246f, 0.000f); |
|
|
|
fillpatch(i++, "Mellow", 0.500f, 0.500f, 0.000f, 0.000f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.246f, 0.000f); |
|
|
|
fillpatch(i++, "Autopan", 0.500f, 0.500f, 0.500f, 0.500f, 0.250f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.246f, 0.000f); |
|
|
|
fillpatch(i++, "Autopan", 0.500f, 0.500f, 0.500f, 0.500f, 0.250f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.246f, 0.000f); |
|
|
|
fillpatch(i++, "Tremolo", 0.500f, 0.500f, 0.500f, 0.500f, 0.750f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.246f, 0.000f); |
|
|
|
fillpatch(i++, "Tremolo", 0.500f, 0.500f, 0.500f, 0.500f, 0.750f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.246f, 0.000f); |
|
|
|
fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 0.50f, 0.500f, 0.146f, 0.000f); |
|
|
|
fillpatch(i++, "(default)", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.146f, 0.000f); |
|
|
|
setProgram(0); |
|
|
|
setProgram(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -135,7 +135,6 @@ void mdaEPiano::update() //parameter change |
|
|
|
if (param[6] < 0.25f) velsens -= 0.75f - 3.0f * param[6]; |
|
|
|
if (param[6] < 0.25f) velsens -= 0.75f - 3.0f * param[6]; |
|
|
|
|
|
|
|
|
|
|
|
width = 0.03f * param[7]; |
|
|
|
width = 0.03f * param[7]; |
|
|
|
poly = 1 + (int32_t)(31.9f * param[8]); |
|
|
|
|
|
|
|
fine = param[9] - 0.5f; |
|
|
|
fine = param[9] - 0.5f; |
|
|
|
random = 0.077f * param[10] * param[10]; |
|
|
|
random = 0.077f * param[10] * param[10]; |
|
|
|
stretch = 0.0f; //0.000434f * (param[11] - 0.5f); parameter re-used for overdrive!
|
|
|
|
stretch = 0.0f; //0.000434f * (param[11] - 0.5f); parameter re-used for overdrive!
|
|
|
@ -261,7 +260,7 @@ void mdaEPiano::noteOn(int32_t note, int32_t velocity) |
|
|
|
|
|
|
|
|
|
|
|
if (velocity > 0) |
|
|
|
if (velocity > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (activevoices < poly) //add a note
|
|
|
|
if (activevoices < NVOICES) //add a note
|
|
|
|
{ |
|
|
|
{ |
|
|
|
vl = activevoices; |
|
|
|
vl = activevoices; |
|
|
|
activevoices++; |
|
|
|
activevoices++; |
|
|
@ -269,7 +268,7 @@ void mdaEPiano::noteOn(int32_t note, int32_t velocity) |
|
|
|
} |
|
|
|
} |
|
|
|
else //steal a note
|
|
|
|
else //steal a note
|
|
|
|
{ |
|
|
|
{ |
|
|
|
for (v = 0; v < poly; v++) //find quietest voice
|
|
|
|
for (v = 0; v < NVOICES; v++) //find quietest voice
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (voice[v].env < l) { |
|
|
|
if (voice[v].env < l) { |
|
|
|
l = voice[v].env; |
|
|
|
l = voice[v].env; |
|
|
@ -390,84 +389,3 @@ bool mdaEPiano::processMidiMessage(uint8_t type, uint8_t data1, uint8_t data2) |
|
|
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
int32_t mdaEPiano::processEvents() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
float * param = programs[curProgram].param; |
|
|
|
|
|
|
|
int32_t npos=0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int32_t i=0; i<ev->numEvents; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if((ev->events[i])->type != kVstMidiType) continue; |
|
|
|
|
|
|
|
VstMidiEvent* event = (VstMidiEvent*)ev->events[i]; |
|
|
|
|
|
|
|
char* midiData = event->midiData; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(midiData[0] & 0xf0) //status byte (all channels)
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case 0x80: //note off
|
|
|
|
|
|
|
|
notes[npos++] = event->deltaFrames; //delta
|
|
|
|
|
|
|
|
notes[npos++] = midiData[1] & 0x7F; //note
|
|
|
|
|
|
|
|
notes[npos++] = 0; //vel
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0x90: //note on
|
|
|
|
|
|
|
|
notes[npos++] = event->deltaFrames; //delta
|
|
|
|
|
|
|
|
notes[npos++] = midiData[1] & 0x7F; //note
|
|
|
|
|
|
|
|
notes[npos++] = midiData[2] & 0x7F; //vel
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0xB0: //controller
|
|
|
|
|
|
|
|
switch(midiData[1]) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case 0x01: //mod wheel
|
|
|
|
|
|
|
|
modwhl = 0.0078f * (float)(midiData[2]); |
|
|
|
|
|
|
|
if(modwhl > 0.05f) //over-ride pan/trem depth
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
rmod = lmod = modwhl; //lfo depth
|
|
|
|
|
|
|
|
if(param[4] < 0.5f) rmod = -rmod; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0x07: //volume
|
|
|
|
|
|
|
|
volume = 0.00002f * (float)(midiData[2] * midiData[2]); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0x40: //sustain pedal
|
|
|
|
|
|
|
|
case 0x42: //sustenuto pedal
|
|
|
|
|
|
|
|
sustain = midiData[2] & 0x40; |
|
|
|
|
|
|
|
if(sustain==0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
notes[npos++] = event->deltaFrames; |
|
|
|
|
|
|
|
notes[npos++] = SUSTAIN; //end all sustained notes
|
|
|
|
|
|
|
|
notes[npos++] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: //all notes off
|
|
|
|
|
|
|
|
if(midiData[1]>0x7A) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for(int32_t v=0; v<NVOICES; v++) voice[v].dec=0.99f; |
|
|
|
|
|
|
|
sustain = 0; |
|
|
|
|
|
|
|
muff = 160.0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0xC0: //program change
|
|
|
|
|
|
|
|
if(midiData[1]<NPROGS) setProgram(midiData[1]); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(npos>EVENTBUFFER) npos -= 3; //discard events if buffer full!!
|
|
|
|
|
|
|
|
event++; //?
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
notes[npos] = EVENTS_DONE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|