sounds variability + first step fix

This commit is contained in:
MihailRis
2024-03-09 02:10:19 +03:00
parent 87dd1dd6b2
commit bfc3182ed3
4 changed files with 23 additions and 9 deletions
+6
View File
@@ -249,6 +249,12 @@ speakerid_t audio::play(
int priority,
int channel
) {
if (!sound->variants.empty()) {
size_t index = rand() % (sound->variants.size() + 1);
if (index < sound->variants.size()) {
sound = sound->variants.at(index).get();
}
}
Speaker* speaker = sound->newInstance(priority, channel);
if (speaker == nullptr) {
remove_lower_priority_speaker(priority);