Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Stereo sound  (Read 3488 times)

0 Members and 1 Guest are viewing this topic.

AleVerDes

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Stereo sound
« on: January 05, 2014, 07:24:49 pm »
Hi!
How do I get surround sound and changing panorama?

I set Listener:
Listener.Position = new Vector3f(0.0f, 0.0f, 0.0f);
Listener.Direction = new Vector3f(0.0f, 0.0f, -1.0f);
Listener.GlobalVolume = 100.0f;

I set Sound: (soundbuffer have a 2 channel)
sound = new Sound(snd_shot_m249);
sound.RelativeToListener = false;
sound.Position = new Vector3f(0.0f, 0.0f, 0.0f);
sound.MinDistance = 5.0f;
sound.Attenuation = 10.0f;
sound.Play();

But when the position changes nothing sound - the sound still comes from the center of the panorama.

I think the problem may be in the audio file. Please help to solve this problem.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Stereo sound
« Reply #1 on: January 05, 2014, 07:37:31 pm »
If I am not mistaken, audio must be mono in order for sound positioning to work.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

AleVerDes

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Stereo sound
« Reply #2 on: January 05, 2014, 08:00:21 pm »
Thank you, you helped me .
But one more question on the same topic - transcode to mono WAV- format mode failed, so I had to use OGG. What are the risks ?
Explain the problem with WAV - output file weighs as much as his stereo original, standard players played normally. But when loaded into the game using SFML problems - no sound is played . About him , all the information up to the number of channels and the size , but the sound can not be played . The same thing happens if the file encode WAV- format in stereo mode ( surprising, but this file , in ideas , in no way should be different from the original, but weighs twice as much and also can not be played means SFML).

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Stereo sound
« Reply #3 on: January 06, 2014, 08:52:23 pm »
If I am not mistaken, audio must be mono in order for sound positioning to work.
Exactly, and it's highlighted in red in the tutorial. Why do people never read tutorials? :(

I don't know about the second problem, maybe the files are corrupted? Do you use special settings when creating the sound files?
« Last Edit: January 06, 2014, 08:54:03 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: