| 1202 | } |
| 1203 | |
| 1204 | void DrumPlayer::DrumHit::LoadNextSample(int direction) |
| 1205 | { |
| 1206 | File dir(ofToDataPath("drums/" + mHitCategory)); |
| 1207 | Array<File> files; |
| 1208 | int currentIndex = -1; |
| 1209 | int i = 0; |
| 1210 | auto dirContents = dir.findChildFiles(File::findFiles, false); |
| 1211 | dirContents.sort(); |
| 1212 | for (auto file : dirContents) |
| 1213 | { |
| 1214 | if (file.getFileName()[0] != '.') |
| 1215 | { |
| 1216 | files.add(file); |
| 1217 | if (mSample.GetReadPath() == file.getFullPathName().replace(GetPathSeparator(), "/")) |
| 1218 | currentIndex = i; |
| 1219 | ++i; |
| 1220 | } |
| 1221 | } |
| 1222 | |
| 1223 | if (files.size() > 0) |
| 1224 | { |
| 1225 | int newIndex; |
| 1226 | if (currentIndex == -1) |
| 1227 | newIndex = 0; |
| 1228 | else |
| 1229 | newIndex = ofClamp(currentIndex + direction, 0, (int)files.size() - 1); |
| 1230 | LoadSample(files[newIndex].getFullPathName().toStdString()); |
| 1231 | } |
| 1232 | } |
| 1233 | |
| 1234 | void DrumPlayer::DrumHit::GrabSample() |
| 1235 | { |
no test coverage detected