Hi, I have a stereo audio effect playing in my scene, parented to a particular node/spot. As I move the camera/listener away I get the desired attenuation. However, if I pass by the sound source on either side then I can’t actually tell which side the audio is coming from. NinjaSnowWar achieves more by playing a sound from left or right depending where it is in the scene, and you can hear roughly where explosions happen because of it, but I’m working in .cpp not .as so it’s more difficult for me to learn from that example. Suggestions? It’s as if you’re wearing headphones listening to the sound and you turn the volume up or down depending how close you are to the sound source, so you can’t tell which side of you it may be on.
// Snippet from where the listener is created SoundListener* listener = cameraNode_->CreateComponent<SoundListener>(); GetSubsystem<Audio>()->SetListener(listener); // Snippet from where the audio begins playing Sound* effect = cache->GetResource<Sound>("Sounds/effect.ogg"); Node* effectNode = boxNode->CreateChild("soundEffect"); SoundSource3D* source = effectNode->CreateComponent<SoundSource3D>(); source->SetSoundType(SOUND_EFFECT); source->Play(effect);
listener is parented to the cameraNode, and
source is parented to the node in the scene I walk around (boxNode).