summaryrefslogtreecommitdiffstats
path: root/examples/multimedia
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2022-05-25 16:29:19 +0200
committerLars Knoll <lars.knoll@qt.io>2022-05-31 11:31:26 +0200
commit0199157dbcbe71ef6af195114b9330d7e0520cb6 (patch)
tree5643c4216179ce559492eb795d8de064c8bdc134 /examples/multimedia
parent8230ed46c9fef72591ed4741ab902913b49f3558 (diff)
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 <paul.tvete@qt.io>
Diffstat (limited to 'examples/multimedia')
-rw-r--r--examples/multimedia/spatialaudio/main.cpp8
1 files changed, 4 insertions, 4 deletions
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<QAudioEngine::OutputMode>());
}
void fileChanged(const QString &file)
{