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

Author Topic: Problems with sf::Sound*  (Read 7300 times)

0 Members and 1 Guest are viewing this topic.

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« on: February 19, 2012, 03:20:56 pm »
Hi everypony,

I've got a problem with a pointers to sf::Sound. I want to use a audio-management-class to handle all the sf::Sound and sf::Music.
This class puts all currently played sounds (and the music) in a map<unsigned int, sf::Sound*>, where the key is a random number. So I create a pointer to "new sf::Sound" and store both - the key and the pointer in the map.

But here's where the problem begins: My program terminates before the main-method is started! Usually my dbugger sets a breakpoint to the beginning of the main-method. (I even put a breakpoint to the first command manually) But these breakpoints will have no effect! The main-method simply does not start anymore!

So I commented out all methods of my Audio-Class und the includes.
Then I removed the comments one after the others. With the includes and the Header-file work properly. My program starts normally. Some methods work too. But as soon, as a method creates a pointer to a sf::Sound, the main program does not start anymore!

I also thied just "sf::Sound *s = new sf::Sound();". As soon as I I write one of this line, the program will not work anymore. Even if this method is NEVER called! "sf::Sound t()" works, but I need a sf::Sound, created with new...

Edit: I even tried "new sf::Sound();". This line will make my program not to start at all... Well... It starts, but it terminates before the main-method without any error-message.

Has someone seen something like that? O.o

Thanks,
Dodo

PS: Is use eclipse with mingw under Win7, 64 bit.
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problems with sf::Sound*
« Reply #1 on: February 19, 2012, 05:05:12 pm »
Can you please provide a complete and minimal example that reproduces the problem?
Laurent Gomila - SFML developer

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« Reply #2 on: February 19, 2012, 05:30:54 pm »
That's my problem. This must not happen! Neverever!

When I add "new sf::Sound();" as the first Command in my "int main(...)", this strange thing happens. The program will not start my code. It terminates before my code starts. The debugger will not come to the breakpoints.

I think, there is a problem with the compiler or the linker.
Here, I added some screenshots of my settings. Probably I did something wrong here...

http://imageshack.us/photo/my-images/535/librarypaths.png/
http://imageshack.us/photo/my-images/14/librariesu.png/
http://imageshack.us/photo/my-images/864/maing.png/
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problems with sf::Sound*
« Reply #3 on: February 19, 2012, 06:05:32 pm »
We need code so that we can test it and help you.

http://www.sfml-dev.org/forum/viewtopic.php?p=36368#36368
Laurent Gomila - SFML developer

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« Reply #4 on: February 19, 2012, 06:35:26 pm »
Here you have a code, that reproduces the problem:

Code: [Select]
#include<sfml/Audio.hpp>

int main(int argc, char* argv[])
{
new sf::Sound;
return 0;
}


Same build-configuration like before.

I use Win7 64 bit, Eclipse CDT, MinGW, SFML 1.6
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problems with sf::Sound*
« Reply #5 on: February 19, 2012, 06:56:34 pm »
Thanks.

SFML 1.6 has many problems and is not maintained anymore, you should switch to SFML 2, which will be released soon.
Laurent Gomila - SFML developer

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« Reply #6 on: February 19, 2012, 07:47:53 pm »
Hi, I downloaded SFML 2, compiled it and changed the project-settings to the new includes and libraries.... same problem...
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problems with sf::Sound*
« Reply #7 on: February 19, 2012, 08:09:23 pm »
Quote
Hi, I downloaded SFML 2, compiled it and changed the project-settings to the new includes and libraries.... same problem...

Are you sure that you really use the new SFML 2 libraries that you compiled? You had to update your code, right?
And did you copy the new openal and sndfile DLLs?
Laurent Gomila - SFML developer

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« Reply #8 on: February 19, 2012, 08:26:39 pm »
Quote from: "Laurent"
Are you sure that you really use the new SFML 2 libraries that you compiled?

Yes, the old files were in "D:\dev\sfml", the new ones are in "D:\dev\sfml2"
I changed all libraries to the new location. Because there are no "-d"- and "-s-d"-libraries, I changed that too.
Quote from: "Laurent"
You had to update your code, right?

Nope, all SFML-commands are commented out.
The one and only SFML-command is "new sf::Sound;"
Quote from: "Laurent"
And did you copy the new openal and sndfile DLLs?

I copied the "include"- and the "extlibs"-directories from the unpacked archive to "D:\dev\sfml2", if you mean that?
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problems with sf::Sound*
« Reply #9 on: February 19, 2012, 08:47:26 pm »
Quote
Because there are no "-d"- and "-s-d"-libraries, I changed that too.

You built the release libraries. If you test in debug mode, you must link to debug libraries.

Quote
The one and only SFML-command is "new sf::Sound;"

Ah, ok.

Quote
I copied the "include"- and the "extlibs"-directories from the unpacked archive to "D:\dev\sfml2", if you mean that?

Your executable needs the openal32.dll and libsndfile.dll files if it uses sfml-audio, so they must be available when it starts (either in a directory which is in the PATH environment variable, or in the executable directory).
Laurent Gomila - SFML developer

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« Reply #10 on: February 19, 2012, 09:04:14 pm »
Quote from: "Laurent"
You built the release libraries. If you test in debug mode, you must link to debug libraries.

Oh thank you. Just built them and edited my settings

Quote from: "Laurent"
Your executable needs the openal32.dll and libsndfile.dll files if it uses sfml-audio, so they must be available when it starts (either in a directory which is in the PATH environment variable, or in the executable directory).

Oh, just added to the PATH-Variable them, but... no effect...
I even restarted Eclipse.

Edit: I encountered the same problem with "window->ShowMouseCursor(false);", if that helps.
I can open the window, but as soon as this command is there, the entire program will not start anymore.
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

The last Dodo

  • Newbie
  • *
  • Posts: 13
    • ICQ Messenger - 301020362
    • MSN Messenger - dom.dopplinger@hotmail.com
    • View Profile
    • http://dodo.bplaced.net
Problems with sf::Sound*
« Reply #11 on: February 23, 2012, 07:10:12 pm »
Hi, I just figured out, that OpenAL was linked with the 64bit version, the rest of my program was 32 bit. Ich changed that and now it works.
Just my Debugger does not work now, but I hope, I'll get that too.
Maze: Dodo-Labyrinth
Jump 'n' Run: DodoRun

 

anything