//--------------------------------------------------- void calcDrumVoiceAsync(const uint8_t voiceNr) { //add modulation eg to osc freq (1 = no change. a+eg = original freq + modulation const float egPitchVal = DecayEg_calc(&voiceArray[voiceNr].oscPitchEg); const float pitchEgValue = egPitchVal*voiceArray[voiceNr].egPitchModAmount; voiceArray[voiceNr].osc.pitchMod = 1+pitchEgValue; //calc snap EG if transient sample 0 is activated if(voiceArray[voiceNr].transGen.waveform == 0) { const float snapVal = SnapEg_calc(&voiceArray[voiceNr].snapEg, voiceArray[voiceNr].transGen.pitch); voiceArray[voiceNr].osc.pitchMod += snapVal*voiceArray[voiceNr].transGen.volume; } // fm amount with pitch eg voiceArray[voiceNr].osc.fmMod = voiceArray[voiceNr].fmModAmount * egPitchVal; //calc the osc + noise vol eg #if (AMP_EG_SYNC==0) //check if in attack phase if( (voiceArray[voiceNr].oscVolEg.attack == 1 ) && ((voiceArray[voiceNr].oscVolEg.state == EG_A) || (voiceArray[voiceNr].oscVolEg.state == EG_REPEAT)) ) { //if attack is set to 0 -> no interpolation voiceArray[voiceNr].ampFilterInput = slopeEg2_calc(&voiceArray[voiceNr].oscVolEg); voiceArray[voiceNr].lastGain = voiceArray[voiceNr].ampFilterInput; } else { voiceArray[voiceNr].lastGain = voiceArray[voiceNr].ampFilterInput; voiceArray[voiceNr].ampFilterInput = slopeEg2_calc(&voiceArray[voiceNr].oscVolEg); } //turn off trigger signal if trigger gate mode is on and volume == 0 if(trigger_isGateModeOn()) { if(!voiceArray[voiceNr].ampFilterInput) { trigger_triggerVoice(TRIGGER_1 + voiceNr, TRIGGER_OFF); voiceControl_noteOff(TRIGGER_1 + voiceNr); } } #endif //update osc phaseInc osc_setFreq(&voiceArray[voiceNr].osc); osc_setFreq(&voiceArray[voiceNr].modOsc); }
//--------------------------------------------------- void Snare_calcAsync() { //add modulation eg to osc freq (1 = no change. a+eg = original freq + modulation const float egPitchVal = DecayEg_calc(&snareVoice.oscPitchEg); const float pitchEgValue = egPitchVal*snareVoice.egPitchModAmount; snareVoice.osc.pitchMod = 1+pitchEgValue; //calc the osc vol eg snareVoice.egValueOscVol = slopeEg2_calc(&snareVoice.oscVolEg); //calc snap EG if transient sample 0 is activated if(snareVoice.transGen.waveform == 0) { const float snapVal = SnapEg_calc(&snareVoice.snapEg, snareVoice.transGen.pitch); snareVoice.osc.pitchMod += snapVal*snareVoice.transGen.volume;; } osc_setFreq(&snareVoice.osc); osc_setFreq(&snareVoice.noiseOsc); }