From 0199157dbcbe71ef6af195114b9330d7e0520cb6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 25 May 2022 16:29:19 +0200 Subject: Document the coordinate system being used by QAudioEngine And fix the example to correctly position the sound source around the listener. Change-Id: I66035e22a47902552f08e3dac0cb1ee31608bb59 Reviewed-by: Paul Olav Tvete --- examples/multimedia/spatialaudio/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/multimedia') diff --git a/examples/multimedia/spatialaudio/main.cpp b/examples/multimedia/spatialaudio/main.cpp index 5124be431..b49396013 100644 --- a/examples/multimedia/spatialaudio/main.cpp +++ b/examples/multimedia/spatialaudio/main.cpp @@ -146,17 +146,17 @@ private slots: float d = distance->value(); float x = d*sin(az)*cos(el); - float y = d*cos(az)*cos(el); - float z = d*sin(el); + float y = d*sin(el); + float z = -d*cos(az)*cos(el); sound->setPosition({x, y, z}); } void newOcclusion() { sound->setOcclusionIntensity(occlusion->value()/100.); } - void useHeadphoneChanged(int state) + void modeChanged() { - engine.setOutputMode(state ? QAudioEngine::Headphone : QAudioEngine::Normal); + engine.setOutputMode(mode->currentData().value()); } void fileChanged(const QString &file) { -- cgit v1.2.3