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

Author Topic: [Solved] Audio Listener doenst seem to be working.  (Read 2892 times)

0 Members and 1 Guest are viewing this topic.

Rob92

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
[Solved] Audio Listener doenst seem to be working.
« on: April 01, 2016, 10:56:44 pm »
I'm trying to use the Listener in a 2D world.
I have a mono channel .WAV sound buffer which I play through a Sound.

            s.Position = new Vector3f(position.X, 0.0f, position.Y);
            s.Attenuation = 1.0f;
            s.RelativeToListener = true;
            s.Play();
 

I have set the Listener.Position to the same position as the Sound.
But I hear nothing, only when I make Attenuation 0.001 I hear something softly, but then it doesnt seem to matter what the Sound's position is. Even when I make the difference huge, the sound remains the same volume through my speakers.
Also, the Listener.GlobalVolume is set to 100.0f

Am I doing something wrong here?
« Last Edit: April 10, 2016, 02:47:21 pm by Rob92 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Audio Listener doenst seem to be working.
« Reply #1 on: April 02, 2016, 09:49:50 am »
Quote
s.RelativeToListener = true;
From what you say, you'd rather want this property to false. Make sure that you understand what it does ;)
Laurent Gomila - SFML developer

Rob92

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: Audio Listener doenst seem to be working.
« Reply #2 on: April 02, 2016, 10:34:08 am »
Oh I misunderstood the name of that property, I've set it to false but I still don't hear anything unless I put the Attunuation to 0.001f, but then the distance isnt as influencial and the sound is still really soft even when the listener is really close. Is it correct that I'm putting the Y values into the Z position (I saw this in a tutorial)?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Audio Listener doenst seem to be working.
« Reply #3 on: April 02, 2016, 11:27:35 am »
What is the position of the sound?
Laurent Gomila - SFML developer

Rob92

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: Audio Listener doenst seem to be working.
« Reply #4 on: April 02, 2016, 12:08:13 pm »
Im sorry, I made a mistake. After drawing the listener position I found out that it was in the wrong place, I have now put it to the center of my view instead of the position of my view and now it works.

Thanks for your time, sorry I wasted it  :-\

 

anything