SFML community forums

Help => Audio => Topic started by: ToastyPotatoes on August 07, 2016, 06:11:03 am

Title: setVolume() on Music doesn't work properly
Post by: ToastyPotatoes on August 07, 2016, 06:11:03 am
[SOLVED]: Was an issue with an old version of Visual Studio

I've got a truck ambience track that is too loud, and I'm trying to set it lower before it even starts. I run getVolume(), it returns the correct volume, but the actual audio still sounds like it's at 100%, and over 2 or 3 seconds it will fade to the level I told it to.

Anybody have an idea of what might be causing this?

EDIT:
Turns out it's not even really working at all, but getVolume() still returns the value I passed.
Title: Re: setVolume() on Music doesn't work properly
Post by: Hapax on August 08, 2016, 10:47:28 am
Which value are you setting it to? Volume range is, for some chosen reason, specified in percent so goes from 0 to 100.

Some actual code might help too. It would be good if you included a complete and minimal example (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368).
Title: Re: setVolume() on Music doesn't work properly
Post by: ToastyPotatoes on August 11, 2016, 06:08:58 am
Oh yeah, sorry about that. Here's a simplified version.

int main()
{
   sf::RenderWindow window(sf::VideoMode(800, 600), "RWBY Visual Novel");
   
   sf::Music music;
   music.openFromFile("VN_Resources/Sounds/march.wav");
        music.setVolume(10);
   music.setLoop(1);
   music.play();
   
   while(window.isOpen())
   {

   }
}


I just have no idea why it isn't working. It's obviously playing the file itself fine, and changing stereo to mono doesn't matter either. Changing file type didn't work either.
Title: Re: setVolume() on Music doesn't work properly
Post by: eXpl0it3r on August 11, 2016, 12:44:32 pm
Works fine for me. What OS are you on? What OpenAL are you using?
Title: Re: setVolume() on Music doesn't work properly
Post by: ToastyPotatoes on August 11, 2016, 09:08:05 pm
Problem solved. Bit of back story: my computer's a butt. It would crash every time I tried to install a version of Visual Studio over 2010 (along with many other issues), so I was running a very outdated version of VS, and a slightly out of date SFML version.

Point is, finally got a VS 2015 installed by downloading it on another computer and transferring the program over and messing with installation paths and junk, and now everything works. Thanks for trying to help :)