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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PizzaParty

Pages: [1]
1
Audio / Re: AW: Re: sf::Music::openFromFile always return 0
« on: July 19, 2013, 10:08:28 pm »
and I got the exact same error. For my ogg file I wen to http://media.io/ to convert.
To convert what?
Maybe get one of the many free tools you can download. Online conversion isn't always that good. ;)

To convert a .mp3 file to .ogg format. I also tried with files that were already in .ogg format, amd I got the same error.

Just to make sure I cover all the possibilities... I put my libsndfile-1.dll and all my other dll files (sfml-graphics-2, etc) in the same folder as my main.cpp file. That is correct isn't it ?

2
Audio / Re: sf::Music::openFromFile always return 0
« on: July 19, 2013, 09:51:09 pm »
I don't remember where i got my original .dll but I just tried with the one from here:

https://github.com/SFML/SFML/blob/master/extlibs/bin/x86/libsndfile-1.dll

and I got the exact same error. For my ogg file I wen to http://media.io/ to convert.

3
Audio / Re: sf::Music::openFromFile always return 0
« on: July 19, 2013, 08:35:19 pm »
http://en.sfml-dev.org/forums/index.php?topic=1724.msg12120#msg12120
It's old though.

You think it as to do with the sndfile.dll ? I am currently using libsndfile-1.dll. I do not have a extlibs folder in my SFML-2.0 folder.

4
Audio / Re: sf::Music::openFromFile always return 0
« on: July 19, 2013, 06:51:57 pm »
Ah I understand. I could not see the console because my return call would end the program too quickly. I commented the line and now the we have some clues on what is going on.



So what does malformed mean exactly ? I tried many .ogg files from different sources. As for initialization, the initialize function is protected. I guess creating a class that derives from Music would solve the problem, but how does the tutorial work then ?

5
Audio / Re: sf::Music::openFromFile always return 0
« on: July 19, 2013, 03:27:08 am »
Console output doesn't seem to say anything relevant imo

'pong.exe': Loaded 'C:\Users\PierreClaude\Documents\Visual Studio 2010\Projects\pong\Release\pong.exe', Symbols loaded.
'pong.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Users\PierreClaude\Documents\Visual Studio 2010\Projects\pong\pong\sfml-graphics-2.dll', Binary was not built with debug information.
'pong.exe': Loaded 'C:\Users\PierreClaude\Documents\Visual Studio 2010\Projects\pong\pong\sfml-window-2.dll', Binary was not built with debug information.
'pong.exe': Loaded 'C:\Users\PierreClaude\Documents\Visual Studio 2010\Projects\pong\pong\sfml-system-2.dll', Binary was not built with debug information.
'pong.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Users\PierreClaude\Documents\Visual Studio 2010\Projects\pong\pong\sfml-audio-2.dll', Binary was not built with debug information.
'pong.exe': Loaded 'C:\Windows\SysWOW64\OpenAL32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Users\PierreClaude\Documents\Visual Studio 2010\Projects\pong\pong\libsndfile-1.dll', Binary was not built with debug information.
'pong.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xb6c) has exited with code 0 (0x0).
'pong.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'pong.exe': Unloaded 'C:\Windows\SysWOW64\powrprof.dll'
The thread 'Win32 Thread' (0x10b8) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xc34) has exited with code 0 (0x0).
'pong.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\propsys.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\wdmaud.drv', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\ksuser.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\avrt.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\AudioSes.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\msacm32.drv', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\msacm32.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\midimap.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\wrap_oal.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file
'pong.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x1b94) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1498) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1328) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1708) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xb48) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1aec) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1b70) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x19ac) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1738) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x14d0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xe70) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1098) has exited with code 0 (0x0).
'pong.exe': Unloaded 'C:\Windows\SysWOW64\wrap_oal.dll'
'pong.exe': Loaded 'C:\Windows\SysWOW64\wrap_oal.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x434) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1208) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x19a4) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x19d0) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1540) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x16fc) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x162c) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x18b4) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x680) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1210) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x8ec) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x11b0) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0xc70) has exited with code 1 (0x1).
The program '[4516] pong.exe: Native' has exited with code 1 (0x1).
 

6
Audio / Re: sf::Music::openFromFile always return 0
« on: July 19, 2013, 12:38:47 am »
I need to say that I have VLC media player installed on my computer so .ogg files show up as VLC media file (.ogg) instead of Ogg Vorbis file.

7
Audio / sf::Music::openFromFile always return 0
« on: July 19, 2013, 12:22:50 am »
Here is the code, taken from the Udemy online course

//Libraries
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

//Glboal variables, functions, classes

//C++ program entry point
int main()
{
        //Creating the window
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Game");

        //Settign the framerate limit to 60 FPS
        window.setFramerateLimit(60);

        window.setKeyRepeatEnabled(false);

        //Variable that keeps the game loop running
        bool play = true;

        //Event object holding all events
        sf::Event event;

        //States for button/events
        bool aPressed = false;
        bool aReleased = false;
        bool space = false;
        bool leftClick = false;

        //Variables
        int numberOfClicks = 0; //For counting the number of clicks
        int mouseX = 0, mouseY = 0;             //For storing the mouse position
        int rectXPosition = 0;  //Rectangles X position

        //Images
        sf::Texture image1; //Image/texture object
        if (image1.loadFromFile("Data/image2.png") == 0) //Load an image, if not close the program
        {
                return 1;
        }

        //Render shapes
        //Rectangle shape
        sf::RectangleShape rect;
        rect.setSize(sf::Vector2f(100, 100)); //Width and height
        rect.setPosition(0, 0); //Position
        rect.setFillColor(sf::Color::White); //White fill color so we don't change the images colors
        rect.setTexture(&image1); //Bind an image/texture to the rectangle

        //Circle shape
        sf::CircleShape circle;
        circle.setRadius(50); //Radius
        circle.setPosition(400,300); //Position
        circle.setFillColor(sf::Color::Blue); //Color

        //Font
        sf::Font font;  //Font object
        if (font.loadFromFile("Data/arial.ttf") == 0) //Safe way to load font
        {
                return 1;
        }

        //Text
        sf::Text title; //Text object
        title.setFont(font); //Which font will the text use
        title.setCharacterSize(30); //Character size
        title.setString("Hello World"); //Text/string to display
        title.setPosition(300, 50); //Position of the text
        title.setColor(sf::Color::Magenta); //Color of the text

        //Sounds
        sf::SoundBuffer ExplosionBuffer; //Sound buffor for the sound file
        if (ExplosionBuffer.loadFromFile("Data/explosion.wav") == 0) //Load the sound
        {
                return 1;
        }

        sf::Sound explosion; //Sound object
        explosion.setBuffer(ExplosionBuffer); //Bind the buffer to the object

        explosion.play(); //Play the sound

        //Music
        sf::Music drumLoop; //Music object
        if (drumLoop.openFromFile("Data/music.ogg") == 0) //Load the music file
        {
                return 1;
        }
       
        drumLoop.setLoop(true); //Loop the music file
        drumLoop.play(); //Play the music

        //Game loop
        while (play == true)
        {
                //EVENTS
                while (window.pollEvent(event))
                {
                        //Event type is key pressed and the key is 'A'
                        if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::A)
                        {
                                //Set the state to true
                                aPressed = true;
                        }

                        //Event type is key released and the key is 'A'
                        if (event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::A)
                        {
                                aReleased = true;
                        }

                        //Space key pressed
                        if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Space)
                        {
                                space = true;
                        }

                        //Space key released
                        if (event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::Space)
                        {
                                space = false;
                        }

                        //Left mouse button pressed down (clicked)
                        if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left)
                        {
                                leftClick = true;
                        }

                        //Mouse moved in the window
                        if (event.type == sf::Event::MouseMoved)
                        {
                                mouseX = event.mouseMove.x; //X position of the mouse
                                mouseY = event.mouseMove.y; //Y position of the mouse
                        }

                        //Event type is window closed
                        if (event.type == sf::Event::Closed)
                        {
                                //Set play to false in order to stop the game loop
                                play = false;
                        }
                }

                //LOGIC
                if (aPressed == true)
                {
                        //Print to the console
                        std::cout << "The A key has been pressed\n";

                        aPressed = false;
                }

                if (aReleased == true)
                {
                        std::cout << "The A key has been released\n";

                        aReleased = false;
                }

                //If the left mouse button was clicked
                if (leftClick == true)
                {
                        numberOfClicks++; //numberOfClicks = numberOfClicks + 1;

                        std::cout << "Number of clicks is " << numberOfClicks << "\n";

                        leftClick = false;
                }

                //Print out the position of the mouse.
                std::cout << "Mouse x: " << mouseX << " mouse y: " << mouseY << "\n";

                //Basic movement
                rectXPosition++; //X position variable of the rectangle
                rect.setPosition(rectXPosition, rectXPosition); //We set the rectangles X and Y position to the variable rectXPosition

                //RENDERING
                window.clear();

                window.draw(rect); //Draw the rectangle shape
                window.draw(circle); //Draw the circle shape
                window.draw(title); //Draw the text

                window.display();
        }
        ///////////

        //Clean up and close the window
        window.close();

        //Close the program
        return 0;
}

Now the problem is here :

        sf::Music drumLoop; //Music object
        if (drumLoop.openFromFile("Data/music.ogg") == 0) //Load the music file
        {
                return 1;
        }

I tried many different sound files, many different sound files sizes and made sure that the location and file name were correct. No matter what, the openFromFile function always returns 0, ending the program. Loading sounds is fine.

Pages: [1]
anything