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 - gmaslin

Pages: [1]
1
Audio / Re: sf::Sound won't play, unhandled exception when closed
« on: March 25, 2013, 03:36:58 am »
No dice.  Speakers work for other things, volume is up and not muted.

2
Audio / Re: sf::Sound won't play, unhandled exception when closed
« on: March 25, 2013, 03:14:55 am »
Thanks for the quick response.  Nope, it's really how I am using it.  Declaring soundBuffer and soundToPlay in a Engine.h, then the loadFromFile, setBuffer, and play occur off key press that is detected within Engine.cpp.

Good to hear that the issue has already been identified and at least that part isn't on my end.

Here is a simple version of the code.

//Engine.h
#ifndef GAME_ENGINE_H
#define GAME_ENGINE_H

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

class Engine
{
public:
    void gameRun();
private:
        sf::SoundBuffer soundBuffer;
        sf::Sound soundToPlay;
};

#endif
 

//Engine.cpp
void Engine::gameRun()
{
        while(myWindow.isOpen())
        {
                while(myWindow.pollEvent(pEvent))
                {
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                                myWindow.close();
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
                        {
                                soundBuffer.loadFromFile("Windows Critical Stop.wav");
                                soundToPlay.setBuffer(soundBuffer);
                                soundToPlay.setLoop(true);
                                soundToPlay.play();
                        }
                }
               
        }
}

3
Audio / sf::Sound won't play, unhandled exception when closed
« on: March 25, 2013, 02:50:32 am »
Hi all,
             Played around with this quite a lot and I'm sure the problem is on my end.  I'm doing something very simple at the moment.
int main()
{
sf::SoundBuffer soundBuffer;   
soundBuffer.loadFromFile("ball.wav");
                               
sf::Sound soundToPlay(soundBuffer);
soundToPlay.setLoop(true);
soundToPlay.play();
}

I never get a sound.  When I close the application, I receive an "Unhandled exception at 0x77b715de in myGameIsGod.exe: 0xC0000005: Access violation reading location 0xfeeefeee."  If I click break, it takes me to
AudioDevice::~AudioDevice()
{
    // Destroy the context
    alcMakeContextCurrent(NULL);
    if (audioContext)
        alcDestroyContext(audioContext);

    // Destroy the device
    if (audioDevice)
        alcCloseDevice(audioDevice);
}
The break occurs at alcCloseDevice(audioDevice).

I'm using VS2010 and SFML2.0.  If I take out the sound part, there are no issues.  If I leave the code in, but prevent the sound from happening, there are no issues.  I have openal32 and libsndfile-1 in my project folder.  I have sfml-audio-d-2.dll in my project folder and sfml-audio-d.lib linked.

The one part I'm not sure of is that I have to use the x86 openal32 and libsndfile-1 even though I'm on a 64-bit system.  If I use the 64-bit ones, I receive an "unable to start application" message.

Also, I tried redownloading openal32 and libsndfile-1 as part of the sfml 2.0 snapshot, no luck.  I also recompiled the libraries with nmake, no luck again.

Any thoughts on what I'm doing wrong?  Let me know if you need more information.

Pages: [1]