Skip to content

3D sound

MMaillard edited this page Jun 27, 2024 · 1 revision

Set position of sound emitter

Sound sfx("../Sound/sfx1.wav");
sfx.enable3D(true);
sfx.setPosition(-10.f, 15.f, 0.f);
sfx.play()

Move sound emitter

Sound sfx("../Sound/sfx1.wav");
sfx.enable3D(true);
sfx.setPosition(-10.f, 15.f, 0.f);
sfx.play()

sfx.movePosition(1.f, 0.f, 0.f);

Set position of sound listener

Audio_System* audioSystem = Audio_System::getExistingInstance();
audioSystem->setListenerPosition(5.f, 15.f, 0.f);

Move sound listener

Audio_System* audioSystem = Audio_System::getExistingInstance();
audioSystem->moveListenerPosition(1.f, 0.f, 0.f);

Clone this wiki locally