| 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); |
| 561 | if (sound) |
| 562 | { |
| 563 | sound->get().remoteVolume = remoteVolume; |
| 564 | |
| 565 | for (auto &playingSound : Globals::gAudio.getPlayingSounds()) |
| 566 | { |
| 567 | if (playingSound.sound.id == sound->get().id && !playingSound.playbackDevice.isDefault) |
| 568 | { |
| 569 | playingSound.raw.device.load()->masterVolumeFactor = |
| 570 | static_cast<float>(remoteVolume ? *remoteVolume : Globals::gSettings.remoteVolume) / 100.f; |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | return *sound; |
| 575 | } |
| 576 | |
| 577 | Fancy::fancy.logTime().failure() << "Failed to set custom remote volume for sound " << id |
| 578 | << ", sound does not exist" << std::endl; |
| 579 | onError(Enums::ErrorCode::FailedToSetCustomVolume); |
| 580 | return std::nullopt; |
| 581 | } |
| 582 | Settings Window::changeSettings(Settings settings) |
| 583 | { |
| 584 | auto oldSettings = Globals::gSettings; |
nothing calls this directly
no test coverage detected