O'Reilly logo

SFML Game Development By Example by Raimondas Pupius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the sound system

With both sound emitter and sound listener components out of the way, we have a green light to begin implementing the sound system that is going to bring all of this code to life. Let's get it started!

class S_Sound : public S_Base{ public: S_Sound(SystemManager* l_systemMgr); ~S_Sound(); void Update(float l_dT); void HandleEvent(const EntityId& l_entity, const EntityEvent& l_event); void Notify(const Message& l_message); void SetUp(AudioManager* l_audioManager, SoundManager* l_soundManager); private: sf::Vector3f MakeSoundPosition(const sf::Vector2f& l_entityPos, unsigned int l_elevation); void EmitSound(const EntityId& l_entity, const EntitySound& l_sound, bool l_useId, bool l_relative, int l_checkFrame = -1); AudioManager* ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required