SFML community forums

Help => Audio => Topic started by: Me-Myself-And-I on August 28, 2024, 09:31:56 pm

Title: Music.setVolume doesn't work.(SOLVED)
Post by: Me-Myself-And-I 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 (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.
Title: Re: Music.setVolume doesn't work.
Post by: eXpl0it3r 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.
Title: Re: Music.setVolume doesn't work.
Post by: Me-Myself-And-I on August 28, 2024, 11:02:20 pm
I mean it doesn't change the volume at all. Its still at 100% volume.
Title: Re: Music.setVolume doesn't work.
Post by: Hapax 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?
Title: Re: Music.setVolume doesn't work.
Post by: Me-Myself-And-I 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