MCPcopy Create free account
hub / github.com/SFML/SFML / Surround

Method Surround

examples/sound_effects/SoundEffects.cpp:113–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111{
112public:
113 Surround() : Effect("Surround / Attenuation")
114 {
115 m_listener.setPosition({(windowWidth - 20.f) / 2.f, (windowHeight - 20.f) / 2.f});
116 m_listener.setFillColor(sf::Color::Red);
117
118 // Load the music file
119 if (!m_music.openFromFile(resourcesDir() / "doodle_pop.ogg"))
120 {
121 std::cerr << "Failed to load " << (resourcesDir() / "doodle_pop.ogg").string() << std::endl;
122 std::abort();
123 }
124
125 // Set the music to loop
126 m_music.setLooping(true);
127
128 // Set attenuation to a nice value
129 m_music.setAttenuation(0.04f);
130 }
131
132 void onUpdate(float /*time*/, float x, float y) override
133 {

Callers

nothing calls this directly

Calls 6

setAttenuationMethod · 0.80
resourcesDirFunction · 0.70
setPositionMethod · 0.45
setFillColorMethod · 0.45
openFromFileMethod · 0.45
setLoopingMethod · 0.45

Tested by

no test coverage detected