void Sampler::playSound(float volume, float pitch) { volume = volume * volume; int note = valueToNote(pitch); if(vision.levels.size()>5) { note += noteOffset; } playbackSpeed = noteToSpeed(note); sample.trigger(volume); noteLastTime = ofGetElapsedTimef(); lastNote = pitch*vision.levels.size(); }
void Sampler::playSound(float volume, float pitch) { int note = valueToNote(pitch); playbackSpeed = noteToSpeed(note); sample.trigger(volume); noteLastTime = ofGetElapsedTimef(); lastNote = vision.levels.size() - pitch*vision.levels.size(); // do some stuff here ofPoint pos, force; if(vision.getBiggestFlowPoint(&pos, &force)) { // correct the y pos float y = (float)((float)lastMaxLevel+0.5)/vision.levels.size(); pos.y = y; spawnParticle(pos, volume); } }