linux-wallpaperengine/src/WallpaperEngine/Core/Objects/CSound.cpp
Alexis Maiquez 291b7e364a - removed/commented out most irrlicht-specific code
~ written close to equivalent versions in OpenGL code using GLM and GLFW
~ written replacements for texture and package loading to not use irrlicht anymore
~ updated shader compiler as we now don't need to replace attributes anymore
+ added support for texture flags in the texture header (as they're needed for opengl to get proper information)

TODO: REWRITE VIDEO PLAYER SUPPORT AS THIS UPDATE EFFECTIVELY BREAKS IT

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
2021-08-31 01:14:08 +02:00

65 lines
1.3 KiB
C++

#include <irrlicht/irrlicht.h>
#include "WallpaperEngine/Core/CObject.h"
#include "CSound.h"
using namespace WallpaperEngine::Core::Objects;
CSound::CSound (
bool visible,
irr::u32 id,
std::string name,
const glm::vec3& origin,
const glm::vec3& scale,
const glm::vec3& angles) :
CObject (visible, id, std::move(name), Type, origin, scale, angles)
{
}
WallpaperEngine::Core::CObject* CSound::fromJSON (
json data,
bool visible,
irr::u32 id,
std::string name,
const glm::vec3& origin,
const glm::vec3& scale,
const glm::vec3& angles)
{
auto sound_it = jsonFindRequired (data, "sound", "Sound information not present");
if ((*sound_it).is_array () == false)
{
throw std::runtime_error ("Expected sound list");
}
CSound* sound = new CSound (
visible,
id,
name,
origin,
scale,
angles
);
auto cur = (*sound_it).begin ();
auto end = (*sound_it).end ();
for (; cur != end; cur ++)
{
sound->insertSound (*cur);
}
return sound;
}
void CSound::insertSound (std::string filename)
{
this->m_sounds.push_back (filename);
}
const std::vector<std::string>& CSound::getSounds () const
{
return this->m_sounds;
}
const std::string CSound::Type = "sound";