Added MIDI DIN handeling
This commit is contained in:
		
							
								
								
									
										14
									
								
								FM/FM.ino
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								FM/FM.ino
									
									
									
									
									
								
							@ -4,12 +4,14 @@
 | 
			
		||||
#include <Smooth.h>
 | 
			
		||||
#include <AutoMap.h> // maps unpredictable inputs to a range
 | 
			
		||||
#include <MIDIUSB.h>
 | 
			
		||||
#include <MIDI.h>
 | 
			
		||||
 | 
			
		||||
MIDI_CREATE_DEFAULT_INSTANCE();
 | 
			
		||||
 | 
			
		||||
#define CONTROL_RATE 64
 | 
			
		||||
 | 
			
		||||
bool gate = 0;
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
// desired carrier frequency max and min, for AutoMap
 | 
			
		||||
const int MIN_CARRIER_FREQ = 22;
 | 
			
		||||
const int MAX_CARRIER_FREQ = 440;
 | 
			
		||||
@ -64,10 +66,14 @@ void noteOff(byte channel, byte note, byte velocity) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void setup(){
 | 
			
		||||
  startMozzi();
 | 
			
		||||
 | 
			
		||||
  pinMode(LED_BUILTIN_TX,INPUT); //switch rx and tx leds of, so they don't blink on midi
 | 
			
		||||
  pinMode(LED_BUILTIN_RX,INPUT);
 | 
			
		||||
 | 
			
		||||
  startMozzi();
 | 
			
		||||
 | 
			
		||||
  MIDI.setHandleNoteOn(noteOn);
 | 
			
		||||
  MIDI.setHandleNoteOff(noteOff);
 | 
			
		||||
  MIDI.begin();  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -114,6 +120,8 @@ void updateControl(){
 | 
			
		||||
  float mod_speed = (float)kMapModSpeed(LDR2_value)/1000;
 | 
			
		||||
 | 
			
		||||
  kIntensityMod.setFreq(mod_speed);
 | 
			
		||||
 | 
			
		||||
  MIDI.read();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user