#include "testApp.h"

void testApp::setup() {
	ofSetFrameRate(4);

	// create a new midi out instance
	// on OSX this will create a virtual midi port
	// on windows this will use your last midi port
	midiOut = new ofxMidiOut();

	// to specify a specific midi port, say:
	// midiOut = new ofxMidiOut(portNumber);

	noteState = true;
	note = 0;
}

void testApp::update() {
	printf("turning %i %s\n", note, noteState ? "on" : "off");

	// this is how you send note on and note off.
	// you can also specify the channel by adding an argument
	// to the beginning of sendNoteOn() and sendNoteOff()
	if(noteState)
		midiOut->sendNoteOn(60 + note, 100);
	else
		midiOut->sendNoteOff(60 + note, 0);

	noteState = !noteState;
	if(noteState)
		note = (note + 1) % 12;
}
