| 315 | } |
| 316 | |
| 317 | void SampleFinder::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 318 | { |
| 319 | if (mSample) |
| 320 | { |
| 321 | mPlay = false; |
| 322 | if (pitch == 16) |
| 323 | { |
| 324 | mSample->Reset(); |
| 325 | } |
| 326 | else if (pitch >= 0 && pitch < 16 && velocity > 0) |
| 327 | { |
| 328 | int slice = (pitch / 8) * 8 + 7 - (pitch % 8); |
| 329 | int barLength = (mClipEnd - mClipStart) / mNumBars; |
| 330 | int position = -mOffset * barLength + (barLength / 4) * slice + mClipStart; |
| 331 | mSample->Play(time, 1, position); |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | void SampleFinder::LoadLayout(const ofxJSONElement& moduleInfo) |
| 337 | { |