Add volume and pitch to projectile sound actions

did it to some chat bubble thing too lol, why not.
This commit is contained in:
Kae 2024-04-15 17:47:40 +10:00
parent 63c9e3ec8b
commit 83ca73b299
2 changed files with 4 additions and 0 deletions

View File

@ -311,6 +311,8 @@ void ChatBubbleManager::addChatActions(List<ChatAction> chatActions, bool silent
auto assets = Root::singleton().assets();
AudioInstancePtr audioInstance = make_shared<AudioInstance>(*assets->audio(*sound));
audioInstance->setPosition(position);
audioInstance->setVolume(config.getFloat("volume", 1.0f));
audioInstance->setPitchMultiplier(config.getFloat("pitch", 1.0f));
m_guiContext->playAudio(audioInstance);
}
}

View File

@ -816,6 +816,8 @@ void Projectile::processAction(Json const& action) {
AudioInstancePtr sound = make_shared<AudioInstance>(*Root::singleton().assets()->audio(Random::randValueFrom(parameters.getArray("options")).toString()));
sound->setPosition(position());
sound->setVolume(parameters.getFloat("volume", 1.0f));
sound->setPitchMultiplier(parameters.getFloat("pitch", 1.0f));
m_pendingRenderables.append(std::move(sound));
} else if (command == "light") {