Manual triggering now works
This commit is contained in:
@ -7,8 +7,9 @@
|
|||||||
// This code is licenced under GPL v3 or later
|
// This code is licenced under GPL v3 or later
|
||||||
|
|
||||||
// todo:
|
// todo:
|
||||||
// debug accent handling that overloads the filter
|
// debug accent handling that overloads the filter, also accent can be too short or too long if it's relying on midi note
|
||||||
// add overdrive
|
// add overdrive
|
||||||
|
// frequency from CV (noteFreq) could be Q16n16 for consistency
|
||||||
|
|
||||||
#include <Mozzi.h>
|
#include <Mozzi.h>
|
||||||
#include <MIDI.h>
|
#include <MIDI.h>
|
||||||
@ -114,7 +115,7 @@ byte gain;
|
|||||||
bool MIDINotePlaying;
|
bool MIDINotePlaying;
|
||||||
bool MIDINoteFaded = true;
|
bool MIDINoteFaded = true;
|
||||||
bool gateIsHigh = false;
|
bool gateIsHigh = false;
|
||||||
Q16n16 noteFreq;
|
float noteFreq;
|
||||||
bool envSwitchVal;
|
bool envSwitchVal;
|
||||||
bool droneSwitchVal;
|
bool droneSwitchVal;
|
||||||
byte MIDIChannel;
|
byte MIDIChannel;
|
||||||
@ -126,7 +127,6 @@ bool accent = false;
|
|||||||
|
|
||||||
void MIDINoteOn(byte channel, byte note, byte velocity) {
|
void MIDINoteOn(byte channel, byte note, byte velocity) {
|
||||||
notePlaying = note;
|
notePlaying = note;
|
||||||
noteFreq = Q16n16_mtof((int) note);
|
|
||||||
|
|
||||||
if (velocity >= 127) {
|
if (velocity >= 127) {
|
||||||
accent = true;
|
accent = true;
|
||||||
@ -276,7 +276,7 @@ void updateControl(){
|
|||||||
|
|
||||||
//Set pitch and play notes on trigger
|
//Set pitch and play notes on trigger
|
||||||
if (MIDINoteFaded) {
|
if (MIDINoteFaded) {
|
||||||
noteFreq = Q16n16_mtof((float) kMapNote(CVInVal << 2) / pitchSubSteps);
|
noteFreq = mtof((float) kMapNote(CVInVal << 2) / pitchSubSteps);
|
||||||
digitalWrite(LED, !gateInVal);
|
digitalWrite(LED, !gateInVal);
|
||||||
if (gateInVal && !gateIsHigh) {
|
if (gateInVal && !gateIsHigh) {
|
||||||
gateIsHigh = true;
|
gateIsHigh = true;
|
||||||
@ -297,9 +297,14 @@ void updateControl(){
|
|||||||
|
|
||||||
//Set Oscilator Frequency
|
//Set Oscilator Frequency
|
||||||
Q16n16 oscFreq;
|
Q16n16 oscFreq;
|
||||||
|
if (!MIDINoteFaded) {
|
||||||
oscFreq = kGlide.next();
|
oscFreq = kGlide.next();
|
||||||
aSquare.setFreq_Q16n16(oscFreq);
|
aSquare.setFreq_Q16n16(oscFreq);
|
||||||
aSaw.setFreq_Q16n16(oscFreq);
|
aSaw.setFreq_Q16n16(oscFreq);
|
||||||
|
} else {
|
||||||
|
aSquare.setFreq(noteFreq);
|
||||||
|
aSaw.setFreq(noteFreq);
|
||||||
|
}
|
||||||
|
|
||||||
int env = kEnvelope.next();
|
int env = kEnvelope.next();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user