|
|
@ -984,42 +984,45 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { |
|
|
|
if (inNumber == configuration.drums.midinote[d]) { |
|
|
|
if (inNumber == configuration.drums.midinote[d]) { |
|
|
|
uint8_t slot = drum_get_slot(drum_config[d].drum_class); |
|
|
|
uint8_t slot = drum_get_slot(drum_config[d].drum_class); |
|
|
|
float pan = mapfloat(configuration.drums.pan[d], -127.0, 127.0, 0.0, 1.0); |
|
|
|
float pan = mapfloat(configuration.drums.pan[d], -127.0, 127.0, 0.0, 1.0); |
|
|
|
|
|
|
|
float reverb_send = configuration.drums.reverb_send[d] / 100.0f; |
|
|
|
//drum_mixer_r.gain(slot, (1.0 - pan) * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
|
|
|
|
float vol_min = configuration.drums.vol_min[d] / 100.0f; |
|
|
|
//drum_mixer_l.gain(slot, pan * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
|
|
|
|
float vol_max = configuration.drums.vol_max[d] / 100.0f; |
|
|
|
drum_mixer_r.gain(slot, (1.0 - pan) * mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)); |
|
|
|
|
|
|
|
drum_mixer_l.gain(slot, pan * mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)); |
|
|
|
//drum_mixer_r.gain(slot, (1.0 - pan) * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min/100.0f, configuration.drums.vol_max[d]/100.0f)));
|
|
|
|
|
|
|
|
//drum_mixer_l.gain(slot, pan * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min/100.0f, configuration.drums.vol_max[d]/100.0f)));
|
|
|
|
|
|
|
|
drum_mixer_r.gain(slot, (1.0 - pan) * mapfloat(inVelocity, 0, 127, vol_min, vol_max)); |
|
|
|
|
|
|
|
drum_mixer_l.gain(slot, pan * mapfloat(inVelocity, 0, 127, vol_min, vol_max)); |
|
|
|
#ifdef USE_FX |
|
|
|
#ifdef USE_FX |
|
|
|
//drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * volume_transform(drum_config[d].reverb_send));
|
|
|
|
//drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * volume_transform(reverb_send));
|
|
|
|
//drum_reverb_send_mixer_l.gain(slot, pan * volume_transform(drum_config[d].reverb_send));
|
|
|
|
//drum_reverb_send_mixer_l.gain(slot, pan * volume_transform(reverb_send));
|
|
|
|
drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * drum_config[d].reverb_send); |
|
|
|
drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * reverb_send); |
|
|
|
drum_reverb_send_mixer_l.gain(slot, pan * drum_config[d].reverb_send); |
|
|
|
drum_reverb_send_mixer_l.gain(slot, pan * reverb_send); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
if (drum_config[d].drum_data != NULL && drum_config[d].len > 0) { |
|
|
|
if (drum_config[d].drum_data != NULL && drum_config[d].len > 0) { |
|
|
|
if (configuration.drums.pitch[d] != 0) { |
|
|
|
if (configuration.drums.pitch[d] != 0) { |
|
|
|
Drum[slot]->enableInterpolation(true); |
|
|
|
Drum[slot]->enableInterpolation(true); |
|
|
|
Drum[slot]->setPlaybackRate(configuration.drum.pitch[d] / 10.0f); |
|
|
|
Drum[slot]->setPlaybackRate(configuration.drums.pitch[d] / 100.0f); |
|
|
|
} |
|
|
|
} |
|
|
|
Drum[slot]->playRaw((int16_t*)drum_config[d].drum_data, drum_config[d].len, 1); |
|
|
|
Drum[slot]->playRaw((int16_t*)drum_config[d].drum_data, drum_config[d].len, 1); |
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.printf("Playing sample [%s][%c%c] on slot [%d] main volume [%d]: drum_data=%p, len=%d\n", drum_config[d].name, drum_config[d].shortname[0], drum_config[d].shortname[1], slot, configuration.drums.main_vol, drum_config[d].drum_data, drum_config[d].len); |
|
|
|
Serial.printf(PSTR("Playing sample [%s][%c%c] on slot [%d] main volume [%d]: drum_data=%p, len=%d\n"), drum_config[d].name, drum_config[d].shortname[0], drum_config[d].shortname[1], slot, configuration.drums.main_vol, drum_config[d].drum_data, drum_config[d].len); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Drum Slot [")); |
|
|
|
Serial.print(F("Drum Slot [")); |
|
|
|
Serial.print(slot); |
|
|
|
Serial.print(slot); |
|
|
|
Serial.print(F("]: Velocity=")); |
|
|
|
Serial.print(F("]: Velocity=")); |
|
|
|
Serial.print(mapfloat(inVelocity, 0, 127, configuration.drums.vol_min[d], configuration.drums.vol_max[d]), 2); |
|
|
|
Serial.print(mapfloat(inVelocity, 0, 127, vol_min, vol_max), 2); |
|
|
|
Serial.print(F(" Pan=")); |
|
|
|
Serial.print(F(" Pan=")); |
|
|
|
Serial.print(pan, 2); |
|
|
|
Serial.print(pan, 2); |
|
|
|
Serial.print(F(" ReverbSend=")); |
|
|
|
Serial.print(F(" ReverbSend=")); |
|
|
|
Serial.println(drum_config[d].reverb_send, 2); |
|
|
|
Serial.println(reverb_send, 2); |
|
|
|
|
|
|
|
Serial.print(F(" Pitch=")); |
|
|
|
|
|
|
|
Serial.println(configuration.drums.pitch[d] / 10.0f, 1); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|