| 337 | } |
| 338 | #endif |
| 339 | std::optional<PlayingSound> Window::pauseSound(const std::uint32_t &id) |
| 340 | { |
| 341 | std::optional<std::uint32_t> remoteSoundId; |
| 342 | if (!Globals::gSettings.outputs.empty() && !Globals::gSettings.useAsDefaultDevice) |
| 343 | { |
| 344 | auto scoped = groupedSounds.scoped(); |
| 345 | if (scoped->find(id) == scoped->end()) |
| 346 | { |
| 347 | if (!Globals::gSettings.outputs.empty() || !Globals::gSettings.useAsDefaultDevice) |
| 348 | { |
| 349 | Fancy::fancy.logTime().warning() << "Failed to find remoteSound of sound " << id << std::endl; |
| 350 | } |
| 351 | } |
| 352 | else |
| 353 | { |
| 354 | remoteSoundId = scoped->at(id); |
| 355 | } |
| 356 | } |
| 357 | auto playingSound = Globals::gAudio.pause(id); |
| 358 | if (remoteSoundId) |
| 359 | { |
| 360 | Globals::gAudio.pause(*remoteSoundId); |
| 361 | } |
| 362 | |
| 363 | if (playingSound) |
| 364 | { |
| 365 | return *playingSound; |
| 366 | } |
| 367 | |
| 368 | Fancy::fancy.logTime().warning() << "Failed to pause sound " << id << std::endl; |
| 369 | onError(Enums::ErrorCode::FailedToPause); |
| 370 | return std::nullopt; |
| 371 | } |
| 372 | std::optional<PlayingSound> Window::resumeSound(const std::uint32_t &id) |
| 373 | { |
| 374 | std::optional<std::uint32_t> remoteSoundId; |