| 972 | } |
| 973 | |
| 974 | void BeatBloks::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 975 | { |
| 976 | if (mSample) |
| 977 | { |
| 978 | mPlay = false; |
| 979 | if (pitch == 16) |
| 980 | { |
| 981 | mSample->Reset(); |
| 982 | } |
| 983 | else if (pitch >= 0 && pitch < 16 && velocity > 0) |
| 984 | { |
| 985 | int slice = (pitch / 8) * 8 + 7 - (pitch % 8); |
| 986 | int barLength = (mClipEnd - mClipStart) / mNumBars; |
| 987 | int position = (barLength / 4) * slice + mClipStart; |
| 988 | mSample->Play(time, 1, position); |
| 989 | } |
| 990 | } |
| 991 | } |
| 992 | |
| 993 | void BeatBloks::LoadLayout(const ofxJSONElement& moduleInfo) |
| 994 | { |