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

Author Topic: Music.setVolume doesn't work.(SOLVED)  (Read 1951 times)

0 Members and 1 Guest are viewing this topic.

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Music.setVolume doesn't work.(SOLVED)
« on: August 28, 2024, 09:31:56 pm »
For some unknown reason sf::music.setVolume() does not work at all. I'm sure its being called since It printed a test word to the console from the line of code directly before the function.
I saw that someone else had this problem here https://en.sfml-dev.org/forums/index.php?topic=20657.0 so I tried updating to the latest SFML with GCC 13. It still doesn't change the volume when it should. I have made this minimal example.

The following code gets run in the main loop after the music has been set.


cout<<"test"<<endl;
music.setVolume(0);

 

I'm guessing its either a problem with how I linked up SFML or a problem with SFML itself.
« Last Edit: August 30, 2024, 12:59:49 am by Me-Myself-And-I »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10987
    • View Profile
    • development blog
    • Email
Re: Music.setVolume doesn't work.
« Reply #1 on: August 28, 2024, 10:26:48 pm »
By "does not work at all" you mean the sound doesn't get quieter? Or you don't hear anything?

Make sure you're using the openal32.dll that ships with SFML and not one sourced from somewhere else.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Music.setVolume doesn't work.
« Reply #2 on: August 28, 2024, 11:02:20 pm »
I mean it doesn't change the volume at all. Its still at 100% volume.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Music.setVolume doesn't work.
« Reply #3 on: August 29, 2024, 09:24:25 pm »
Does music.getVolume() return zero correctly?

Is the volume affected if you stop and then re-start the music?

Is it possible you have a line somewhere else that sets its volume to something else?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Me-Myself-And-I

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Music.setVolume doesn't work.
« Reply #4 on: August 30, 2024, 12:59:24 am »
There was a line of code somewhere accidentally being run in a loop and setting the volume to 100. Thanks for the help.  :D

 

anything