void threadedFunction() {
		while(isThreadRunning()) {
			for(int i = 0; i < backNotes.size(); i++) {
				MidiNote& cur = backNotes[i];
				if(cur.finished()) {
					midi.sendNoteOff(cur.channel, cur.pitch, 0);
				}
			}
			ofRemove(backNotes, isFinished);
			lock();
			swap();
			unlock();
			ofSleepMillis(1);
		}
		// silence remaining notes
		swap();
		for(int i = 0; i < backNotes.size(); i++) {
			MidiNote& cur = backNotes[i];
			midi.sendNoteOff(cur.channel, cur.pitch, 0);
		}
	}
 void willDelete()
 {
     mMidi->sendNoteOff(mCh, mPich);
 }