MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / LoadNextSample

Method LoadNextSample

Source/DrumPlayer.cpp:1204–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1202}
1203
1204void 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
1234void DrumPlayer::DrumHit::GrabSample()
1235{

Callers 1

ButtonClickedMethod · 0.80

Calls 5

ofToDataPathFunction · 0.85
GetPathSeparatorFunction · 0.85
ofClampFunction · 0.85
GetReadPathMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected