CSound.cpp 907 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <SDL.h>
  2. #include "CSound.h"
  3. using namespace WallpaperEngine::Render::Objects;
  4. CSound::CSound (CScene* scene, Core::Objects::CSound* sound) :
  5. CObject (scene, Type, sound),
  6. m_sound (sound)
  7. {
  8. this->load ();
  9. }
  10. void CSound::load ()
  11. {
  12. for (const auto& cur : this->m_sound->getSounds ())
  13. {
  14. uint32_t filesize = 0;
  15. const void* filebuffer = this->getContainer ()->readFile (cur, &filesize);
  16. auto stream = new Audio::CAudioStream (this->getScene ()->getAudioContext (), filebuffer, filesize);
  17. stream->setRepeat (this->m_sound->isRepeat ());
  18. this->m_audioStreams.push_back (stream);
  19. this->m_soundBuffer.push_back (filebuffer);
  20. // add the stream to the context so it can be played
  21. this->getScene ()->getAudioContext ()->addStream (stream);
  22. }
  23. }
  24. void CSound::render ()
  25. {
  26. }
  27. const std::string CSound::Type = "sound";