| 411 | } |
| 412 | |
| 413 | void Producer::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 414 | { |
| 415 | if (mSample) |
| 416 | { |
| 417 | mPlay = false; |
| 418 | if (pitch == 16) |
| 419 | { |
| 420 | mSample->Reset(); |
| 421 | } |
| 422 | else if (pitch >= 0 && pitch < 16 && velocity > 0) |
| 423 | { |
| 424 | int slice = (pitch / 8) * 8 + 7 - (pitch % 8); |
| 425 | int barLength = (mClipEnd - mClipStart) / mNumBars; |
| 426 | int position = -mOffset * barLength + (barLength / 4) * slice + mClipStart; |
| 427 | mSample->Play(time, 1, position); |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | void Producer::LoadLayout(const ofxJSONElement& moduleInfo) |
| 433 | { |