| 532 | #endif |
| 533 | } |
| 534 | std::optional<Sound> Window::setCustomLocalVolume(const std::uint32_t &id, const std::optional<int> &localVolume) |
| 535 | { |
| 536 | auto sound = Globals::gData.getSound(id); |
| 537 | if (sound) |
| 538 | { |
| 539 | sound->get().localVolume = localVolume; |
| 540 | |
| 541 | for (auto &playingSound : Globals::gAudio.getPlayingSounds()) |
| 542 | { |
| 543 | if (playingSound.sound.id == sound->get().id && playingSound.playbackDevice.isDefault) |
| 544 | { |
| 545 | playingSound.raw.device.load()->masterVolumeFactor = |
| 546 | static_cast<float>(localVolume ? *localVolume : Globals::gSettings.localVolume) / 100.f; |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | return *sound; |
| 551 | } |
| 552 | |
| 553 | Fancy::fancy.logTime().failure() << "Failed to set custom local volume for sound " << id |
| 554 | << ", sound does not exist" << std::endl; |
| 555 | onError(Enums::ErrorCode::FailedToSetCustomVolume); |
| 556 | return std::nullopt; |
| 557 | } |
| 558 | std::optional<Sound> Window::setCustomRemoteVolume(const std::uint32_t &id, const std::optional<int> &remoteVolume) |
| 559 | { |
| 560 | auto sound = Globals::gData.getSound(id); |
nothing calls this directly
no test coverage detected