CSound.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "WallpaperEngine/Core/CObject.h"
  3. #include "WallpaperEngine/Core/Core.h"
  4. #include "WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h"
  5. namespace WallpaperEngine::Core::Objects {
  6. using json = nlohmann::json;
  7. using namespace WallpaperEngine::Core::UserSettings;
  8. /**
  9. * Represents a sound played while the background is working
  10. */
  11. class CSound : public CObject {
  12. friend class CObject;
  13. public:
  14. static CObject* fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, int id,
  15. const std::string& name, CUserSettingVector3* origin, CUserSettingVector3* scale,
  16. const glm::vec3& angles);
  17. /**
  18. * @return The list of sounds to play
  19. */
  20. [[nodiscard]] const std::vector<std::string>& getSounds () const;
  21. /**
  22. * @return If the sound should repeat or not
  23. */
  24. [[nodiscard]] bool isRepeat () const;
  25. protected:
  26. CSound (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
  27. CUserSettingVector3* scale, const glm::vec3& angles, bool repeat);
  28. /**
  29. * @param filename The sound to add
  30. */
  31. void insertSound (const std::string& filename);
  32. /**
  33. * Type value used to differentiate the different types of objects in a background
  34. */
  35. static const std::string Type;
  36. private:
  37. /** If the sounds should repeat or not */
  38. bool m_repeat;
  39. /** The list of sounds to play */
  40. std::vector<std::string> m_sounds;
  41. };
  42. } // namespace WallpaperEngine::Core::Objects