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

Author Topic: setVolume() on Music doesn't work properly  (Read 3997 times)

0 Members and 1 Guest are viewing this topic.

ToastyPotatoes

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
setVolume() on Music doesn't work properly
« 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.
« Last Edit: August 11, 2016, 09:08:49 pm by ToastyPotatoes »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: setVolume() on Music doesn't work properly
« Reply #1 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

ToastyPotatoes

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: setVolume() on Music doesn't work properly
« Reply #2 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.
« Last Edit: August 11, 2016, 06:24:14 am by ToastyPotatoes »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: setVolume() on Music doesn't work properly
« Reply #3 on: August 11, 2016, 12:44:32 pm »
Works fine for me. What OS are you on? What OpenAL are you using?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ToastyPotatoes

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: setVolume() on Music doesn't work properly
« Reply #4 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 :)