Sketch 2015-06-26
void ofApp::setup(){
ofSetWindowShape(1000, 1000);
manager.setup();
manager.toggleDebugUI();
setupAudioUnits();
setupTimeline();
playing = false;
note = 60;
}
void ofApp::setupAudioUnits() {
manager.add(&chain, "tal-one", ofColor::blue);
chain.link(&noiseMaker).toMixer();
manager.loadPresets(&chain);
}
void ofApp::setupTimeline() {
timeline.setup();
timeline.setLoopType(OF_LOOP_NONE);
timeline.setDurationInSeconds(10);
timeline.setOffset(ofVec2f(10, 450));
timeline.setWidth(ofGetWidth() - 400);
timeline.addBangs("midi");
timeline.addCurves("lfo rate", ofRange(0.03, 0.2));
timeline.addCurves("filter cutoff", ofRange(0, 1));
ofAddListener(timeline.events().bangFired, this, &ofApp::bang);
}
void ofApp::update(){
noiseMaker.set(TALNoiseMaker_lfo2rate, timeline.getValue("lfo rate"));
noiseMaker.set(TALNoiseMaker_cutoff, timeline.getValue("filter cutoff"));
}
void ofApp::bang(ofxTLBangEventArgs &args) {
if(args.flag == "") {
chain.midi()->sendNoteOn(1, note);
} else {
chain.midi()->sendNoteOn(1, ofToInt(args.flag));
}
}
Modulating filter cutoff and LFO rate