Skip to content

Commit

Permalink
MIDI fix / Minimize startup decay
Browse files Browse the repository at this point in the history
  • Loading branch information
mengqimusic committed Mar 20, 2022
1 parent 49fa3c6 commit 3d8fc69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Wingie2/MIDI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ void MIDISetParam(int kb, byte number, byte value) {

float v = (midiVal14Bit / 16383.) * 9.9 + 0.1;
v = fscale(0.1, 10., 0.1, 10., v, -3.25);
if (!kb) dsp.setParamValue("/Wingie/left/decay", v);
if (kb) dsp.setParamValue("/Wingie/right/decay", v);
if (!kb && !startup) dsp.setParamValue("/Wingie/left/decay", v);
if (kb && !startup) dsp.setParamValue("/Wingie/right/decay", v);
}

if (number == VOL_CC or number == VOL_CC + 32) {
Expand Down
8 changes: 6 additions & 2 deletions Wingie2/control.ino
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ void control( void * pvParameters ) {
dsp.setParamValue("/Wingie/right/poly_note_1", 4 + BASE_NOTE + POLY_MODE_NOTE_ADD_R);
dsp.setParamValue("/Wingie/right/poly_note_2", 7 + BASE_NOTE + POLY_MODE_NOTE_ADD_R);

dsp.setParamValue("/Wingie/left/decay", 0.1); // 最小 Startup Decay 避免开机声音过大
dsp.setParamValue("/Wingie/right/decay", 0.1);


for (;;) {
interrupts();
Expand Down Expand Up @@ -155,7 +158,8 @@ void control( void * pvParameters ) {
//
for (int i = 0; i < 3; i++) {
potValRealtime[i] = analogRead(potPin[i]);
if (midiValValid[i]) if (potValRealtime[i] - potValSampled[i] > slider_movement_detect) midiValValid[i] = false;
int difference = abs(potValRealtime[i] - potValSampled[i]);
if (midiValValid[i]) if (difference > slider_movement_detect) midiValValid[i] = false;
}

float Mix = potValRealtime[0] / 4095.;
Expand All @@ -166,7 +170,7 @@ void control( void * pvParameters ) {

float Decay = (potValRealtime[1] / 4095.) * 9.9 + 0.1;
Decay = fscale(0.1, 10., 0.1, 10., Decay, -3.25);
if (!midiValValid[DECAY]) {
if (!midiValValid[DECAY] && !startup) {
dsp.setParamValue("/Wingie/left/decay", Decay);
dsp.setParamValue("/Wingie/right/decay", Decay);
}
Expand Down

0 comments on commit 3d8fc69

Please sign in to comment.