// // ToySoundUtils.cpp // SteveMaggieCpp // // Created by Katarzyna Kalinowska-Górska on 10.05.2017. // // #include "ToySoundUtils.h" #include "ToyMathUtils.h" #include "ToySoundsRepo.h" unsigned int ToySoundUtils::playRandomSound(std::string soundFolderPath, std::vector soundNames, bool stopEffects){ auto soundsLength = soundNames.size(); if(soundsLength > 0){ int randomIndex = ToyMathUtils::getRandomInt(0, (int)soundsLength-1); std::string fullSoundPath = soundFolderPath == "" ? soundNames[randomIndex] : soundFolderPath /*+ "/"*/ + soundNames[randomIndex]; return ToySoundsRepo::playSound(fullSoundPath, stopEffects); } return 0; }