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

Author Topic: No sound after update to 2.1  (Read 3397 times)

0 Members and 1 Guest are viewing this topic.

shobbi123

  • Newbie
  • *
  • Posts: 3
    • View Profile
No sound after update to 2.1
« on: September 07, 2014, 01:05:32 pm »
Hi,

I updated a project of mine to SFML 2.1 from 1.6 and since that the sound is no longer playing. My project is a cross platform application for Win, Mac and Linux and with 2.1 the sound stopped working at least on Linux and Win (haven't tried Mac yet). I tried it on different PCs with the same result..
I wanted to get the example working under linux, just the sound part, but the sound is not playing either and I don't get any error message. That's the example code I'm trying to run:
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::Music music;
if (!music.openFromFile("/home/user/audiofile.ogg"))
    return EXIT_FAILURE;
music.play();
while (window.isOpen())
{
    sf::Event event;
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }
    window.clear();
    window.display();
}
return EXIT_SUCCESS;
Does anybody have an Idea what is wrong?

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: No sound after update to 2.1
« Reply #1 on: September 07, 2014, 02:21:24 pm »
Have you tried it with a specific file location i.e. full address?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: No sound after update to 2.1
« Reply #2 on: September 07, 2014, 02:52:07 pm »
On windows check that you are using the OpenAL dll included with the SFML package.

Have you tried it with a specific file location i.e. full address?

Really?? If the music can't be loaded then the program would exit immediately. Relative paths have nothing to do with this.
« Last Edit: September 07, 2014, 02:53:43 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: No sound after update to 2.1
« Reply #3 on: September 07, 2014, 04:54:53 pm »
The code looks reasonable. I assume that it runs but is silent and doesn't just exit at once due to loading failing?

Unfortunately I don't have any specific guesses except for the usual stuff that cause people trouble:

- are you perhaps mixing debug/release builds of the library and your code?

- are you sure that you are using the exact same compiler to build your code as was used to build SFML?

- assuming you downloaded a pre-built SFML, have you tried compiling it yourself so that it is built with the exact same compiler as your own code.

- have you tried the latest SFML from github? It has many bug fixes compared to 2.1 .

- have you tried using a debugger to gain some insight into what's going on?

shobbi123

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: No sound after update to 2.1
« Reply #4 on: September 07, 2014, 07:08:19 pm »
Thanks for the replies. I tried the full path to the file and I think I can count out compiler problems. I'm working under Linux currently, so everything (build setup, libs) comes from the Ubuntu repositories and should be compatible. I'll try debugging and if that does not help I'll revert to the old setup with sfml 1.6.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: No sound after update to 2.1
« Reply #5 on: September 07, 2014, 07:11:38 pm »
Are you 100% certain that what you got from the Ubuntu repos is SFML 2.1?
Are you 100% sure that you don't have any SFML 1.6 bits left that may be linked or included?

EDIT: and I really, strongly, recommend you to (uninstall all the distro SFML packages and) try a custom build of the latest github master branch rather than SFML 2.1 - there are so many improvements and bug fixes.

EDIT2: I have to ask the stupid question: if you use some other application to play the file, does it play OK on the same machine/OS?
« Last Edit: September 07, 2014, 08:21:47 pm by Jesper Juhl »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: No sound after update to 2.1
« Reply #6 on: September 08, 2014, 07:07:05 am »
Relative paths have nothing to do with this.
You couldn't've been certain of this. It could have been pointing to an empty or silent sound file that loads fine.

It's not that though because he's tried full path  :D

I'd also recommend upgrading to the latest github version. It scares me that you're considering going back to 1.6.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

shobbi123

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: No sound after update to 2.1
« Reply #7 on: September 09, 2014, 10:24:14 am »
I have to ask the stupid question: if you use some other application to play the file, does it play OK on the same machine/OS?

Acutally that was a good question, as the file didn't play in Amarok too. The reason was simply because I had the volume on the speakers turned down :D After turning up the volumne at the speakers I could hear the sound. Sorry for having stolen your time. Now I still have to figure out why my friends can not hear sound. I guess they don't have the same problem.

Thanks to all of you for your help.

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: No sound after update to 2.1
« Reply #8 on: September 14, 2014, 08:02:01 pm »
 ;D